fundamentalvision / Deformable-DETR

Deformable DETR: Deformable Transformers for End-to-End Object Detection.
Apache License 2.0
3.14k stars 513 forks source link

Error message: "AttributeError: module 'numpy' has no attribute 'float'". #192

Open musan6363 opened 1 year ago

musan6363 commented 1 year ago

I encountered the above error during the evaluation step. According to the error message, numpy.float is no longer a valid attribute in the latest version of NumPy (1.24 or later).

I'm wondering if there is a way to fix this issue without downgrading NumPy to version 1.24 or earlier. Specifically, I'm curious if I need to manually search and replace all occurrences of numpy.float in my codebase to fix this error.

Thanks in advance for any help or suggestions!

File "/usr/local/lib/python3.10/dist-packages/pycocotools/cocoeval.py", line 378, in accumulate
    coco_eval.accumulate()
File "/usr/local/lib/python3.10/dist-packages/pycocotools/cocoeval.py", line 378, in accumulate
    tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float)    
File "/usr/local/lib/python3.10/dist-packages/numpy/__init__.py", line 305, in __getattr__
    tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float)tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float)
    raise AttributeError(__former_attrs__[attr])raise AttributeError(__former_attrs__[attr])

AttributeError: : module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationsmodule 'numpy' has no attribute 'float'.
kapilrs2 commented 1 year ago

Were you able to setup the environment correctly ? I am facing issue there. Can you help me ?

musan6363 commented 1 year ago

I solved the problem by setting the numpy version to less than 1.24 (I set it to 1.23.4).

However, this is not an essential solution, and I would like to know if anyone knows of another solution.

kapilrs2 commented 1 year ago

Hey Musan,

I am facing issue in setting up environment. After installing pytorch and CUDA systematically as specified in (https://github.com/fundamentalvision/Deformable-DETR) and then the error comes when I go ahead to compile CUDA operator. Can you please help me resolve this issue? If possible, we can connect on virtual meeting too.