From f743235fac9571a8ef8fdf873fd480c2abf5930d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 24 Feb 2020 12:44:22 -0800 Subject: [PATCH] updates --- train.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/train.py b/train.py index 4208b4cd..5d8d3dc3 100644 --- a/train.py +++ b/train.py @@ -288,7 +288,7 @@ def train(): else: loss.backward() - # Accumulate gradient for x batches before optimizing + # Optimize accumulated gradient if ni % accumulate == 0: optimizer.step() optimizer.zero_grad() @@ -301,6 +301,9 @@ def train(): # end batch ------------------------------------------------------------------------------------------------ + # Update scheduler + scheduler.step() + # Process epoch results final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP @@ -316,9 +319,6 @@ def train(): single_cls=opt.single_cls, dataloader=testloader) - # Update scheduler - scheduler.step() - # Write epoch results with open(results_file, 'a') as f: f.write(s + '%10.3g' * 7 % results + '\n') # P, R, mAP, F1, test_losses=(GIoU, obj, cls)