matteorr / coco-analyze

A wrapper of the COCOeval class for extended keypoint error estimation analysis.
MIT License
231 stars 52 forks source link

ValueError: cannot convert float NaN to integer #7

Closed mkocabas closed 5 years ago

mkocabas commented 6 years ago

Hi, thanks for sharing code. I got the below error in later stages of analysis. It seems there is a problem with matplotlib, however I can't solve it. Is it a problem with my result file or the api itself? Thanks!

Analyzing keypoint errors...
<mrr:2.0>Running per image evaluation...
<mrr:2.0>Evaluate annotation type *keypoints*
<mrr:2.0>DONE (t=1.70s).
DONE (t=5.07s).
/home/mkocabas/coco-analyze/analysisAPI/localizationErrors.py:136: RuntimeWarning: invalid value encountered in double_scalars
  ERRORS.append(tot_errs/float(sum(err_vecs[j])))
Traceback (most recent call last):
  File "run_analysis.py", line 127, in <module>
    main()
  File "run_analysis.py", line 99, in main
    paths = localizationErrors( coco_analyze, imgs_info, saveDir )
  File "/home/mkocabas/coco-analyze/analysisAPI/localizationErrors.py", line 146, in localizationErrors
    patches, autotexts = ax1.pie( ERRORS, colors=colors)
  File "/usr/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1814, in inner
    return func(ax, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 2600, in pie
    **wedgeprops)
  File "/usr/lib/python2.7/dist-packages/matplotlib/patches.py", line 1008, in __init__
    self._recompute_path()
  File "/usr/lib/python2.7/dist-packages/matplotlib/patches.py", line 1020, in _recompute_path
    arc = Path.arc(theta1, theta2)
  File "/usr/lib/python2.7/dist-packages/matplotlib/path.py", line 861, in arc
    n = int(2 ** np.ceil((eta2 - eta1) / halfpi))
ValueError: cannot convert float NaN to integer
matteorr commented 6 years ago

Somehow there is a NaN value in the variable ERRORS and that causes the matplotlib function ax1.pie( ERRORS, colors=colors) to crash. Does this happen also with the fake_keypoints contained in the detections folder?

WillBrennan commented 6 years ago

I've had a similar issue, it happened when I passed the COCO annotations in as detections and gave them all a score of 1.0.

matteorr commented 5 years ago

Closing after @WillBrennan's reply. Feel free to reopen if issue comes up again.