ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.48k stars 16.29k forks source link

Not running-Model Ensembling with custom weight and yolov5x6.pt #6676

Closed Thanossrs closed 2 years ago

Thanossrs commented 2 years ago

Search before asking

Question

!python detect.py --weights ./yolov5x6.pt ./best_allenduserdataset_notransf.pt --img 1280 --augment --class 0 --conf 0.4 --source ./video2.mp4

Hello, why am I getting the following problem when I execute the above command? thanks

RuntimeError: Sizes of tensors must match except in dimension 2. Got 6 and 85 (The offending index is 0)

Additional

No response

glenn-jocher commented 2 years ago

@Thanossrs you can only ensemble models trained on the same classes.

Thanossrs commented 2 years ago

Yes, you are correct. Actually, I detect humans (annotated as 'pedestrian') in my custom model. How could I combine my custom model with yolov5x6.pt that uses a different label ('person')? Any idea how I could combine them without retraining my custom model? Thank you

glenn-jocher commented 2 years ago

@Thanossrs there's no such thing as 'combining' models. TTA simply runs each and concatenates outputs before NMS.

You can concatenate COCO trained models, i.e. YOLOv5s with YOLOv5m.

Thanossrs commented 2 years ago

@glenn-jocher I retrain my model with the same class from yolov5x6.pt (i mean as a 'person') and still got the below error.

RuntimeError: Sizes of tensors must match except in dimension 2. Got 6 and 85 (The offending index is 0)

Any idea? thank you

glenn-jocher commented 2 years ago

@Thanossrs 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem.

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

For Ultralytics to provide assistance your code should also be:

If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

github-actions[bot] commented 2 years ago

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!