glenn-jocher
commited on
Commit
•
9922c11
1
Parent(s):
3004fb5
leaf Variable inplace bug fix (#1759)
Browse files- models/yolo.py +2 -2
models/yolo.py
CHANGED
@@ -149,8 +149,8 @@ class Model(nn.Module):
|
|
149 |
m = self.model[-1] # Detect() module
|
150 |
for mi, s in zip(m.m, m.stride): # from
|
151 |
b = mi.bias.view(m.na, -1) # conv.bias(255) to (3,85)
|
152 |
-
b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
|
153 |
-
b[:, 5:] += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls
|
154 |
mi.bias = torch.nn.Parameter(b.view(-1), requires_grad=True)
|
155 |
|
156 |
def _print_biases(self):
|
|
|
149 |
m = self.model[-1] # Detect() module
|
150 |
for mi, s in zip(m.m, m.stride): # from
|
151 |
b = mi.bias.view(m.na, -1) # conv.bias(255) to (3,85)
|
152 |
+
b.data[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
|
153 |
+
b.data[:, 5:] += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls
|
154 |
mi.bias = torch.nn.Parameter(b.view(-1), requires_grad=True)
|
155 |
|
156 |
def _print_biases(self):
|