From 858fc6795403b7bb67b2525fac0a867132455dbc Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 22 Aug 2019 16:39:55 +0200 Subject: [PATCH] updates --- utils/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/utils.py b/utils/utils.py index c5272766..ec4c9dbf 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -552,6 +552,15 @@ def get_yolo_layers(model): return [i for i, x in enumerate(bool_vec) if x] # [82, 94, 106] for yolov3 +def print_model_biases(model): + # prints the bias neurons preceding each yolo layer + for l in model.yolo_layers: # print pretrained biases + b = model.module_list[l - 1][0].bias.view(3, -1) # bias 3x85 + print('regression: %.2f+/-%.2f, ' % (b[:, :4].mean(), b[:, :4].std()), + 'objectness: %.2f+/-%.2f, ' % (b[:, 4].mean(), b[:, 4].std()), + 'classification: %.2f+/-%.2f' % (b[:, 5:].mean(), b[:, 5:].std())) + + def strip_optimizer_from_checkpoint(filename='weights/best.pt'): # Strip optimizer from *.pt files for lighter files (reduced by 2/3 size) a = torch.load(filename, map_location='cpu')