cocodataset/cocoapi

cocoeval.py: np.linspace issues with numpy 1.18.0+ and Python3.5+

allenwang28 opened this issue · 7 comments

Hello,

If you have an environment with Python3.5+ and numpy 1.18.0+ installed and try:

from pycocotools import cocoeval
cocoeval.Params(iouType='bbox')

You will get the following error:
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.

This is fixed if you change both instances of:

self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
self.recThrs = np.linspace(.0, 1.00, np.round((1.00 - .0) / .01) + 1, endpoint=True)

with

self.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05)) + 1, endpoint=True)
self.recThrs = np.linspace(.0, 1.00, int(np.round((1.00 - .0) / .01)) + 1, endpoint=True)

I don't have the ability to make a pull request for this, but can someone add this in? :)

Thanks!

I faced the same issue last week! I stumbled upon this page and the title of this page gave away the workaround for this issue. It is the recently released Numpy version 1.18.0 that is fuzzy. Until this issue is resolved, simply downgrading to Numpy 1.17.5 would do the trick and you can move on with life.

I have installed Numpy 1.17.5, but the error is still reported WARNING: pycocotools must be installed with numpy==1.17 to run correctly.

我上周遇到了同样的问题!我偶然发现了该页面,该页面的标题放弃了此问题的解决方法。最近发布的Numpy 1.18.0版本比较模糊。在此问题得到解决之前,只需将其降级为Numpy 1.17.5即可解决问题,并且可以继续生活。

I think this issue fixed by PR #354 .

I have installed Numpy 1.17.5, but the error is still reported WARNING: pycocotools must be installed with numpy==1.17 to run correctly.

I have the same problem

I didn't even see this available. I get:

Collecting numpy==1.17
Could not find a version that satisfies the requirement numpy==1.17 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0b3, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.11.1rc1, 1.11.1, 1.11.2rc1, 1.11.2, 1.11.3, 1.12.0b1, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.1rc1, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6)
No matching distribution found for numpy==1.17

I have installed Numpy 1.17.5, but the error is still reported WARNING: pycocotools must be installed with numpy==1.17 to run correctly.

I have the same problem

have you solved this problem ?