snowzach / doods2

API for detecting objects in images and video streams using Tensorflow
MIT License
221 stars 28 forks source link

Support for yolov8.1 #100

Open Idefix0496 opened 5 months ago

Idefix0496 commented 5 months ago

Hi, so I'm curious to know if it is possible for doods to support the all new yolov8 Models. It's now almost a year now since I changed something on my deployed system but now that it is time to train a new Model, I would like to change from yolov5 to yolov8.

Of` course I already tried the official yolov8l Model and one I specificaly trained for testing. Both Models are loading correctly into Doods without Errors but Error out when trying to Detect an Image with the following Log-Output:

2024-02-11 20:49:48 Model summary (fused): 268 layers, 43611234 parameters, 0 gradients, 164.8 GFLOPs
2024-02-11 20:49:48 2024-02-11 19:49:48,747 - doods.doods - INFO - Registered detector type:deepstack name:pytorch
2024-02-11 20:49:48 2024-02-11 19:49:48,779 - uvicorn.error - INFO - Started server process [1]
2024-02-11 20:49:48 2024-02-11 19:49:48,779 - uvicorn.error - INFO - Waiting for application startup.
2024-02-11 20:49:48 2024-02-11 19:49:48,779 - uvicorn.error - INFO - Application startup complete.
2024-02-11 20:49:48 2024-02-11 19:49:48,779 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
2024-02-11 20:49:50 2024-02-11 19:49:50,335 - uvicorn.access - INFO - 172.17.0.1:39338 - "GET /detectors HTTP/1.1" 200
2024-02-11 20:50:24 2024-02-11 19:50:24,094 - uvicorn.access - INFO - 172.17.0.1:59366 - "POST /image HTTP/1.1" 500
2024-02-11 20:50:24 2024-02-11 19:50:24,094 - uvicorn.error - ERROR - Exception in ASGI application
2024-02-11 20:50:24 Traceback (most recent call last):
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
2024-02-11 20:50:24     result = await app(self.scope, self.receive, self.send)
2024-02-11 20:50:24              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
2024-02-11 20:50:24     return await self.app(scope, receive, send)
2024-02-11 20:50:24            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/fastapi/applications.py", line 208, in __call__
2024-02-11 20:50:24     await super().__call__(scope, receive, send)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/applications.py", line 112, in __call__
2024-02-11 20:50:24     await self.middleware_stack(scope, receive, send)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/errors.py", line 181, in __call__
2024-02-11 20:50:24     raise exc
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/errors.py", line 159, in __call__
2024-02-11 20:50:24     await self.app(scope, receive, _send)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/prometheus_fastapi_instrumentator/middleware.py", line 169, in __call__
2024-02-11 20:50:24     raise exc
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/prometheus_fastapi_instrumentator/middleware.py", line 167, in __call__
2024-02-11 20:50:24     await self.app(scope, receive, send_wrapper)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/exceptions.py", line 82, in __call__
2024-02-11 20:50:24     raise exc
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/exceptions.py", line 71, in __call__
2024-02-11 20:50:24     await self.app(scope, receive, sender)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 656, in __call__
2024-02-11 20:50:24     await route.handle(scope, receive, send)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 259, in handle
2024-02-11 20:50:24     await self.app(scope, receive, send)
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 61, in app
2024-02-11 20:50:24     response = await func(request)
2024-02-11 20:50:24                ^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/fastapi/routing.py", line 226, in app
2024-02-11 20:50:24     raw_response = await run_endpoint_function(
2024-02-11 20:50:24                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/usr/local/lib/python3.11/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
2024-02-11 20:50:24     return await dependant.call(**values)
2024-02-11 20:50:24            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/opt/doods/api.py", line 113, in image
2024-02-11 20:50:24     detect_response = self.doods.detect(detect_request)
2024-02-11 20:50:24                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/opt/doods/doods.py", line 139, in detect
2024-02-11 20:50:24     ret = detector.detect(image)
2024-02-11 20:50:24           ^^^^^^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24   File "/opt/doods/detectors/deepstack.py", line 58, in detect
2024-02-11 20:50:24     detection.label = self.labels[int(cls.item())]
2024-02-11 20:50:24                       ~~~~~~~~~~~^^^^^^^^^^^^^^^^^
2024-02-11 20:50:24 IndexError: list index out of range

It seems that they changed something about the labels again ?

Furthermore I'm concerned about the new CLI-Architecture they implemented.