Skip to content
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

Classification Model Exported to TFLITE #12876

Closed
1 task done
Halafz7 opened this issue Apr 3, 2024 · 5 comments
Closed
1 task done

Classification Model Exported to TFLITE #12876

Halafz7 opened this issue Apr 3, 2024 · 5 comments
Labels
question Further information is requested Stale

Comments

@Halafz7
Copy link

Halafz7 commented Apr 3, 2024

Search before asking

Question

So I did a Classification Model training with YOLOv5 (Nano, Medium, Small) using CIFAR100 dataset and wanted to export it to another format such as TFLITE that support FP16 and INT8. But, when I try to export, it shows error

`python export.py --weights "D:\Skripsi\yolov5-master\yolov5-master\experiments\Nano-300-epochs\weights\best.pt" --include tflite --int8
D:\Conda\envs\yolo\Lib\site-packages\onnxruntime\capi\onnxruntime_validation.py:26: UserWarning: Unsupported Windows version (11). ONNX Runtime supports Windows 10 and above, only.
warnings.warn(
export: data=D:\Skripsi\yolov5-master\yolov5-master\data\coco128.yaml, weights=['D:\Skripsi\yolov5-master\yolov5-master\experiments\Nano-300-epochs\weights\best.pt'], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, keras=False, optimize=False, int8=True, per_tensor=False, dynamic=False, simplify=False, opset=17, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['tflite']
YOLOv5 2024-3-24 Python-3.12.2 torch-2.2.1 CPU

Fusing layers...
Model summary: 117 layers, 1336564 parameters, 0 gradients, 3.0 GFLOPs

PyTorch: starting from D:\Skripsi\yolov5-master\yolov5-master\experiments\Nano-300-epochs\weights\best.pt with output shape (1, 100) (2.7 MB)
Traceback (most recent call last):
File "D:\Skripsi\yolov5-master\yolov5-master\export.py", line 936, in
main(opt)
File "D:\Skripsi\yolov5-master\yolov5-master\export.py", line 931, in main
run(**vars(opt))
File "D:\Conda\envs\yolo\Lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Skripsi\yolov5-master\yolov5-master\export.py", line 839, in run
assert not isinstance(model, ClassificationModel), "ClassificationModel export to TF formats not yet supported."
AssertionError: ClassificationModel export to TF formats not yet supported.`

Are you guys planning on add export feature to TFLITE for Classification Model? Thanks

Additional

No response

@Halafz7 Halafz7 added the question Further information is requested label Apr 3, 2024
Copy link
Contributor

github-actions bot commented Apr 3, 2024

👋 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 a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

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):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics

@glenn-jocher
Copy link
Member

@Halafz7 hello! 😊

Thank you for reaching out. It appears from your error log that you've encountered a limitation in the current export capabilities of the YOLOv5 repository, particularly when trying to export a Classification Model to TensorFlow Lite formats.

As of now, the export of Classification Models to TF formats (including TFLITE) isn't supported. This includes both FP16 and INT8 quantizations. Our team is constantly working on improving and extending the functionality of YOLOv5, and we appreciate the community's input on features they'd like to see.

We understand how important it is for our users to have a wide range of export options and will consider adding this feature in future updates. Keep an eye on our GitHub updates and release notes for new features and improvements.

For the meantime, for any more detailed queries or suggestions, feel free to open a discussion in the YOLOv5 GitHub Discussions section. The community and team are there to brainstorm and support.

Thank you for your understanding and support! 🚀

@Halafz7
Copy link
Author

Halafz7 commented Apr 30, 2024

Hi Glenn, just asking, is export of Classification Models to TF formats (including TFLITE) supported for version after YOLOv5 (e.g.YOLOv8)?

@glenn-jocher
Copy link
Member

Hello! 😊

As of the current updates, the YOLO architecture, including versions up to YOLOv5, doesn't inherently support exporting Classification Models directly to TensorFlow formats (TFLITE included), due to the focus on object detection.

Future versions, like a potential YOLOv8, are subject to enhancements based on feedback and evolving capabilities. We recommend keeping an eye on the GitHub repository for any future updates on export capabilities and supporting documentation.

Thank you for your curiosity and support of the YOLO series! 🚀

Copy link
Contributor

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

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 YOLO 🚀 and Vision AI ⭐

@github-actions github-actions bot added the Stale label May 31, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants