prec_meter.update(prec) if (step+1) % cfg.steps_per_log == 0 or (step+1)%len(train_loader) == 0: log = '\tStep {}/{} in Ep {}, {:.2f}s, loss{:.4f}, prec{:.4f}'.format( step+1, dataset_L, epoch+1, time.time()-step_st, loss_meter.val, prec_meter.val) print(log) ############## # epoch log # ############## log = 'Ep{}, {:.2f}s, loss {:.4f}, prec {:.4f}'.format( epoch+1, time.time() - ep_st, loss_meter.avg, prec_meter.avg) print(log) # model ckpt if (epoch + 1) % cfg.epochs_per_save == 0: ckpt_file = os.path.join(cfg.exp_dir, 'model', 'ckpt_epoch%d.pth'%(epoch+1)) save_ckpt(modules_optims, epoch+1, 0, ckpt_file) ########################## # test on validation set # ########################## if (epoch + 1) % cfg.epochs_per_val == 0: result = reid_evaluate(feat_func, test_set, **cfg.test_kwargs) print('-' * 60) print('Evaluation on %s set:' % (cfg.test_split)) for evaluation in result.keys(): print('%s:' % (evaluation)) print("mAP: %.4f, Rank1: %.4f, Rank5: %.4f, Rank10: %.4f" % (result[evaluation]['mAP'], result[evaluation]['CMC'][0, 0],\ result[evaluation]['CMC'][0, 4], result[evaluation]['CMC'][0, 9])) print('-' * 60)
if (step+1) % cfg.steps_per_log == 0 or (step+1)%len(train_loader) == 0: log = '\tStep {}/{} in Ep {}, {:.2f}s, loss{:.4f}'.format( step+1, dataset_L, epoch+1, time.time()-step_st, loss_meter.val) print(log) ############## # epoch log # ############## log = 'Ep{}, {:.2f}s, loss {:.4f}'.format( epoch+1, time.time() - ep_st, loss_meter.avg) print(log) # model ckpt if (epoch + 1) % cfg.epochs_per_save == 0: ckpt_file = os.path.join(cfg.exp_dir, 'model', 'ckpt_epoch%d.pth'%(epoch+1)) save_ckpt(modules_optims, epoch+1, 0, ckpt_file) ########################## # test on validation set # ########################## if (epoch + 1) % cfg.epochs_per_val == 0: result = reid_evaluate(feat_func, test_set, **cfg.test_kwargs) print('-' * 60) print('Evaluation on %s set:' % (cfg.test_split)) for evaluation in result.keys(): print('%s:' % (evaluation)) print("mAP: %.4f, Rank1: %.4f, Rank5: %.4f, Rank10: %.4f" % (result[evaluation]['mAP'], result[evaluation]['CMC'][0, 0],\ result[evaluation]['CMC'][0, 4], result[evaluation]['CMC'][0, 9])) print('-' * 60) # log to TensorBoard