pycocotools and numpy 1.17 fix for #1182

This commit is contained in:
Glenn Jocher 2020-05-15 20:50:58 -07:00
parent f6a19d5b32
commit 3f27ef1253
2 changed files with 15 additions and 13 deletions

View File

@ -1,5 +1,6 @@
# pip install -U -r requirements.txt
numpy
# pycocotools requires numpy 1.17 https://github.com/cocodataset/cocoapi/issues/356
numpy == 1.17
opencv-python >= 4.1
torch >= 1.5
matplotlib

View File

@ -204,8 +204,6 @@ def test(cfg,
try:
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
except:
print('WARNING: missing pycocotools package, can not compute official COCO mAP. See requirements.txt.')
# 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
@ -217,6 +215,9 @@ def test(cfg,
cocoEval.accumulate()
cocoEval.summarize()
# mf1, map = cocoEval.stats[:2] # update to pycocotools results (mAP@0.5:0.95, mAP@0.5)
except:
print('WARNING: pycocotools must be installed with numpy==1.17 to run correctly. '
'See https://github.com/cocodataset/cocoapi/issues/356')
# Return results
maps = np.zeros(nc) + map