Skip to content

Commit

Permalink
move scheduler.step() to train()
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiyangZhou committed Mar 27, 2019
1 parent 4cd20b5 commit 1e9d466
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 0 additions & 3 deletions torchreid/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ def run(self, save_dir='log', max_epoch=0, start_epoch=0, fixbase_epoch=0, open_
for epoch in range(start_epoch, max_epoch):
self.train(epoch, trainloader, print_freq=print_freq)

if self.scheduler is not None:
self.scheduler.step()

if (epoch+1)>start_eval and eval_freq>0 and (epoch+1)%eval_freq==0 and (epoch+1)!=max_epoch:
rank1 = self.test(
epoch,
Expand Down
5 changes: 4 additions & 1 deletion torchreid/engine/image/softmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,7 @@ def train(self, epoch, trainloader, fixbase=False, open_layers=None, print_freq=
loss=losses,
acc=accs))

end = time.time()
end = time.time()

if self.scheduler is not None:
self.scheduler.step()
5 changes: 4 additions & 1 deletion torchreid/engine/image/triplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,7 @@ def train(self, epoch, trainloader, fixbase=False, open_layers=None, print_freq=
loss_x=losses_x,
acc=accs))

end = time.time()
end = time.time()

if self.scheduler is not None:
self.scheduler.step()

0 comments on commit 1e9d466

Please sign in to comment.