seblful / label-studio-yolov8-backend

ML backend for the Label Studio tool. The backend uses the YOLOv8 model for instance image segmentation or object detection.
52 stars 15 forks source link

Connection Error #5

Closed elisetaragola closed 1 week ago

elisetaragola commented 4 months ago

Hi, for a school project I have to connect the YOLOv8 model for object detection with LabelStudio. I followed the steps as provided, and I can successfully connect the model with LabelStudio. I changed the labels to 'Biopsy', 'Lesion' and 'Hotspot' and used my own .pt file with trained weights. However, I can not get predictions in LabelStudio. I selected some tasks and pushed the 'retrieve predictions' button. When checking the logs of the docker container, I get a NewConnectionError. I added the complete output below. Do you know how to solve this? Or some tracks I can follow? Thank you!

2024-04-29 23:25:57 [pid: 17|app: 0|req: 7/7] 172.19.0.1 () {32 vars in 672 bytes} [Mon Apr 29 21:25:57 2024] GET /health => generated 54 bytes in 3 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 8/8] 172.19.0.1 () {36 vars in 724 bytes} [Mon Apr 29 21:25:57 2024] POST /setup => generated 31 bytes in 348 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 9/9] 172.19.0.1 () {32 vars in 672 bytes} [Mon Apr 29 21:25:58 2024] GET /health => generated 54 bytes in 1 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 10/10] 172.19.0.1 () {36 vars in 724 bytes} [Mon Apr 29 21:25:58 2024] POST /setup => generated 31 bytes in 56 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 11/11] 172.19.0.1 () {32 vars in 672 bytes} [Mon Apr 29 21:25:58 2024] GET /health => generated 54 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 12/12] 172.19.0.1 () {36 vars in 724 bytes} [Mon Apr 29 21:25:58 2024] POST /setup => generated 31 bytes in 52 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 13/13] 172.19.0.1 () {32 vars in 664 bytes} [Mon Apr 29 21:25:58 2024] GET /health => generated 54 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:25:58 [pid: 17|app: 0|req: 14/14] 172.19.0.1 () {36 vars in 716 bytes} [Mon Apr 29 21:25:58 2024] POST /setup => generated 31 bytes in 51 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:00 [pid: 17|app: 0|req: 15/15] 172.19.0.1 () {36 vars in 743 bytes} [Mon Apr 29 21:26:00 2024] POST /webhook => generated 24 bytes in 7 msecs (HTTP/1.1 201) 2 headers in 76 bytes (1 switches on core 0) 2024-04-29 23:26:00 21:26:00 default: job(<class 'model.YOLOv8Model'>, 'PROJECT_UPDATED', {'project': {'id': 13, 'task_number': 25, 'finished_task_number': 0, 'total..., '1714425960') (1714425960) 2024-04-29 23:26:01 [pid: 17|app: 0|req: 16/16] 172.19.0.1 () {32 vars in 664 bytes} [Mon Apr 29 21:26:01 2024] GET /health => generated 54 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:01 [pid: 17|app: 0|req: 17/17] 172.19.0.1 () {36 vars in 716 bytes} [Mon Apr 29 21:26:01 2024] POST /setup => generated 31 bytes in 66 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:01 [pid: 17|app: 0|req: 18/18] 172.19.0.1 () {32 vars in 663 bytes} [Mon Apr 29 21:26:01 2024] GET /health => generated 54 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:01 [pid: 17|app: 0|req: 19/19] 172.19.0.1 () {36 vars in 715 bytes} [Mon Apr 29 21:26:01 2024] POST /setup => generated 31 bytes in 56 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:02 [pid: 17|app: 0|req: 20/20] 172.19.0.1 () {30 vars in 409 bytes} [Mon Apr 29 21:26:02 2024] GET /health => generated 54 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:02 [pid: 17|app: 0|req: 21/21] 172.19.0.1 () {34 vars in 461 bytes} [Mon Apr 29 21:26:02 2024] POST /setup => generated 31 bytes in 61 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:06 21:26:06 default: Job OK (1714425960) 2024-04-29 23:26:06 21:26:06 Result will never expire, clean up result key manually 2024-04-29 23:26:26 [pid: 17|app: 0|req: 22/22] 172.19.0.1 () {32 vars in 674 bytes} [Mon Apr 29 21:26:26 2024] GET /health => generated 54 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:26 [pid: 17|app: 0|req: 23/23] 172.19.0.1 () {36 vars in 726 bytes} [Mon Apr 29 21:26:26 2024] POST /setup => generated 31 bytes in 52 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0) 2024-04-29 23:26:26 FULL URL: http://0.0.0.0:8080//data/upload/13/220c5dae-2cc9c300-2310-50324_macro_1.jpg 2024-04-29 23:26:26 [2024-04-29 21:26:26,615] [ERROR] [label_studio_ml.exceptions::exception_f::53] Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn 2024-04-29 23:26:26 conn = connection.create_connection( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection 2024-04-29 23:26:26 raise err 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection 2024-04-29 23:26:26 sock.connect(sa) 2024-04-29 23:26:26 ConnectionRefusedError: [Errno 111] Connection refused 2024-04-29 23:26:26 2024-04-29 23:26:26 During handling of the above exception, another exception occurred: 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 715, in urlopen 2024-04-29 23:26:26 httplib_response = self._make_request( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 416, in _make_request 2024-04-29 23:26:26 conn.request(method, url, httplib_request_kw) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 244, in request 2024-04-29 23:26:26 super(HTTPConnection, self).request(method, url, body=body, headers=headers) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1283, in request 2024-04-29 23:26:26 self._send_request(method, url, body, headers, encode_chunked) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1329, in _send_request 2024-04-29 23:26:26 self.endheaders(body, encode_chunked=encode_chunked) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1278, in endheaders 2024-04-29 23:26:26 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1038, in _send_output 2024-04-29 23:26:26 self.send(msg) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 976, in send 2024-04-29 23:26:26 self.connect() 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 205, in connect 2024-04-29 23:26:26 conn = self._new_conn() 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn 2024-04-29 23:26:26 raise NewConnectionError( 2024-04-29 23:26:26 urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4b2da15a20>: Failed to establish a new connection: [Errno 111] Connection refused 2024-04-29 23:26:26 2024-04-29 23:26:26 During handling of the above exception, another exception occurred: 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send 2024-04-29 23:26:26 resp = conn.urlopen( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 799, in urlopen 2024-04-29 23:26:26 retries = retries.increment( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment 2024-04-29 23:26:26 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 2024-04-29 23:26:26 urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='0.0.0.0', port=8080): Max retries exceeded with url: //data/upload/13/220c5dae-2cc9c300-2310-50324_macro_1.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b2da15a20>: Failed to establish a new connection: [Errno 111] Connection refused')) 2024-04-29 23:26:26 2024-04-29 23:26:26 During handling of the above exception, another exception occurred: 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f 2024-04-29 23:26:26 return f(args, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/api.py", line 51, in _predict 2024-04-29 23:26:26 predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, params) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/model.py", line 617, in predict 2024-04-29 23:26:26 predictions = cls._current_model.model.predict(tasks, kwargs) 2024-04-29 23:26:26 File "/app/./model.py", line 52, in predict 2024-04-29 23:26:26 image = Image.open(BytesIO(requests.get( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get 2024-04-29 23:26:26 return request("get", url, params=params, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request 2024-04-29 23:26:26 return session.request(method=method, url=url, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request 2024-04-29 23:26:26 resp = self.send(prep, send_kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send 2024-04-29 23:26:26 r = adapter.send(request, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 565, in send 2024-04-29 23:26:26 raise ConnectionError(e, request=request) 2024-04-29 23:26:26 requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=8080): Max retries exceeded with url: //data/upload/13/220c5dae-2cc9c300-2310-50324_macro_1.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b2da15a20>: Failed to establish a new connection: [Errno 111] Connection refused')) 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn 2024-04-29 23:26:26 conn = connection.create_connection( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection 2024-04-29 23:26:26 raise err 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection 2024-04-29 23:26:26 sock.connect(sa) 2024-04-29 23:26:26 ConnectionRefusedError: [Errno 111] Connection refused 2024-04-29 23:26:26 2024-04-29 23:26:26 During handling of the above exception, another exception occurred: 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 715, in urlopen 2024-04-29 23:26:26 httplib_response = self._make_request( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 416, in _make_request 2024-04-29 23:26:26 conn.request(method, url, httplib_request_kw) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 244, in request 2024-04-29 23:26:26 super(HTTPConnection, self).request(method, url, body=body, headers=headers) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1283, in request 2024-04-29 23:26:26 self._send_request(method, url, body, headers, encode_chunked) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1329, in _send_request 2024-04-29 23:26:26 self.endheaders(body, encode_chunked=encode_chunked) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1278, in endheaders 2024-04-29 23:26:26 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 1038, in _send_output 2024-04-29 23:26:26 self.send(msg) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/http/client.py", line 976, in send 2024-04-29 23:26:26 self.connect() 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 205, in connect 2024-04-29 23:26:26 conn = self._new_conn() 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn 2024-04-29 23:26:26 raise NewConnectionError( 2024-04-29 23:26:26 urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4b2da15a20>: Failed to establish a new connection: [Errno 111] Connection refused 2024-04-29 23:26:26 2024-04-29 23:26:26 During handling of the above exception, another exception occurred: 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send 2024-04-29 23:26:26 resp = conn.urlopen( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 799, in urlopen 2024-04-29 23:26:26 retries = retries.increment( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment 2024-04-29 23:26:26 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 2024-04-29 23:26:26 urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='0.0.0.0', port=8080): Max retries exceeded with url: //data/upload/13/220c5dae-2cc9c300-2310-50324_macro_1.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b2da15a20>: Failed to establish a new connection: [Errno 111] Connection refused')) 2024-04-29 23:26:26 2024-04-29 23:26:26 During handling of the above exception, another exception occurred: 2024-04-29 23:26:26 2024-04-29 23:26:26 Traceback (most recent call last): 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f 2024-04-29 23:26:26 return f(args, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/api.py", line 51, in _predict 2024-04-29 23:26:26 predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, params) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/model.py", line 617, in predict 2024-04-29 23:26:26 predictions = cls._current_model.model.predict(tasks, kwargs) 2024-04-29 23:26:26 File "/app/./model.py", line 52, in predict 2024-04-29 23:26:26 image = Image.open(BytesIO(requests.get( 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get 2024-04-29 23:26:26 return request("get", url, params=params, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request 2024-04-29 23:26:26 return session.request(method=method, url=url, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request 2024-04-29 23:26:26 resp = self.send(prep, send_kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send 2024-04-29 23:26:26 r = adapter.send(request, kwargs) 2024-04-29 23:26:26 File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 565, in send 2024-04-29 23:26:26 raise ConnectionError(e, request=request) 2024-04-29 23:26:26 requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=8080): Max retries exceeded with url: //data/upload/13/220c5dae-2cc9c300-2310-50324_macro_1.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b2da15a20>: Failed to establish a new connection: [Errno 111] Connection refused')) 2024-04-29 23:26:26 2024-04-29 23:26:26 [pid: 17|app: 0|req: 24/24] 172.19.0.1 () {36 vars in 731 bytes} [Mon Apr 29 21:26:26 2024] POST /predict => generated 5133 bytes in 13 msecs (HTTP/1.1 500) 2 headers in 92 bytes (1 switches on core 0)

Jerryxu-rui commented 1 month ago

兄弟你解决了吗?

seblful commented 1 week ago

yes, check a new version and follow the instruction