1. 程式人生 > 實用技巧 >AssertionError: Results do not correspond to current coco set

AssertionError: Results do not correspond to current coco set

提交COCO Detection Challenge (Bounding Box)時出現錯誤:

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
/opt/conda/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Traceback (most recent call last):
  File "/tmp/codalab/tmpbULj9X/run/program/run.py", line 117, in 
    cocoDt=cocoGt.loadRes(resFile)
  File "/opt/conda/lib/python2.7/site-packages/pycocotools/coco.py", line 317, in loadRes
    'Results do not correspond to current coco set'
AssertionError: Results do not correspond to current coco set

原因在於MS COCO 2017的測試集資料被劃分成了兩個子集:Test-Dev和Test-Challege,每個子集各20K張圖片,但是這兩個子集的圖片是放在一個資料夾裡面的,如果把這個資料夾裡面的40K張圖片的預測檔案一起提交到伺服器,就會出現上面的錯誤.

解決的方法:根據image_info_test-dev2017.json檔案,把Test-Dev資料集包含的圖片找出來,只提交這些圖片的預測檔案,就不會出現這個錯誤了.