-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
How to combine two models: one from yolov3 and another from yolov5? #2677
Comments
@ifahim if you have multiple models trained on the same classes, you can ensemble them for improved results by passing them to detect.py together: python detect.py --weights model1.pt model2.pt model3.pt etc. See Model Ensembling Tutorial for details: YOLOv5 Tutorials
|
The models are trained for two separate classes. yolov3 for person and yolov5 for small objects. |
@ifahim oh, if models are trained on seperate classes then there's no automated way to combine their outputs, you can build a custom solution. |
@glenn-jocher How about using knowledge distillation after ensembling multiple models? |
@whuyyc could you explain a bit more about how your idea would work? |
@glenn-jocher Although we can ensemble several models to get a better performance than any single model, it will increase computational cost in inference. So can we make a compression for ensembling model using Knowledge Distillation to get a similar performance in a model of smaller size? But I just find the distillation method from one large model(teacher model) to one small model(student model) as shown in this picture: In other words, I do not know how to fuse several models to one model, or directly use KD from ensembling models.... Could you give me some thought or suggestion please? |
In this kaggle competition they have combined different models using ensamble techniques. it will be really grateful if anyone can provide script to combine different object detection models.thanks |
@akashAD98 ensembling is automatically built into YOLOv5. See Model Ensembling tutorial to get started. YOLOv5 Tutorials
|
@whuyyc I'm not sure the graphic you have there applies, as it shows one trained model and one model undergoing training, whereas the ensembles are normally done with multiple fully trained models. You're free to experiment with different ensembling techniques to explore what might work best. There's even various other ensembling techniques displayed in the Ensemble() module, such as mean ensemble, max ensemble, etc, that can be applied to models with the same output shapes: Lines 98 to 111 in c03d590
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
❔Question
I have trained a model using Ultralytics yolov3 (#classes =1, yolov3_best.pt) and pretty satisfied with that. I have another model that I trained on Ultralytics yolov5x (#classes =1, yolov5_best.pt). I am planning to create one torchscript by merging these two models.
Is there a way I can combine these two models trained on yolov3 and v5? Can anyone point to the example script that does this?
Additional context
The text was updated successfully, but these errors were encountered: