We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
运行rapidocr_api -workers 2后,同时进行两个识别,概率失败。是我没用正确的使用方式吗?
rapidocr_api -workers 2
同时运行两个rapidocr_api,但是使用不同端口就没有问题。
rapidocr_api
Ubuntu24.04 Python3.12.3
# server端 rapidocr_api -workers 2 # client端开两个终端同时请求识别 # server端结果 2025-01-27 00:12:38,312 INFO Uvicorn running on http://0.0.0.0:9003 (Press CTRL+C to quit) 2025-01-27 00:12:38,312 INFO Started parent process [5152] 2025-01-27 00:12:40,589 INFO Started server process [5175] 2025-01-27 00:12:40,589 INFO Waiting for application startup. 2025-01-27 00:12:40,589 INFO Application startup complete. 2025-01-27 00:12:40,606 INFO Started server process [5176] 2025-01-27 00:12:40,607 INFO Waiting for application startup. 2025-01-27 00:12:40,607 INFO Application startup complete. 2025-01-27 00:12:52,832 INFO 192.168.1.7:38370 - "POST /ocr HTTP/1.1" 200 2025-01-27 00:12:53,296 INFO 192.168.1.7:38378 - "POST /ocr HTTP/1.1" 200 2025-01-27 00:13:22,411 INFO 192.168.1.7:45974 - "POST /ocr HTTP/1.1" 500 2025-01-27 00:13:22,412 ERROR Exception in ASGI application Traceback (most recent call last): File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_openvino/utils/infer_engine.py", line 29, in __call__ self.session.infer(inputs=[input_content]) File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/ie_api.py", line 132, in infer return OVDict(super().infer(_data_dispatch( ^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/utils/data_helpers/data_dispatcher.py", line 447, in _data_dispatch return create_shared(inputs, request) if is_shared else create_copied(inputs, request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/functools.py", line 909, in wrapper return dispatch(args[0].__class__)(*args, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/utils/data_helpers/data_dispatcher.py", line 412, in _ return update_inputs(normalize_arrays([inputs] if request._is_single_input() and is_list_simple_type(inputs) else inputs, is_shared=False), request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/utils/data_helpers/wrappers.py", line 30, in _is_single_input return len(self.input_tensors) == 1 ^^^^^^^^^^^^^^^^^^ RuntimeError: Infer Request is busy The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/venv/auto/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__ raise exc File "/opt/venv/auto/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__ await self.app(scope, receive, _send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app raise exc File "/opt/venv/auto/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/routing.py", line 735, in app await route.handle(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle await self.app(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/routing.py", line 76, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app raise exc File "/opt/venv/auto/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "/opt/venv/auto/lib/python3.12/site-packages/starlette/routing.py", line 73, in app response = await f(request) ^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/fastapi/routing.py", line 214, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/starlette/concurrency.py", line 39, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 962, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_api/main.py", line 102, in ocr ocr_res = processor(img, use_det=use_det, use_cls=use_cls, use_rec=use_rec) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_api/main.py", line 51, in __call__ ocr_res, _ = self.ocr( ^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_openvino/main.py", line 96, in __call__ rec_res, rec_elapse = self.text_rec(img) ^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_openvino/ch_ppocr_rec/text_recognize.py", line 73, in __call__ preds = self.infer(norm_img_batch) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_openvino/utils/infer_engine.py", line 33, in __call__ raise OpenVIONError(error_info) from e rapidocr_openvino.utils.infer_engine.OpenVIONError: Traceback (most recent call last): File "/opt/venv/auto/lib/python3.12/site-packages/rapidocr_openvino/utils/infer_engine.py", line 29, in __call__ self.session.infer(inputs=[input_content]) File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/ie_api.py", line 132, in infer return OVDict(super().infer(_data_dispatch( ^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/utils/data_helpers/data_dispatcher.py", line 447, in _data_dispatch return create_shared(inputs, request) if is_shared else create_copied(inputs, request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/functools.py", line 909, in wrapper return dispatch(args[0].__class__)(*args, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/utils/data_helpers/data_dispatcher.py", line 412, in _ return update_inputs(normalize_arrays([inputs] if request._is_single_input() and is_list_simple_type(inputs) else inputs, is_shared=False), request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/auto/lib/python3.12/site-packages/openvino/runtime/utils/data_helpers/wrappers.py", line 30, in _is_single_input return len(self.input_tensors) == 1 ^^^^^^^^^^^^^^^^^^ RuntimeError: Infer Request is busy
The text was updated successfully, but these errors were encountered:
我猜测是因为前一个任务还没执行完,后一个就又开始请求了。可以尝试加一下队列试试。OCR任务比较耗时
Sorry, something went wrong.
No branches or pull requests
问题描述 / Problem Description
运行
rapidocr_api -workers 2
后,同时进行两个识别,概率失败。是我没用正确的使用方式吗?同时运行两个
rapidocr_api
,但是使用不同端口就没有问题。运行环境 / Runtime Environment
Ubuntu24.04 Python3.12.3
复现代码 / Reproduction Code
The text was updated successfully, but these errors were encountered: