yolov5
yolov5 copied to clipboard
Support for exporting Ghost models in tensorflow saved model
Search before asking
- [X] I have searched the YOLOv5 issues and found no similar feature requests.
Description
Currently, yolov5 models with ghost feature do not support export in Tensorflow models. It would be great to have this feature to run model on edgetpu
Use case
The architecture looks promising and might be able to run in realtime on Edgetpu.
Additional
No response
Are you willing to submit a PR?
- [X] Yes I'd like to help by submitting a PR!
@hardikdava unfortunately all TF exports are built from scratch currently using modules in models/tf.py. You'd have to add the ghost modules in TF format for export to work correctly.
@AyushExel example of our TF export issue.
@glenn-jocher @AyushExel Is this feature available in near future? Is there any branch or PR which is designated for this?
@hardikdava hi, thank you for your feature suggestion on how to improve YOLOv5 🚀!
There are no plans for this, but you're free to help with a PR.
The fastest and easiest way to incorporate your ideas into the official codebase is to submit a Pull Request (PR) implementing your idea, and if applicable providing before and after profiling/inference/training results to help us understand the improvement your feature provides. This allows us to directly see the changes in the code and to understand how they affect workflows and performance.
Please see our ✅ Contributing Guide to get started.
@AyushExel @glenn-jocher I was able to make layers of Ghost model in tensorflow keras. But I got this error
Exception encountered when calling layer "tf_conv_37" (type TFConv). It has 131072 elements, but gotshape (1, 1, 32, 256) with 8192 elements).
Then I looked into the model architecture and I observed that the first layer of the model has different kernel and stride values. How can I solve this error?

Existing TF models export correctly including layer you are showing.
👋 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:
- Wiki – https://github.com/ultralytics/yolov5/wiki
- Tutorials – https://docs.ultralytics.com/yolov5
- Docs – https://docs.ultralytics.com
Access additional Ultralytics ⚡ resources:
- Ultralytics HUB – https://ultralytics.com/hub
- Vision API – https://ultralytics.com/yolov5
- About Us – https://ultralytics.com/about
- Join Our Team – https://ultralytics.com/work
- Contact Us – https://ultralytics.com/contact
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 ⭐!