This commit is contained in:
Glenn Jocher 2019-04-18 22:55:50 +02:00
parent b5bfc30759
commit 0d770e14df
2 changed files with 4 additions and 15 deletions

17
test.py
View File

@ -125,7 +125,7 @@ def test(
iou, bi = bbox_iou(pbox, tbox).max(0)
# If iou > threshold and class is correct mark as correct
if iou > iou_thres and bi not in detected:
if iou > iou_thres and bi not in detected: # and pcls == tcls[bi]
correct[i] = 1
detected.append(bi)
@ -139,17 +139,6 @@ def test(
p, r, ap, f1, ap_class = ap_per_class(*stats)
mp, mr, map, mf1 = p.mean(), r.mean(), ap.mean(), f1.mean()
if any(r > 1):
chkpt = {'epoch': -1,
'best_loss': None,
'model': model.module.state_dict() if type(
model) is nn.parallel.DistributedDataParallel else model.state_dict(),
'optimizer': None}
# Save problem checkpoint
torch.save(chkpt, 'recall_issue.pt')
del chkpt
# Print results
pf = '%20s' + '%10.3g' * 6 # print format
print(pf % ('all', seen, nt.sum(), mp, mr, map, mf1), end='\n\n')
@ -187,8 +176,8 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='test.py')
parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file')
parser.add_argument('--data-cfg', type=str, default='data/coco_100img.data', help='coco.data file path')
parser.add_argument('--weights', type=str, default='weights/recall_issue.pt', help='path to weights file')
parser.add_argument('--iou-thres', type=float, default=0.5, help='iou threshold required to qualify as detected')
parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')
parser.add_argument('--nms-thres', type=float, default=0.5, help='iou threshold for non-maximum suppression')

View File

@ -61,7 +61,7 @@ git clone https://github.com/ultralytics/yolov3 # master
cp -r weights yolov3
cp -r cocoapi/PythonAPI/pycocotools yolov3
cd yolov3
python3 train.py --evolve --data data/coco_100img.data --batch-size 8 --epochs 100 --num-workers 2
python3 train.py --evolve --data data/coco_100img.data --num-workers 2
gsutil cp evolve.txt gs://ultralytics
sudo shutdown