Skip to content

AttributeError: module 'numpy' has no attribute 'float' in DeepIM-PyTorch #16

@spoonytripod

Description

@spoonytripod

Hi!
I encountered an error while running demo.sh in DeepIM-PyTorch. The error seems to be related to the deprecation of np.float in NumPy 1.20 and later.

Error message:

./experiments/scripts/demo.sh

  • set -e
  • export PYTHONUNBUFFERED=True
  • PYTHONUNBUFFERED=True
  • export CUDA_VISIBLE_DEVICES=0
  • CUDA_VISIBLE_DEVICES=0
  • ./tools/test_images.py --gpu 0 --imgdir data/demo/ --meta data/demo/meta.yml --color '*color.png' --network flownets --pretrained data/checkpoints/ycb_object/flownets_ycb_object_20objects_color_self_supervision_epoch_10.checkpoint.pth --dataset ycb_object_test --cfg experiments/cfgs/ycb_object_flow.yml
    Traceback (most recent call last):
    File "./tools/test_images.py", line 26, in
    from datasets.factory import get_dataset
    File "/home/cilab/DeepIM-PyTorch/tools/../lib/datasets/init.py", line 10, in
    from .dex_ycb import DexYCBDataset
    File "/home/cilab/DeepIM-PyTorch/tools/../lib/datasets/dex_ycb.py", line 25, in
    from utils.cython_bbox import bbox_overlaps
    File "bbox.pyx", line 9, in init cython_bbox
    File "/home/cilab/miniconda3/envs/py38-nvlabs/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
    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#deprecations

real 0m2.687s
user 0m1.758s
sys 0m2.571s

Steps to reproduce:
Run the demo script: ./experiments/scripts/demo.sh

Environment Details:
OS: Ubuntu 22.04
Python Version: 3.8
NumPy Version: 1.24.4
CUDA Version: 11.7.r11.7
PyTorch Version: 2.0.1

Additional Information:
I attempted to fix the issue by modifying bbox.pyx at line 9:
DTYPE = np.float # Original
DTYPE = np.float64 # Modified

However, the same error persists. I would appreciate any guidance on resolving this issue.
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions