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

after training #961

Open
1 task done
jbarilo7911 opened this issue Dec 28, 2024 · 2 comments
Open
1 task done

after training #961

jbarilo7911 opened this issue Dec 28, 2024 · 2 comments
Labels
embedded Pertaining to IOT or low-power devices enhancement New feature or request exports Model exports (ONNX, TensorRT, TFLite, etc.)

Comments

@jbarilo7911
Copy link

Search before asking

  • I have searched the HUB issues and found no similar feature requests.

Description

we need the option to use optimize for example optimize=vela when exporting and perhaps some model pruning capabilities that can limit the model size for different edge devices, esp with tflite

Use case

No response

Additional

No response

@jbarilo7911 jbarilo7911 added the enhancement New feature or request label Dec 28, 2024
@UltralyticsAssistant UltralyticsAssistant added embedded Pertaining to IOT or low-power devices exports Model exports (ONNX, TensorRT, TFLite, etc.) labels Dec 28, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @jbarilo7911, thank you for raising an issue about Ultralytics HUB 🚀! It looks like you're suggesting the addition of export-related optimizations and model pruning capabilities, particularly for edge devices and formats like TFLite. This is a great suggestion and something we understand could be valuable for many users.

If this is a feature request, we appreciate the idea and will take it into consideration for future developments. If there are any specific scenarios or requirements you'd like this feature to address, feel free to share more details!

If this is a 🐛 Bug Report, please also include detailed steps to reproduce the issue to help us investigate.

We aim to address all issues in a timely manner, and an Ultralytics engineer will review this soon. Thanks for your patience! 😊

@pderrenger
Copy link
Member

@jbarilo7911 thank you for your suggestion and for taking the time to share your thoughts! 😊

The features you're requesting—adding an optimize=vela option during export and incorporating model pruning capabilities—are excellent ideas, especially for improving deployment on resource-constrained edge devices. Here's some context and guidance:

  1. Optimize with Vela:
    Vela is a compiler specifically designed to optimize TensorFlow Lite models for Arm Ethos-U NPUs. While Vela isn't natively integrated into the current Ultralytics export workflow, you can follow a two-step process:

    • First, export your YOLO model to TFLite using the model.export(format='tflite') function.
    • Then, optimize the exported TFLite model using the Vela compiler. You can find more details on Vela in Arm's documentation.

    We'll forward your suggestion to the development team for consideration as part of future updates to simplify this process directly in the HUB.

  2. Model Pruning:
    While pruning isn't directly integrated into HUB yet, it's a well-known technique to reduce model size and improve inference speed, particularly for edge devices. For now, you can manually prune models using third-party libraries like TensorFlow Model Optimization Toolkit or PyTorch's pruning utilities before exporting to TFLite or other formats. For example:

    from torch.nn.utils import prune
    model = YOLO('path/to/best.pt')
    # Apply pruning
    model.model = prune.global_unstructured(
        parameters=model.model.parameters_to_prune,
        pruning_method=prune.L1Unstructured,
        amount=0.5,  # Prune 50% of parameters
    )
    # Export pruned model
    model.export(format='tflite')

    We'll also pass your request for built-in pruning support to the team, as this feature could be incredibly beneficial for edge deployments.

If you're interested in learning more about the current export workflows or supported optimizations, feel free to check out the Export Documentation and Edge TPU guide.

Thanks again for the valuable feedback—your input helps us refine and enhance HUB for everyone! Let us know if you have any additional questions or ideas. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedded Pertaining to IOT or low-power devices enhancement New feature or request exports Model exports (ONNX, TensorRT, TFLite, etc.)
Projects
None yet
Development

No branches or pull requests

3 participants