Closed WiFiHan closed 2 years ago
👋 Hello @WiFiHan, 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 support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
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.
I've found that the code below works:
!python export.py --weights /content/drive/MyDrive/yolov5/runs/train/fine_tuning2/weights/best.pt --include saved_model tflite --int8
When data path is not specified, the code above worked. But still the code below doesn't export tflite model:
!python export.py --img 640 --data /content/drive/MyDrive/test5_mk_od/data/dataset.yaml --weights /content/drive/MyDrive/yolov5/runs/train/fine_tuning2/weights/best.pt --include saved_model tflite --int8
@WiFiHan --data is just used for quantization. Default --data is COCO128. You can pass your own if you want the same way as coco128.yaml.
@WiFiHan --data is just used for quantization. Default --data is COCO128. You can pass your own if you want the same way as coco128.yaml.
But the problem is that when I pass my own data then quantization and tflite export aren't done. Do you mean there's no problem when I pass '--data 'default with my own custom weights(.pt file)?
@WiFiHan a dataset is always passed: https://github.com/ultralytics/yolov5/blob/27911dc824b28f6d805dc88360a3313ce0c9cae5/export.py#L569
If you have a reproducible bug please submit a bug report with exact code to reproduce (including a commonly available dataset, not your custom dataset).
Thanks for your kind help! With more research, I'll submit a bug report with exact code.
I found that if I pass my own custom dataset --data /content/drive/MyDrive/test5_mk_od/data/dataset.yaml
, then the train data of dataset.yaml
file must not be .txt
; it worked when it was written in the form of directory.
names: [Book, Calculator, Mobile phone, Pencil case, Postit]
nc: 5
train: /content/drive/MyDrive/test5_mk_od/data/images/train #worked when directory was passed
val: /content/drive/MyDrive/test5_mk_od/data/images/val
names: [Book, Calculator, Mobile phone, Pencil case, Postit]
nc: 5
train: /content/drive/MyDrive/test5_mk_od/data/train.txt #not worked when txt file was passed
val: /content/drive/MyDrive/test5_mk_od/data/val.txt
👋 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 ⭐!
@WiFiHan, great job on identifying the issue! Feel free to include this observation in your bug report. It will surely help the developers in resolving the issue promptly. If you have any further questions or need assistance with anything else, don't hesitate to ask!
Search before asking
YOLOv5 Component
No response
Bug
Yolov5 tflite model export with uint8 input doesn't work. I work in google colab. I want to export tflite-uint8 model.
The model is exported to tflite fp-16 when not adding
--uint8
, but when adding--uint8
, no tflite model found in the export path. Instead, there's only 'saved_model.pb' file.I checked #5707, and downgraded my flatbuffer library to 1.12.
Environment
-Google colab -Python 3.7.13
Minimal Reproducible Example
My code is:
%cd /content/drive/MyDrive/yolov5/ !python export.py --img 640 --conf 0.25 --weights /content/drive/MyDrive/new_yolov5/runs/train/20220523_1945003/weights/best.pt/ --int8 --include saved_model tflite
Additional
No response
Are you willing to submit a PR?