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

Code doesn't work with numpy>=1.24 #8743

Closed
VinhLoiIT opened this issue Dec 30, 2022 · 8 comments
Closed

Code doesn't work with numpy>=1.24 #8743

VinhLoiIT opened this issue Dec 30, 2022 · 8 comments
Assignees
Labels
needs investigation this issue needs investigation to either narrow down, or clarify software compatibility triaged this issue has been looked, and triaged.

Comments

@VinhLoiIT
Copy link

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

The code will not work with numpy>=1.24

Reference for the deprecation: https://numpy.org/devdocs/release/1.20.0-notes.html#using-the-aliases-of-builtin-types-like-np-int-is-deprecated

When using paddleocr with the previous numpy versions (<1.24), it just raises some DeprecationWarning. However, numpy has officially removed them in the version 1.24 and onward (>=1.24).

Aside from np.int, np.bool8 would be considered as well

  • 系统环境/System Environment: Ubuntu 22.04
  • 版本号/Version:Paddle 2.6.1: PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:
  • 完整报错/Complete Error Message:
  ... <hide due to some confidential information>
  File "/opt/venv/lib/python3.9/site-packages/paddleocr/paddleocr.py", line 534, in ocr                                                                                    
    """                                                                                                                                                                    
  File "/opt/venv/lib/python3.9/site-packages/paddleocr/tools/infer/predict_system.py", line 71, in __call__                                                               
    dt_boxes, elapse = self.text_detector(img)                                                                                                                             
  File "/opt/venv/lib/python3.9/site-packages/paddleocr/tools/infer/predict_det.py", line 271, in __call__                                                                 
    post_result = self.postprocess_op(preds, shape_list)                                                                                                                   
  File "/opt/venv/lib/python3.9/site-packages/paddleocr/ppocr/postprocess/db_postprocess.py", line 240, in __call__                                                        
    boxes, scores = self.boxes_from_bitmap(pred[batch_index], mask,                                                                                                        
  File "/opt/venv/lib/python3.9/site-packages/paddleocr/ppocr/postprocess/db_postprocess.py", line 131, in boxes_from_bitmap                                               
    score = self.box_score_fast(pred, points.reshape(-1, 2))                                                                                                               
  File "/opt/venv/lib/python3.9/site-packages/paddleocr/ppocr/postprocess/db_postprocess.py", line 188, in box_score_fast                                                 
    xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1)                                                                                                     
  File "/opt/venv/lib/python3.9/site-packages/numpy/__init__.py", line 284, in __getattr__                                                                                
    raise AttributeError("module {!r} has no attribute "                                                                                                                   
AttributeError: module 'numpy' has no attribute 'int'  
@an1018
Copy link
Collaborator

an1018 commented Jan 3, 2023

Thanks for your suggestion, we'll discuss it further.

@an1018
Copy link
Collaborator

an1018 commented Jan 6, 2023

We'vd solved this problem, you can try again

@csiki
Copy link

csiki commented Feb 7, 2023

Still doesn't work; installed paddleocr with pip and got the same error - in db_postprocess.py on line 188-191, there are some np.int.

@bondzhan
Copy link

use numpy 1.23.5, it's work

@4ft35t
Copy link

4ft35t commented Aug 7, 2023

同样问题
pip3 install paddleocr paddlepaddle --upgrade PyMuPDF==1.21.1

OS:              macOS 13.5
paddleocr             2.6.0.1
paddlepaddle          2.5.1
numpy 版本 是否工作
1.25.2 N
1.24.4 N
1.24.0 N
1.23.5 Y

目前可用一行命令
pip3 install paddleocr paddlepaddle --upgrade PyMuPDF==1.21.1 'numpy<1.24'

@tjc0726
Copy link

tjc0726 commented Aug 8, 2023

same problem,I'm using
pip3 install paddleocr paddlepaddle --upgrade PyMuPDF==1.21.1

@jcyrss
Copy link

jcyrss commented Dec 6, 2023

这个问题解决了吗?我这边还是不行,

这样根据网上的建议,安装的 paddleocr

pip.exe install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1

因为不加 --upgrade PyMuPDF==1.21.1 就会有 ERROR: Failed building wheel for PyMuPDF

哎,感觉步步是坑,这个库有百度有人认真的维护吗?

@jzhang533 jzhang533 assigned Liyulingyue and unassigned an1018 Apr 10, 2024
@jzhang533 jzhang533 added triaged this issue has been looked, and triaged. needs investigation this issue needs investigation to either narrow down, or clarify software compatibility labels Apr 10, 2024
@SWHL
Copy link
Collaborator

SWHL commented Jun 5, 2024

问题在PR #12249 中已经修复了,issue先行关闭了,有问题再开

@SWHL SWHL closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation this issue needs investigation to either narrow down, or clarify software compatibility triaged this issue has been looked, and triaged.
Projects
None yet
Development

No branches or pull requests

10 participants