Skip to content

Commit

Permalink
update test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jul 16, 2020
1 parent ac82985 commit 62c106d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,12 @@ def test(data,
with open(f, 'w') as file:
json.dump(jdict, file)

try:
try: # https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval

# https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
cocoGt = COCO(glob.glob('../coco/annotations/instances_val*.json')[0]) # initialize COCO ground truth api
cocoDt = cocoGt.loadRes(f) # initialize COCO pred api

cocoEval = COCOeval(cocoGt, cocoDt, 'bbox')
cocoEval.params.imgIds = imgIds # image IDs to evaluate
cocoEval.evaluate()
Expand Down Expand Up @@ -242,8 +240,7 @@ def test(data,
opt.data = check_file(opt.data) # check file
print(opt)

# task = 'val', 'test', 'study'
if opt.task in ['val', 'test']: # (default) run normally
if opt.task in ['val', 'test']: # run normally
test(opt.data,
opt.weights,
opt.batch_size,
Expand Down

0 comments on commit 62c106d

Please sign in to comment.