labelstudio 란 학습을 위한 데이터를 쉽게 라벨링 할 수 있도록 도와주는 프로그램이다.
Open Source Data Labeling | Label Studio
A flexible data labeling tool for all data types. Prepare training data for computer vision, natural language processing, speech, voice, and video models.
labelstud.io
수동으로 라벨링이 가능하지만, 모델을 직접 연결해서 사용할 수 도 있다.
paddleocr을 연동하여 라벨스튜디오에 연결시 있던 error issue를 정리했다.
easeocr, Tesseract 등의 예제를 보면서 실제로 연결할 수 있는지 알아보자 (formatting등의 작업이 필요)
https://labelstud.io/blog/interactive-ocr-with-tesseract-and-label-studio/
Interactive OCR with Tesseract and Label Studio | Label Studio
A flexible data labeling tool for all data types. Prepare training data for computer vision, natural language processing, speech, voice, and video models.
labelstud.io
- label studio setting
로컬환경에 label studio 설치
pip install label-studio
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
paddlepaddle 2.5.0 requires protobuf<=3.20.2,>=3.1.0; platform_system == "Windows", but you have protobuf 5.28.3 which is incompatible.
jupyterlab-server 2.23.0 requires jsonschema>=4.17.3, but you have jsonschema 3.2.0 which is incompatible.
가상환경에서 설치
python -m venv myenv
myenv\\Scripts\\activate
pip install label-studio
Can't load sqlite3.dll from current directory
python version: 3 sqlite minor version: 8
You are on Windows Python 3.8.
This Python version uses SQLite 3.28.0 which does not support JSON Field.
Read more about this issue: <https://code.djangoproject.com/wiki/JSON1Extension> [Windows section]
Label Studio can try to resolve this issue by downloading the correct sqlite.dll from <https://sqlite.org> in the current directory, do you want to proceed?
[y/n] >
Label Studio가 사용하는 SQLite 버전이 JSON 관련 기능을 지원하지 않아서 발생하는 문제
Label Studio에서 안내한 대로 SQLite DLL을 업데이트. Label Studio를 처음 시작할 때 **"Label Studio can try to resolve this issue by downloading the correct sqlite.dll"**라는 메시지가 나타났을 때 y를 입력해서 DLL을 자동으로 다운로드하고 업데이트 가능
- label studio 에서 요구하는 post , get 맞추기
Runtime error
Validation error
Can't connect to ML backend <http://localhost:8082/ocr>, health check failed. Make sure it is up and your firewall is properly configured. Learn more about how to set up an ML backend. Additional info: 404 Client Error: Not Found for url: <http://localhost:8082/ocr/health>
Version: 1.13.1
아래와 같이 추가한다.
@app.get("/ocr/health")
async def health_check():
return {"status": "healthy"}
# Setup Endpoint
@app.post("/ocr/setup")
async def setup():
return {
"labels": [], # Label Studio의 ML 백엔드 초기 설정 요구사항에 맞는 빈 응답
"params": {}, # 추가 설정이 필요하다면 여기서 반환
}
ocr을 /ocr/predict 로 수정한다
- image path 문제
2024-10-28 01:55:47,243 - INFO - Received request data: {'tasks': [{'id': 5, 'data': {'ocr': '/data/upload/1/a789b44a-1a1fdb5d-screenshot_20241023_060807_crop.png'}, 'meta': {}, 'created_at': '2024-10-25T07:52:07.334571Z', 'updated_at': '2024-10-25T07:52:07.334571Z', 'is_labeled': False, 'overlap': 1, 'inner_id': 5, 'total_annotations': 0, 'cancelled_annotations': 0, 'total_predictions': 0, 'comment_count': 0, 'unresolved_comment_count': 0, 'last_comment_updated_at': None, 'project': 1, 'updated_by': None, 'file_upload': 5, 'comment_authors': [], 'annotations': [], 'predictions': []}], 'project': '1.1729842613', 'label_config': '<View>\\n <Image name="image" value="$ocr" zoom="true" zoomControl="true" rotateControl="true"/>\\n\\n
<Labels name="label" toName="image">\\n <Label value="Text" background="green"/>\\n \\n </Labels>\\n\\n <Rectangle name="bbox" toName="image" strokeWidth="3"/>\\n <Polygon name="poly" toName="image" strokeWidth="3"/>\\n\\n <TextArea name="transcription" toName="image" editable="true" perRegion="true" required="true" maxSubmissions="1" rows="5" placeholder="Recognized Text" displayMode="region-list"/>\\n</View>', 'params': {'login': None, 'password': None, 'context': None}}
ocr-trained-model-service | 2024-10-28 01:55:47,252 - ERROR - Image path does not exist: /data/upload/1/a789b44a-1a1fdb5d-screenshot_20241023_060807_crop.png
ocr-trained-model-service | 2024-10-28 01:55:47,252 - ERROR - Error reading request data: 400: Image file not found
라벨 스튜디오는 이미지 파일 이름으로 request를 보내는 것 같은데 이 경로를 로컬에서 접근할 수 없음
→ 우선 이미지 파일 복사 후 실행
- label studio가 원하는 return type와 일치하지 않는 문제
error message
ocr-trained-model-service | INFO: 172.18.0.1:49980 - "POST /ocr/predict HTTP/1.1" 422 Unprocessable Entity
Settings → Labeling Interface → code
<View>
<Image name="image" value="$ocr" zoom="true" zoomControl="true" rotateControl="true"/>
<Labels name="label" toName="image">
<Label value="Text" background="green"/>
</Labels>
<Rectangle name="bbox" toName="image" strokeWidth="3"/>
<Polygon name="poly" toName="image" strokeWidth="3"/>
<TextArea name="transcription" toName="image" editable="true" perRegion="true" required="true" maxSubmissions="1" rows="5" placeholder="Recognized Text" displayMode="region-list"/>
</View>
easeocr 참고 (model.py 의 return type)
return {
"predictions": [
{
"result": [
{
"original_width": 230,
"original_height": 62,
"image_rotation": 0,
"value": {
"points": [
[7.82608695652174, 25.806451612903224],
[92.6086956521739, 25.806451612903224],
[92.6086956521739, 80.64516129032258],
[7.82608695652174, 80.64516129032258]
]
},
"id": "8a40",
"from_name": "poly",
"to_name": "image",
"type": "polygon",
"origin": "manual",
"score": 0.9991375207901001
},
{
"original_width": 230,
"original_height": 62,
"image_rotation": 0,
"value": {
"points": [
[7.82608695652174, 25.806451612903224],
[92.6086956521739, 25.806451612903224],
[92.6086956521739, 80.64516129032258],
[7.82608695652174, 80.64516129032258]
],
"labels": ["Text"],
"text": ["영화TVVOD"]
},
"id": "8a40",
"from_name": "transcription",
"to_name": "image",
"type": "textarea",
"origin": "manual",
"score": 0.9991375207901001
}
],
"score": 0.9991375207901001,
"model_version": "OCR Model v1"
}
]
}
- easyocr labelstudio 관련 git을 clone받고 직접 return 확인하기
- error
2024-10-28 07:29:48,004] [ERROR] [label_studio_ml.exceptions::exception_f::53] Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn easyocr | sock = connection.create_connection( easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection easyocr | raise err easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection easyocr | sock.connect(sa) easyocr | ConnectionRefusedError: [Errno 111] Connection refused easyocr | easyocr | The above exception was the direct cause of the following exception: easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen easyocr | response = self._make_request( easyocr | ^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request easyocr | conn.request( easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request easyocr | self.endheaders() easyocr | File "/usr/local/lib/python3.11/http/client.py", line 1298, in endheaders easyocr | self._send_output(message_body, encode_chunked=encode_chunked) easyocr | File "/usr/local/lib/python3.11/http/client.py", line 1058, in _send_output easyocr | self.send(msg) easyocr | File "/usr/local/lib/python3.11/http/client.py", line 996, in send easyocr | self.connect() easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 243, in connect easyocr | self.sock = self._new_conn() easyocr | ^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 218, in _new_conn easyocr | raise NewConnectionError( easyocr | urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused easyocr | easyocr | The above exception was the direct cause of the following exception: easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send easyocr | resp = conn.urlopen( easyocr | ^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 845, in urlopen easyocr | retries = retries.increment( easyocr | ^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment easyocr | raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused')) easyocr | easyocr | During handling of the above exception, another exception occurred: easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f easyocr | return f(*args, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_ml/api.py", line 69, in _predict easyocr | response = model.predict(tasks, context=context, **params) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/app/model.py", line 181, in predict easyocr | prediction = self.predict_single(task) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/app/model.py", line 103, in predict_single easyocr | image_path = get_local_path( easyocr | ^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py", line 166, in get_local_path easyocr | filepath = download_and_cache( easyocr | ^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py", line 220, in download_and_cache easyocr | r = requests.get(url, stream=True, headers=headers, verify=VERIFY_SSL) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get easyocr | return request("get", url, params=params, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request easyocr | return session.request(method=method, url=url, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request easyocr | resp = self.send(prep, **send_kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send easyocr | r = adapter.send(request, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 700, in send easyocr | raise ConnectionError(e, request=request) easyocr | requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused')) easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn easyocr | sock = connection.create_connection( easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection easyocr | raise err easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection easyocr | sock.connect(sa) easyocr | ConnectionRefusedError: [Errno 111] Connection refused easyocr | easyocr | The above exception was the direct cause of the following exception: easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen easyocr | response = self._make_request( easyocr | ^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request easyocr | conn.request( easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request easyocr | self.endheaders() easyocr | File "/usr/local/lib/python3.11/http/client.py", line 1298, in endheaders easyocr | self._send_output(message_body, encode_chunked=encode_chunked) easyocr | File "/usr/local/lib/python3.11/http/client.py", line 1058, in _send_output easyocr | self.send(msg) easyocr | File "/usr/local/lib/python3.11/http/client.py", line 996, in send easyocr | self.connect() easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 243, in connect easyocr | self.sock = self._new_conn() easyocr | ^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 218, in _new_conn easyocr | raise NewConnectionError( easyocr | urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused easyocr | easyocr | The above exception was the direct cause of the following exception: easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send easyocr | resp = conn.urlopen( easyocr | ^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 845, in urlopen easyocr | retries = retries.increment( easyocr | ^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment easyocr | raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused')) easyocr | easyocr | During handling of the above exception, another exception occurred: easyocr | easyocr | Traceback (most recent call last): easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f easyocr | return f(*args, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_ml/api.py", line 69, in _predict easyocr | response = model.predict(tasks, context=context, **params) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/app/model.py", line 181, in predict easyocr | prediction = self.predict_single(task) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/app/model.py", line 103, in predict_single easyocr | image_path = get_local_path( easyocr | ^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py", line 166, in get_local_path easyocr | filepath = download_and_cache( easyocr | ^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py", line 220, in download_and_cache easyocr | r = requests.get(url, stream=True, headers=headers, verify=VERIFY_SSL) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get easyocr | return request("get", url, params=params, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request easyocr | return session.request(method=method, url=url, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request easyocr | resp = self.send(prep, **send_kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send easyocr | r = adapter.send(request, **kwargs) easyocr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ easyocr | File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 700, in send easyocr | raise ConnectionError(e, request=request) easyocr | requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused')) easyocr | easyocr | [2024-10-28 07:29:48,005] [DEBUG] [label_studio_ml.api::log_response_info::191] Response status: 500 INTERNAL SERVER ERROR easyocr | [2024-10-28 07:29:48,006] [DEBUG] [label_studio_ml.api::log_response_info::192] Response headers: Content-Type: application/json easyocr | Content-Length: 5808 easyocr | easyocr | easyocr | [2024-10-28 07:29:48,006] [DEBUG] [label_studio_ml.api::log_response_info::193] Response body: b'{"detail":"ConnectionError: HTTPConnectionPool(host=\\'localhost\\', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError(\\'<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused\\'))","request":{},"result":{"traceback":"Traceback (most recent call last):\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connection.py\\\\", line 203, in _new_conn\\\\n sock = connection.create_connection(\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py\\\\", line 85, in create_connection\\\\n raise err\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py\\\\", line 73, in create_connection\\\\n sock.connect(sa)\\\\nConnectionRefusedError: [Errno 111] Connection refused\\\\n\\\\nThe above exception was the direct cause of the following exception:\\\\n\\\\nTraceback (most recent call last):\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py\\\\", line 791, in urlopen\\\\n response = self._make_request(\\\\n ^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py\\\\", line 497, in _make_request\\\\n conn.request(\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connection.py\\\\", line 395, in request\\\\n self.endheaders()\\\\n File \\\\"/usr/local/lib/python3.11/http/client.py\\\\", line 1298, in endheaders\\\\n self._send_output(message_body, encode_chunked=encode_chunked)\\\\n File \\\\"/usr/local/lib/python3.11/http/client.py\\\\", line 1058, in _send_output\\\\n self.send(msg)\\\\n File \\\\"/usr/local/lib/python3.11/http/client.py\\\\", line 996, in send\\\\n self.connect()\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connection.py\\\\", line 243, in connect\\\\n self.sock = self._new_conn()\\\\n ^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connection.py\\\\", line 218, in _new_conn\\\\n raise NewConnectionError(\\\\nurllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused\\\\n\\\\nThe above exception was the direct cause of the following exception:\\\\n\\\\nTraceback (most recent call last):\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/requests/adapters.py\\\\", line 667, in send\\\\n resp = conn.urlopen(\\\\n ^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py\\\\", line 845, in urlopen\\\\n retries = retries.increment(\\\\n ^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py\\\\", line 515, in increment\\\\n raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\nurllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=\\'localhost\\', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError(\\'<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused\\'))\\\\n\\\\nDuring handling of the above exception, another exception occurred:\\\\n\\\\nTraceback (most recent call last):\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/label_studio_ml/exceptions.py\\\\", line 39, in exception_f\\\\n return f(*args, **kwargs)\\\\n ^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/label_studio_ml/api.py\\\\", line 69, in _predict\\\\n response = model.predict(tasks, context=context, **params)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/app/model.py\\\\", line 181, in predict\\\\n prediction = self.predict_single(task)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/app/model.py\\\\", line 103, in predict_single\\\\n image_path = get_local_path(\\\\n ^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py\\\\", line 166, in get_local_path\\\\n filepath = download_and_cache(\\\\n ^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py\\\\", line 220, in download_and_cache\\\\n r = requests.get(url, stream=True, headers=headers, verify=VERIFY_SSL)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/requests/api.py\\\\", line 73, in get\\\\n return request(\\\\"get\\\\", url, params=params, **kwargs)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/requests/api.py\\\\", line 59, in request\\\\n return session.request(method=method, url=url, **kwargs)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/requests/sessions.py\\\\", line 589, in request\\\\n resp = self.send(prep, **send_kwargs)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/requests/sessions.py\\\\", line 703, in send\\\\n r = adapter.send(request, **kwargs)\\\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n File \\\\"/usr/local/lib/python3.11/site-packages/requests/adapters.py\\\\", line 700, in send\\\\n raise ConnectionError(e, request=request)\\\\nrequests.exceptions.ConnectionError: HTTPConnectionPool(host=\\'localhost\\', port=8083): Max retries exceeded with url: /data/upload/2/81deb751-0e86d877-screenshot_20241023_012403_crop.png (Caused by NewConnectionError(\\'<urllib3.connection.HTTPConnection object at 0x7f6d1d040850>: Failed to establish a new connection: [Errno 111] Connection refused\\'))\\\\n"},"status":500}\\n'
- (해결) 연결 시 아래처럼 써야함
# Specify the Label Studio URL and API key to access # uploaded, local storage and cloud storage files. # Do not use 'localhost' as it does not work within Docker containers. # Use prefix 'http://' or 'https://' for the URL always. # Determine the actual IP using 'ifconfig' (Linux/Mac) or 'ipconfig' (Windows). LABEL_STUDIO_URL=http://192.168.100.13:8083
실제로 easyocr을 연결하고 확인한 return
{
"results": [
{
"model_version": "EasyOCR-v0.0.1",
"result": [
{
"from_name": "poly",
"id": "801e",
"image_rotation": 0,
"origin": "manual",
"original_height": 62,
"original_width": 230,
"score": 0.768981194708324,
"to_name": "image",
"type": "polygon",
"value": {
"points": [
[
5.6521739130434785,
17.741935483870968
],
[
95.21739130434783,
17.741935483870968
],
[
95.21739130434783,
88.70967741935483
],
[
5.6521739130434785,
88.70967741935483
]
]
}
},
{
"from_name": "transcription",
"id": "801e",
"image_rotation": 0,
"origin": "manual",
"original_height": 62,
"original_width": 230,
"score": 0.768981194708324,
"to_name": "image",
"type": "textarea",
"value": {
"labels": [
"Text"
],
"points": [
[
5.6521739130434785,
17.741935483870968
],
[
95.21739130434783,
17.741935483870968
],
[
95.21739130434783,
88.70967741935483
],
[
5.6521739130434785,
88.70967741935483
]
],
"text": [
"gal TV VOD"
]
}
}
],
"score": 0.768981194708324
}
]
}
'Internship' 카테고리의 다른 글
Elasticsearch란? (0) | 2024.11.19 |
---|---|
docker compose 설치 (0) | 2024.11.11 |
[OpenCV] findContours | 이미지 윤곽선 검출 (2) | 2024.11.08 |
PaddleOCR 이론 및 사용법/ 모듈 에러 (0) | 2024.09.04 |
DVC(Data Version Control) (0) | 2024.09.04 |