This commit is contained in:
Glenn Jocher 2018-12-11 21:49:56 +01:00
parent 7fb729269b
commit c591936446
3 changed files with 5 additions and 7 deletions

View File

@ -1,8 +1,5 @@
# pip3 install -U -r requirements.txt
numpy
scipy
opencv-python
torch
matplotlib
tqdm
h5py

View File

@ -107,11 +107,12 @@ def train(
model_info(model)
t0, t1 = time.time(), time.time()
mean_recall, mean_precision = 0, 0
print('%11s' * 16 % (
'Epoch', 'Batch', 'x', 'y', 'w', 'h', 'conf', 'cls', 'total', 'P', 'R', 'nTargets', 'TP', 'FP', 'FN', 'time'))
for epoch in range(epochs):
epoch += start_epoch
print(('%8s%12s' + '%10s' * 14) % ('Epoch', 'Batch', 'x', 'y', 'w', 'h', 'conf', 'cls', 'total', 'P', 'R',
'nTargets', 'TP', 'FP', 'FN', 'time'))
# Update scheduler (automatic)
# scheduler.step()
@ -178,7 +179,7 @@ def train(
if k.sum() > 0:
mean_recall = recall[k].mean()
s = ('%11s%11s' + '%11.3g' * 14) % (
s = ('%8s%12s' + '%10.3g' * 14) % (
'%g/%g' % (epoch, epochs - 1), '%g/%g' % (i, len(dataloader) - 1), rloss['x'],
rloss['y'], rloss['w'], rloss['h'], rloss['conf'], rloss['cls'],
rloss['loss'], mean_precision, mean_recall, model.losses['nT'], model.losses['TP'],

View File

@ -33,7 +33,7 @@ def model_info(model): # Plots a line-by-line description of a PyTorch model
print('\n%5s %50s %9s %12s %20s %12s %12s' % ('layer', 'name', 'gradient', 'parameters', 'shape', 'mu', 'sigma'))
for i, (name, p) in enumerate(model.named_parameters()):
name = name.replace('module_list.', '')
print('%5g %50s %9s %12g %20s %12g %12g' % (
print('%5g %50s %9s %12g %20s %12.3g %12.3g' % (
i, name, p.requires_grad, p.numel(), list(p.shape), p.mean(), p.std()))
print('Model Summary: %g layers, %g parameters, %g gradients\n' % (i + 1, n_p, n_g))