Skip to content

Commit

Permalink
Merge pull request #17 from naruarjun/main
Browse files Browse the repository at this point in the history
Leaf Variable inplace bug fix
  • Loading branch information
Riser6 committed Oct 27, 2021
2 parents da61cff + 775d27f commit 3b99fcf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/models/YOLOP.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ def _initialize_biases(self, cf=None): # initialize biases into Detect(), cf is
m = self.model[self.detector_index] # Detect() module
for mi, s in zip(m.m, m.stride): # from
b = mi.bias.view(m.na, -1) # conv.bias(255) to (3,85)
b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
b[:, 5:] += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls
b.data[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
b.data[:, 5:] += math.log(0.6 / (m.nc - 0.99)) if cf is None else torch.log(cf / cf.sum()) # cls
mi.bias = torch.nn.Parameter(b.view(-1), requires_grad=True)

def get_net(cfg, **kwargs):
Expand Down

0 comments on commit 3b99fcf

Please sign in to comment.