From ef6f5b33a8c1a23e43bea8d661f1e90c7e0e0b68 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 17 Jul 2020 00:11:27 +0200 Subject: [PATCH] rename test --- eval.py | 24 ++++++++++++------------ train.py | 16 ++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/eval.py b/eval.py index 0da0395..4aa692e 100644 --- a/eval.py +++ b/eval.py @@ -5,7 +5,7 @@ from models.experimental import * from utils.datasets import * -def evaluate(data, +def test(data, weights=None, batch_size=16, imgsz=640, @@ -254,16 +254,16 @@ if __name__ == '__main__': print(opt) if opt.task in ['val', 'test']: # run normally - evaluate(opt.data, - opt.weights, - opt.batch_size, - opt.img_size, - opt.conf_thres, - opt.iou_thres, - opt.save_json, - opt.single_cls, - opt.augment, - opt.verbose) + test(opt.data, + opt.weights, + opt.batch_size, + opt.img_size, + opt.conf_thres, + opt.iou_thres, + opt.save_json, + opt.single_cls, + opt.augment, + opt.verbose) elif opt.task == 'study': # run over a range of settings and save/plot for weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt', 'yolov3-spp.pt']: @@ -272,7 +272,7 @@ if __name__ == '__main__': y = [] # y axis for i in x: # img-size print('\nRunning %s point %s...' % (f, i)) - r, _, t = evaluate(opt.data, weights, opt.batch_size, i, opt.conf_thres, opt.iou_thres, opt.save_json) + r, _, t = test(opt.data, weights, opt.batch_size, i, opt.conf_thres, opt.iou_thres, opt.save_json) y.append(r + t) # results and times np.savetxt(f, y, fmt='%10.4g') # save os.system('zip -r study.zip study_*.txt') diff --git a/train.py b/train.py index ad12b5d..1c28fec 100644 --- a/train.py +++ b/train.py @@ -291,14 +291,14 @@ def train(hyp): ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride']) final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP - results, maps, times = eval.evaluate(opt.data, - batch_size=batch_size, - imgsz=imgsz_test, - save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), - model=ema.ema, - single_cls=opt.single_cls, - dataloader=testloader, - save_dir=log_dir) + results, maps, times = eval.test(opt.data, + batch_size=batch_size, + imgsz=imgsz_test, + save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), + model=ema.ema, + single_cls=opt.single_cls, + dataloader=testloader, + save_dir=log_dir) # Write with open(results_file, 'a') as f: