Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NP_****_TYPES error #858

Open
isega24 opened this issue Oct 16, 2024 · 0 comments
Open

NP_****_TYPES error #858

isega24 opened this issue Oct 16, 2024 · 0 comments

Comments

@isega24
Copy link

isega24 commented Oct 16, 2024

Hi, imgaug developers,

I was having the following error:

tests/test_postProcessor.py:4: in
from openood.evaluation_api import Evaluator
.conda/lib/python3.10/site-packages/openood/evaluation_api/init.py:1: in
from .evaluator import Evaluator
.conda/lib/python3.10/site-packages/openood/evaluation_api/evaluator.py:11: in
from openood.evaluators.metrics import compute_all_metrics
.conda/lib/python3.10/site-packages/openood/evaluators/init.py:1: in
from .utils import get_evaluator
.conda/lib/python3.10/site-packages/openood/evaluators/utils.py:1: in
from openood.evaluators.mos_evaluator import MOSEvaluator
.conda/lib/python3.10/site-packages/openood/evaluators/mos_evaluator.py:13: in
from openood.postprocessors import BasePostprocessor
.conda/lib/python3.10/site-packages/openood/postprocessors/init.py:14: in
from .godin_postprocessor import GodinPostprocessor
.conda/lib/python3.10/site-packages/openood/postprocessors/godin_postprocessor.py:7: in
from openood.preprocessors.transform import normalization_dict
.conda/lib/python3.10/site-packages/openood/preprocessors/init.py:3: in
from .draem_preprocessor import DRAEMPreprocessor
.conda/lib/python3.10/site-packages/openood/preprocessors/draem_preprocessor.py:6: in
import imgaug.augmenters as iaa
.conda/lib/python3.10/site-packages/imgaug/init.py:7: in
from imgaug.imgaug import * # pylint: disable=redefined-builtin
.conda/lib/python3.10/site-packages/imgaug/imgaug.py:45: in
NP_FLOAT_TYPES = set(np.sctypes["float"])
.conda/lib/python3.10/site-packages/numpy/init.py:400: in getattr
raise AttributeError(
E AttributeError: np.sctypes was removed in the NumPy 2.0 release. Access dtypes explicitly instead.

As said in the last line, in Numpy 2.0 it is not allowed to define the following lines linked:

NP_FLOAT_TYPES = set(np.sctypes["float"])
NP_INT_TYPES = set(np.sctypes["int"])
NP_UINT_TYPES = set(np.sctypes["uint"])

https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/imgaug.py#L39C1-L41C40

I changed those lines to:

NP_FLOAT_TYPES = set(np.sctypes["float"])
NP_INT_TYPES = set(np.sctypes["int"])
NP_UINT_TYPES = set(np.sctypes["uint"])

and worked for me. Is it okey to change those lines for the whole repo?

Thank you for your answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@isega24 and others