This commit is contained in:
Glenn Jocher 2019-12-20 09:08:57 -08:00
parent 2bc6683325
commit 442dbb6acf
1 changed files with 25 additions and 22 deletions

47
test.py
View File

@ -223,26 +223,29 @@ if __name__ == '__main__':
opt = parser.parse_args() opt = parser.parse_args()
print(opt) print(opt)
# Test study = False
test(opt.cfg, if not study:
opt.data, # Test
opt.weights, test(opt.cfg,
opt.batch_size, opt.data,
opt.img_size, opt.weights,
opt.conf_thres, opt.batch_size,
opt.nms_thres, opt.img_size,
opt.save_json or any([x in opt.data for x in ['coco.data', 'coco2014.data', 'coco2017.data']])) opt.conf_thres,
opt.nms_thres,
opt.save_json or any([x in opt.data for x in ['coco.data', 'coco2014.data', 'coco2017.data']]))
else:
# Parameter study
y = []
x = np.arange(0.4, 0.81, 0.1)
for v in x:
y.append(test(opt.cfg, opt.data, opt.weights, opt.batch_size, opt.img_size, 0.1, v, True)[0])
y = np.stack(y, 0)
# # Parameter study # Plot
# y = [] fig, ax = plt.subplots(1, 1, figsize=(10, 5))
# x = np.arange(0.4, 0.81, 0.1) ax.plot(x, y[:, 2], marker='.', label='mAP@0.5')
# for v in x: ax.plot(x, y[:, 3], marker='.', label='mAP@0.5:0.95')
# y.append(test(opt.cfg, opt.data, opt.weights, opt.batch_size, opt.img_size, 0.1, v, True)[0]) ax.legend()
# y = np.stack(y, 0) fig.tight_layout()
# plt.savefig('parameters.jpg', dpi=200)
# fig, ax = plt.subplots(1, 1, figsize=(12, 6))
# ax.plot(x, y[:, 2], marker='.', label='mAP@0.5')
# ax.plot(x, y[:, 3], marker='.', label='mAP@0.5:0.95')
# ax.legend()
# fig.tight_layout()
# plt.savefig('parameters.jpg', dpi=200)