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

Error while trying to run a Detection with a Model trained on Yolov 6.2 #9360

Closed
1 of 2 tasks
Idefix0496 opened this issue Sep 10, 2022 · 5 comments · Fixed by #9361
Closed
1 of 2 tasks

Error while trying to run a Detection with a Model trained on Yolov 6.2 #9360

Idefix0496 opened this issue Sep 10, 2022 · 5 comments · Fixed by #9361
Labels
bug Something isn't working

Comments

@Idefix0496
Copy link

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Detection

Bug

2022-09-10 17:02:25,639 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in call
task_group.cancel_scope.cancel()
File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in aexit
raise ExceptionGroup(exceptions)
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in call
response = await self.dispatch_func(request, call_next)
File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
raise e from None
File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
response = await call_next(request)
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
raise RuntimeError("No response returned.")
RuntimeError: No response returned.

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
await self.app(scope, request.receive, send_stream.send)
File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call
raise exc
File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 234, in app
response_data = await serialize_response(
File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 137, in serialize_response
raise ValidationError(errors, field.type_)
pydantic.error_wrappers.ValidationError: 1 validation error for DetectorsResponse
response -> detectors -> 0 -> labels
value is not a valid list (type=type_error.list)

Environment

YOLOv5 🚀 v6.2-105-g4e8504a Python-3.8.13 torch-1.12.1+cu113 CUDA:0 (NVIDIA GeForce GTX 1080 Ti, 11264MiB)
OS: Docker Desktop 4.12.0 (85629) on Windows 10 Machine
Latest Doods2 Image freshly Installed

Minimal Reproducible Example

Command used for Training:

python -m torch.distributed.launch --nproc_per_node 2 train.py --batch-size 12 --workers 10 --epochs 300 --img 640 --data /usr/src/datasets/custom_dataset/custom_dataset.yaml --weights yolov5l.pt

Additional

Hey, I'm using Doods2 with a custom trained Yolov5 Model. The whole thing worked fine until I downloaded a newer Yolov5 Image from Docker (Latest of today V6.2) and trained a new Model with it.
Using the freshly trained Model from this Docker Image I'm getting the above error while trying to load it into Doods2.
The old Model, which was Trained on the 30.07.22 with the Docker Image of that day (latest), works just fine.
I think it has something to do with the labels because on the newer Models the labels are no longer showing up in the labels.jpg File. They're just numbered now whereas in the old Image they've got the labels I have assigned to them.

Training a Model with an older Docker Image (V6.1) the labels are also showing up again (labels.jpg) an the Model works just Fine with Doods2.

So I don't think it's an Issue of Doods2 but correct me if I'm wrong.

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@Idefix0496 Idefix0496 added the bug Something isn't working label Sep 10, 2022
@glenn-jocher
Copy link
Member

@Idefix0496 errors generated in 3rd party tools should be raised with their authors.

If labels.jpg lacks labels that’s our problem though, so I will try to reproduce that specific issue.

@glenn-jocher
Copy link
Member

@Idefix0496 yes you are correct the labels.jpg image is missing class names in master. Reproduced on VOC. I will investigate a fix:

image

glenn-jocher added a commit that referenced this issue Sep 10, 2022
Partially resolves #9360

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
glenn-jocher added a commit that referenced this issue Sep 10, 2022
Partially resolves #9360

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member

@Idefix0496 good news 😃! Your original issue may now be partially fixed ✅ in PR #9361. This PR fixes missing class names in labels.png and was tested on VOC. model yamls were recently updated to use dictionaries for class names, so if you have workflows expecting lists then these should be updated, i.e. names_list = list(names.values())

image

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@Idefix0496
Copy link
Author

The Issue which was present on the doods2 Integration is now resolved.
The whole System now works fine again. Especially on freshly custom trained yolov5 Models via the Docker Containers.

@glenn-jocher
Copy link
Member

@Idefix0496 great, thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants