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

找不到模型文件 #11

Open
DapperZhengLong opened this issue Jul 15, 2024 · 2 comments
Open

找不到模型文件 #11

DapperZhengLong opened this issue Jul 15, 2024 · 2 comments

Comments

@DapperZhengLong
Copy link

我下载源码并安装完环境后,执行,出现Traceback (most recent call last):
File "test_ocr.py", line 13, in
model = ONNXPaddleOcr(use_angle_cls=True, use_gpu=False)
File "C:\Users\zheng\Desktop\OnnxOCR-main\onnxocr\onnx_paddleocr.py", line 27, in init
super().init(params)
File "C:\Users\zheng\Desktop\OnnxOCR-main\onnxocr\predict_system.py", line 17, in init
self.text_classifier = predict_cls.TextClassifier(args)
File "C:\Users\zheng\Desktop\OnnxOCR-main\onnxocr\predict_cls.py", line 17, in init
self.cls_onnx_session = self.get_onnx_session(args.cls_model_dir, args.use_gpu)
File "C:\Users\zheng\Desktop\OnnxOCR-main\onnxocr\predict_base.py", line 14, in get_onnx_session
onnx_session = onnxruntime.InferenceSession(model_dir, None,providers=providers)
File "C:\Users\zheng\miniconda3\envs\py38\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 360, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\Users\zheng\miniconda3\envs\py38\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 397, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.NoSuchFile: [ONNXRuntimeError] : 3 : NO_SUCHFILE : Load model from ./onnxocr/models/ppocrv4/cls/cls.onnx OnnxOCR-main\onnxocr\models\ppocrv4\cls\cls.onnx failed:Load model ./onnxocr/models/ppocrv4/cls/cls.onnx OnnxOCR-main\onnxocr\models\ppocrv4\cls\cls.onnx failed. File doesn't exist。我发现utils.py文件305行parser.add_argument("--cls_model_dir", type=str, default='./onnxocr/models/ppocrv4/cls/cls.onnx OnnxOCR-main\onnxocr\models\ppocrv4\cls\cls.onnx')出错,需要修改为parser.add_argument("--cls_model_dir", type=str, default='./onnxocr/models/ppocrv4/cls/cls.onnx')

@jingsongliujing
Copy link
Owner

这个问题和你本身的工程路径有关,尽量把onnxocr这个文件夹和test_ocr.py在同一目录

@DapperZhengLong
Copy link
Author

Thanks♪(・ω・)ノ

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