breezedeus / CnOCR

CnOCR: Awesome Chinese/English OCR Python toolkits based on PyTorch. It comes with 20+ well-trained models for different application scenarios and can be used directly after installation. 【基于 PyTorch/MXNet 的中文/英文 OCR Python 包。】
https://www.breezedeus.com/article/cnocr
Apache License 2.0
3.24k stars 504 forks source link

ImportError: cannot import name 'ConvBNActivation' from 'torchvision.models.mobilenetv2' #242

Closed YCYAX closed 1 month ago

YCYAX commented 1 year ago

Traceback (most recent call last): File "C:\Users\18154\Desktop\slg\test.py", line 2, in from cnocr import CnOcr File "C:\Users\18154\Desktop\slg\venv\Lib\site-packages\cnocr__init__.py", line 21, in from .cn_ocr import CnOcr, gen_model File "C:\Users\18154\Desktop\slg\venv\Lib\site-packages\cnocr\cn_ocr.py", line 31, in from cnocr.models.ocr_model import OcrModel File "C:\Users\18154\Desktop\slg\venv\Lib\site-packages\cnocr\models\ocr_model.py", line 34, in from .mobilenet import gen_mobilenet_v3 File "C:\Users\18154\Desktop\slg\venv\Lib\site-packages\cnocr\models\mobilenet.py", line 25, in from torchvision.models.mobilenetv2 import ConvBNActivation ImportError: cannot import name 'ConvBNActivation' from 'torchvision.models.mobilenetv2' (C:\Users\18154\Desktop\slg\venv\Lib\site-packages\torchvision\models\mobilenetv2.py)

python:3.11.2 torchvision:0.15.1

breezedeus commented 1 year ago

更新到最新版cnocr

YCYAX commented 1 year ago

Could not find a version that satisfies the requirement onnxruntime (from cnocr) (from versions: none) 应该是onnxruntime在python3.11版本上没有支持

breezedeus commented 1 year ago

Python3.11 的确有兼容问题,建议用3.10