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

PPOCRLabel绘制矩形框频繁闪退 #10578

Closed
zhwsh opened this issue Aug 8, 2023 · 9 comments
Closed

PPOCRLabel绘制矩形框频繁闪退 #10578

zhwsh opened this issue Aug 8, 2023 · 9 comments
Assignees
Labels

Comments

@zhwsh
Copy link

zhwsh commented Aug 8, 2023

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

  • 系统环境/System Environment:mac os 12.6.2
  • 版本号/Version:Paddle:2.5.1 PaddleOCR:2.7.0.0 问题相关组件/Related components:PPOCRLabel 2.0.0 & 2.3.1
  • 运行指令/Command Code:PPOCRLabel --lang ch --kie True
  • -python 3.8.17
  • opencv-contrib-python 4.6.0.66
  • opencv-contrib-python-headless 4.6.0.66
  • opencv-python 4.6.0.66
  • 完整报错/Complete Error Message:

Traceback (most recent call last):
File "/Users/xxx/.anaconda3/lib/python3.11/site-packages/PPOCRLabel/libs/canvas.py", line 596, in paintEvent
p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)
TypeError: arguments did not match any overloaded call:
drawRect(self, rect: QRectF): argument 1 has unexpected type 'float'
drawRect(self, x: int, y: int, w: int, h: int): argument 1 has unexpected type 'float'
drawRect(self, r: QRect): argument 1 has unexpected type 'float'

@ToddBear ToddBear added the good first issue Good for newcomers label Aug 9, 2023
@Gmgge
Copy link
Contributor

Gmgge commented Aug 11, 2023

如果可以的话,能简述一下重现条件嘛?

@zhwsh
Copy link
Author

zhwsh commented Aug 14, 2023

@Gmgge
启动界面命令:PPOCRLabel --lang ch --kie True
image

选择矩形标注,点击鼠标左键触发报错。

@Gmgge
Copy link
Contributor

Gmgge commented Aug 16, 2023

根据追溯,你可以查看相关说明,简单来说是数据类型自动转换出现问题,你可以尝试以下方案以解决该问题。
1.升级PyQt5版本 pip install --upgrade PyQt5 PyQt5-Qt5 PyQt5-sip(如果升级出现报错 请卸载重装)
2.如果升级后仍不能解决,修改代码进行主动类型转换,最简单的方案是修改/Users/xxx/.anaconda3/lib/python3.11/site-packages/PPOCRLabel/libs/canvas.py 文件中line 596 为p.drawRect(int(leftTop.x()), int(leftTop.y()), int(rectWidth), int(rectHeight))

@kwanxian
Copy link

kwanxian commented Sep 4, 2023

报错信息:

PPOCRLabel\libs\canvas.py", line 599, in paintEvent
    p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)
TypeError: arguments did not match any overloaded call:
  drawRect(self, rect: QRectF): argument 1 has unexpected type 'float'
  drawRect(self, x: int, y: int, w: int, h: int): argument 1 has unexpected type 'float'
  drawRect(self, r: QRect): argument 1 has unexpected type 'float'

自行更改:

# p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)
x, y, w, h = [int(i) for i in (leftTop.x(), leftTop.y(), rectWidth, rectHeight)]
p.drawRect(x, y, w, h)

@yidasanqian
Copy link

碰到同样问题,python版本3.10.13

@mir134
Copy link

mir134 commented Nov 3, 2023

碰到同样问题,python版本3.10

@zrp2023
Copy link

zrp2023 commented Dec 15, 2023

same problem

@UserWangZz
Copy link
Collaborator

参考 #11236
该issue长时间未更新,暂将此issue关闭,如有需要可重新开启。

@noiiiu
Copy link

noiiiu commented Jul 24, 2024

根据追溯,你可以查看相关说明,简单来说是数据类型自动转换出现问题,你可以尝试以下方案以解决该问题。 1.升级PyQt5版本 pip install --upgrade PyQt5 PyQt5-Qt5 PyQt5-sip(如果升级出现报错 请卸载重装) 2.如果升级后仍不能解决,修改代码进行主动类型转换,最简单的方案是修改/Users/xxx/.anaconda3/lib/python3.11/site-packages/PPOCRLabel/libs/canvas.py 文件中line 596 为p.drawRect(int(leftTop.x()), int(leftTop.y()), int(rectWidth), int(rectHeight))

实际操作了一下 升级PyQt5之后还是会报错 方法2这个可以解决问题 改动的地方不止line 596,我的版本(PPOCRLabel= 2.1.0)下line 615、615、596都进行了修改 修改完成后问题解决 非常感谢!!!

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

No branches or pull requests