This commit is contained in:
Glenn Jocher 2020-01-17 10:49:07 -08:00
parent c0cde1edf0
commit 1bc50ebfab
1 changed files with 4 additions and 4 deletions

View File

@ -633,7 +633,7 @@ def get_yolo_layers(model):
def print_model_biases(model): def print_model_biases(model):
# prints the bias neurons preceding each yolo layer # prints the bias neurons preceding each yolo layer
print('\nModel Bias Summary:') print('\nModel Bias Summary: %8s%18s%18s%18s' % ('layer', 'regression', 'objectness', 'classification'))
multi_gpu = type(model) in (nn.parallel.DataParallel, nn.parallel.DistributedDataParallel) multi_gpu = type(model) in (nn.parallel.DataParallel, nn.parallel.DistributedDataParallel)
for l in model.yolo_layers: # print pretrained biases for l in model.yolo_layers: # print pretrained biases
if multi_gpu: if multi_gpu:
@ -642,9 +642,9 @@ def print_model_biases(model):
else: else:
na = model.module_list[l].na na = model.module_list[l].na
b = model.module_list[l - 1][0].bias.view(na, -1) # bias 3x85 b = model.module_list[l - 1][0].bias.view(na, -1) # bias 3x85
print('layer %3g regression: %5.2f+/-%-5.2f ' % (l, b[:, :4].mean(), b[:, :4].std()), print(' ' * 20 + '%8g %18s%18s%18s' % (l, '%5.2f+/-%-5.2f' % (b[:, :4].mean(), b[:, :4].std()),
'objectness: %5.2f+/-%-5.2f ' % (b[:, 4].mean(), b[:, 4].std()), '%5.2f+/-%-5.2f' % (b[:, 4].mean(), b[:, 4].std()),
'classification: %5.2f+/-%-5.2f' % (b[:, 5:].mean(), b[:, 5:].std())) '%5.2f+/-%-5.2f' % (b[:, 5:].mean(), b[:, 5:].std())))
def strip_optimizer(f='weights/last.pt'): # from utils.utils import *; strip_optimizer() def strip_optimizer(f='weights/last.pt'): # from utils.utils import *; strip_optimizer()