-
Notifications
You must be signed in to change notification settings - Fork 7
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
Quantised YOLOv5 #36
Comments
👋 Hello @g12bftd, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started: $ git clone https://github.com/ultralytics/yolov5
$ cd yolov5
$ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
Hi Glenn, I appreciate your interest. I can provide an implementation of quantized Yolov5. Nevertheless, it can not be exported for FINN synthesis due to unimplemented/incompatible layers. However, I can add a quantized config if you want to utilize the quantized Yolov5 in Brevitas for testing different weight bit-widths. |
Hey, Thank you so much. It would be great to have a quantized yolov5m model. I just need to be able to control individual bit-widths for each layer and activation function. No need for deployment with FINN. Thanks 😊 |
I have added a config for quantized Yolov5(https://github.com/sefaburakokcu/quantized-yolov5/blob/quantized_yolo/models/yolov5m-quant.yaml). It was a bit tricky. |
Hey @sefaburakokcu, Thank you so much for this! Amazing effort. A few questions just to clarify:
Thanks again for your help. |
Hi, |
Hi! I'm trying to build the quantized Yolov5 model following your implementation, yet I'm getting this error: /content/quantized-yolov5/models/common.py in I fixed it by removing those unnecessery imports from the common.py, they both cause an error and are not used. |
Hi! I'm trying to build the quantized Yolov5 model as well, which following your implementation but I'm having some question: In /content/quantized-yolov5/models/common.py of
By traced the code, I found out the problem is the
It's work! But I don't know the replacement will change the initial intention of the Thank you. |
Hi @mdhosen, Thank you for your interest. I fixed the problem. You can pull the latest commits for the fix. |
Hi @Walid-AMARA! I appreciate your interest. I think that your problem is coming form a new version of Brevitas since QuantAvgPool2d was replaced with TruncAvgPool2d. I fixed it too. You can also pull the latest repo. |
Hi @TCGoingW! Thank you for your interest and a detailed question. Nevertheless, I am currently not sure whether replacing QuantIdentity with QuantTensor will effect the performance, but I don't think so. You can test it and share your findings here. |
Dear @sefaburakokcu, thank you for your kind response. When I am running the code, it is showing following error while validating and loading. Validating runs\train\exp5\weights\best.pt... During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Dear @mdhosen, Can you share your training arguments in order to reproduce your error? Which model config are you using? |
Dear @sefaburakokcu , |
Dear @mdhosen, I ran "train.py" with the arguments you provided. Unfortunately, I couldn't reproduce the error you mentioned; my run was successful. Are you using the latest repository? |
Dear @sefaburakokcu , |
Hi!first of all, thank you very much for your selfless sharing and updates, which have been very helpful for my learning. You mentioned earlier that quantized YOLOv5 cannot be exported for use with FINN. What are the main layers that are difficult to implement in this context? Do you have any good ideas for replacing these layers? |
Dear @mdhosen, The problem occurred due to attempting to load the model from a weight folder after the last epoch. The path to weights was not a string. Therefore, I converted the weights path to a string. However, I encountered a different error, which could be due to the different versions of PyTorch and Brevitas that I am currently using. Thus, I also replaced the model that is loaded from the folder with the final model in training. I have pushed the changes to the repo. You can try them. |
Dear @sefaburakokcu, |
Hey, thank you for the repo. Can you add a quantised yolov5 model, where the user has individual control of the weight bit-widths for each layer and activation separately?
I have already seen the other issue mentioning yolov5. The quantised yolov1 is very good, but there is a difference with yolov5 that is non-trivial.
Thank you.
Additional context
The text was updated successfully, but these errors were encountered: