quantized-yolov5
quantized-yolov5 copied to clipboard
Some error in export to onnx
So I tried to train yolov5m-quant.yaml with coco128.yaml. When it's done, i want to export it but error come like this
Traceback (most recent call last): File "/content/quantized-yolov5/models/experimental.py", line 97, in attempt_load ema = ckpt['ema' if ckpt.get('ema') else 'model'].float() KeyError: 'model'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/content/quantized-yolov5/export.py", line 418, in
Do you have some advice or suggestion about this error? Thankyou
👋 Hello @Halafz7, 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 [email protected].
Requirements
Python>=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
Environments
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
-
Google Colab and Kaggle notebooks with free GPU:
- Google Cloud Deep Learning VM. See GCP Quickstart Guide
- Amazon Deep Learning AMI. See AWS Quickstart Guide
-
Docker Image. See Docker Quickstart Guide
Status
If 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 @Halafz7, Thank you for your interest. Can you share your command for exporting the model?
Sure, i ran it on Colab and saved the weights on my Gdrive
! python export.py --data coco128.yaml --weights /content/gdrive/MyDrive/models/CheckpointsYOLO/YOLOv5/yolov5medium/weights/last.pt --nodetect
As the error states, you are trying to load weights from 80 classes into a model with only one class. However, your export arguments seem correct.
I think that attempt_load could not found your model.yaml. Can you replace last.pt with best.pt in your arguments?
Won't the classes switch automatically during training?
I did replaced the weight with best.pt but still got the same error