This commit is contained in:
Glenn Jocher 2019-12-27 09:28:10 -08:00
parent 0bdbe5648d
commit 2fe6c21ce8
2 changed files with 6 additions and 5 deletions

10
test.py
View File

@ -48,9 +48,9 @@ def test(cfg,
nc = int(data['classes']) # number of classes nc = int(data['classes']) # number of classes
path = data['valid'] # path to test images path = data['valid'] # path to test images
names = load_classes(data['names']) # class names names = load_classes(data['names']) # class names
iou_thres = torch.linspace(0.5, 0.95, 10).to(device) # for mAP@0.5:0.95 # iou_thres = torch.linspace(0.5, 0.95, 10).to(device) # for mAP@0.5:0.95
iou_thres = iou_thres[0].view(1) # for mAP@0.5 # iou_thres = iou_thres[0].view(1) # for mAP@0.5
niou = iou_thres.numel() niou = 1 # len(iou_thres)
# Dataloader # Dataloader
if dataloader is None: if dataloader is None:
@ -245,9 +245,9 @@ if __name__ == '__main__':
# Parameter study # Parameter study
y = [] y = []
x = np.arange(0.4, 0.9, 0.05) x = np.arange(0.4, 0.9, 0.05)
for v in x: for i in x:
t = time.time() t = time.time()
r = test(opt.cfg, opt.data, opt.weights, opt.batch_size, opt.img_size, opt.conf_thres, v, opt.save_json)[0] r = test(opt.cfg, opt.data, opt.weights, opt.batch_size, opt.img_size, opt.conf_thres, i, opt.save_json)[0]
y.append(r + (time.time() - t,)) y.append(r + (time.time() - t,))
np.savetxt('study.txt', y, fmt='%10.4g') # y = np.loadtxt('study.txt') np.savetxt('study.txt', y, fmt='%10.4g') # y = np.loadtxt('study.txt')

View File

@ -330,6 +330,7 @@ def train():
img_size=opt.img_size, img_size=opt.img_size,
model=model, model=model,
conf_thres=0.001 if final_epoch else 0.1, # 0.1 for speed conf_thres=0.001 if final_epoch else 0.1, # 0.1 for speed
iou_thres=0.6 if opt.evolve else 0.5,
save_json=final_epoch and is_coco, save_json=final_epoch and is_coco,
dataloader=testloader) dataloader=testloader)