From d55dbc1f2913794495763d6f31936364f40918a8 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 9 Mar 2020 20:08:19 -0700 Subject: [PATCH] updates --- models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 652cd713..69618066 100755 --- a/models.py +++ b/models.py @@ -94,9 +94,11 @@ def create_modules(module_defs, img_size, arc): bc = math.log(1 / (modules.nc - 0.99)) # cls bias: class probability is sigmoid(p) = 1/nc j = l[yolo_index] if 'from' in mdef else -1 - bias = module_list[j][0].bias.view(modules.na, -1) # 255 to 3x85 + bias_ = module_list[j][0].bias # shape(255,) + bias = bias_[:modules.no * modules.na].view(modules.na, -1) # shape(3,85) bias[:, 4] += bo - bias[:, 4].mean() # obj bias[:, 5:] += bc - bias[:, 5:].mean() # cls, view with utils.print_model_biases(model) + module_list[j][0].bias = torch.nn.Parameter(bias_, requires_grad=bias_.requires_grad) except: print('WARNING: smart bias initialization failure.')