weight_decay fix
This commit is contained in:
parent
c906047db3
commit
23dfeacfcd
31
test.py
31
test.py
|
@ -165,23 +165,26 @@ def test(cfg,
|
||||||
|
|
||||||
# Save JSON
|
# Save JSON
|
||||||
if save_json and map and len(jdict):
|
if save_json and map and len(jdict):
|
||||||
imgIds = [int(Path(x).stem.split('_')[-1]) for x in dataset.img_files]
|
try:
|
||||||
with open('results.json', 'w') as file:
|
imgIds = [int(Path(x).stem.split('_')[-1]) for x in dataset.img_files]
|
||||||
json.dump(jdict, file)
|
with open('results.json', 'w') as file:
|
||||||
|
json.dump(jdict, file)
|
||||||
|
|
||||||
from pycocotools.coco import COCO
|
from pycocotools.coco import COCO
|
||||||
from pycocotools.cocoeval import COCOeval
|
from pycocotools.cocoeval import COCOeval
|
||||||
|
|
||||||
# https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
|
# https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
|
||||||
cocoGt = COCO('../coco/annotations/instances_val2014.json') # initialize COCO ground truth api
|
cocoGt = COCO('../coco/annotations/instances_val2014.json') # initialize COCO ground truth api
|
||||||
cocoDt = cocoGt.loadRes('results.json') # initialize COCO pred api
|
cocoDt = cocoGt.loadRes('results.json') # initialize COCO pred api
|
||||||
|
|
||||||
cocoEval = COCOeval(cocoGt, cocoDt, 'bbox')
|
cocoEval = COCOeval(cocoGt, cocoDt, 'bbox')
|
||||||
cocoEval.params.imgIds = imgIds # [:32] # only evaluate these images
|
cocoEval.params.imgIds = imgIds # [:32] # only evaluate these images
|
||||||
cocoEval.evaluate()
|
cocoEval.evaluate()
|
||||||
cocoEval.accumulate()
|
cocoEval.accumulate()
|
||||||
cocoEval.summarize()
|
cocoEval.summarize()
|
||||||
map = cocoEval.stats[1] # update mAP to pycocotools mAP
|
map = cocoEval.stats[1] # update mAP to pycocotools mAP
|
||||||
|
except:
|
||||||
|
print('WARNING: pycocotools not installed, can not compute official COCO mAP')
|
||||||
|
|
||||||
# Return results
|
# Return results
|
||||||
maps = np.zeros(nc) + map
|
maps = np.zeros(nc) + map
|
||||||
|
|
Loading…
Reference in New Issue