From c59193644620886becc9a3cfd7518ad74e6a7986 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Dec 2018 21:49:56 +0100 Subject: [PATCH] updates --- requirements.txt | 3 --- train.py | 7 ++++--- utils/utils.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2e16f2e3..2d57893b 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,5 @@ # pip3 install -U -r requirements.txt numpy -scipy opencv-python torch matplotlib -tqdm -h5py \ No newline at end of file diff --git a/train.py b/train.py index ef8466c7..e244f495 100644 --- a/train.py +++ b/train.py @@ -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'], diff --git a/utils/utils.py b/utils/utils.py index 12d161bd..293c5961 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -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))