Update modeling_diffusiondet.py
Browse files- modeling_diffusiondet.py +7 -1
modeling_diffusiondet.py
CHANGED
@@ -127,7 +127,13 @@ class DiffusionDet(PreTrainedModel):
|
|
127 |
self.criterion = CriterionDynamicK(config, num_classes=self.num_classes, weight_dict=weight_dict)
|
128 |
|
129 |
def _init_weights(self, module):
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
def predict_noise_from_start(self, x_t, t, x0):
|
133 |
return (
|
|
|
127 |
self.criterion = CriterionDynamicK(config, num_classes=self.num_classes, weight_dict=weight_dict)
|
128 |
|
129 |
def _init_weights(self, module):
|
130 |
+
if isinstance(module, nn.Linear) or isinstance(module, nn.Conv2d):
|
131 |
+
init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='relu')
|
132 |
+
if module.bias is not None:
|
133 |
+
init.constant_(module.bias, 0)
|
134 |
+
elif isinstance(module, nn.BatchNorm2d):
|
135 |
+
init.constant_(module.weight, 1)
|
136 |
+
init.constant_(module.bias, 0)
|
137 |
|
138 |
def predict_noise_from_start(self, x_t, t, x0):
|
139 |
return (
|