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

numpy>=1.20: np.int was a deprecated alias for the builtin int #72

Open
jandoerntlein opened this issue Mar 3, 2025 · 2 comments
Open

Comments

@jandoerntlein
Copy link

Describe the bug
symbol_extraction.py and staffline_extraction.py use "np.int" instead of only "int". This type was deprecated starting with numpy 1.20.

Input Image
This is not dependent on the input image. It is dependent on the used numpy version.

IMPORTANT The issue will be closed directly if you don't provide the image and the issue relates to transcription bugs.

Full Traceback

Matplotlib is building the font cache; this may take a moment.
2025-03-03 08:33:05 No checkpoint found in /.venv/lib/python3.13/site-packages/oemer/checkpoints/unet_big/model.onnx
2025-03-03 08:33:05 Downloading checkpoints (1/4)
1st_model.onnx: 100% 70767752/70767752
2025-03-03 08:33:20 Downloading checkpoints (2/4)
1st_weights.h5: 100% 70977288/70977288
2025-03-03 08:33:34 Downloading checkpoints (3/4)
2nd_model.onnx: 100% 38448467/38448467
2025-03-03 08:33:42 Downloading checkpoints (4/4)
2nd_weights.h5: 100% 38570576/38570576
2025-03-03 08:33:50 Extracting staffline and symbols
/.venv/lib/python3.13/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:115: UserW
arning: Specified provider 'CUDAExecutionProvider' is not in available provider names.Available providers: 'CoreMLExecutionProvider, AzureExecutionProvider, CPUExecutionProvider'
        if right_bound - end < step_size:
  warnings.warn(
2025-03-03 08:33:50.713967 [W:onnxruntime:, coreml_execution_provider.cc:115 GetCapability] CoreMLExecutionProvider::GetCapability, number of partitions supported by CoreML: 86 number of nodes in the graph: 1577 number of nodes supported by CoreML: 102
1899 1935
2025-03-03 08:34:46 Extracting layers of different symbols
2025-03-03 08:34:46.454388 [W:onnxruntime:, coreml_execution_provider.cc:115 GetCapability] CoreMLExecutionProvider::GetCapability, number of partitions supported by CoreML: 94 number of nodes in the graph: 1619 number of nodes supported by CoreML: 107
1899 1935
2025-03-03 08:36:41 Dewarping
2025-03-03 08:36:43 Extracting stafflines
55 277 Traceback (most recent call last):
  File "/.venv/bin/oemer", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/.venv/lib/python3.13/site-packages/oemer/ete.py", line 276, in main
    mxl_path = extract(args)
  File "//.venv/lib/python3.13/site-packages/oemer/ete.py", line 167, in extract
    staffs, zones = staff_extract()
                    ~~~~~~~~~~~~~^^
  File "/.venv/lib/python3.13/site-packages/oemer/staffline_extraction.py", line 327, in extract
    rr = np.array(rr, dtype=np.int)
                            ^^^^^^
  File "/.venv/lib/python3.13/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(__former_attrs__[attr], name=None)
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
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

Command You Execute
oemer xyz.jpg

@zmk5566
Copy link

zmk5566 commented Mar 20, 2025

encountered the same problem

@siahuat0727
Copy link

I encountered the same issue and found that adding:

import numpy as np  
np.int = np.int32

to oemer/__init__.py helps bypass the problem.

Either manually modify the file or run the command below:

python -c "import oemer, os; print(os.path.join(oemer.__path__[0], '__init__.py'))" | xargs -I{} bash -c 'echo -e "import numpy as np\nnp.int = np.int32" >> "{}"'

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

3 participants