GithubHelp home page GithubHelp logo

Yolov8 in Unity about ultralytics HOT 4 CLOSED

cmilanes93 avatar cmilanes93 commented on September 24, 2024
Yolov8 in Unity

from ultralytics.

Comments (4)

glenn-jocher avatar glenn-jocher commented on September 24, 2024

Hi there! πŸš€

Integrating YOLOv8 in Unity for mobile deployment isn't directly supported, but you can achieve it by exporting the model to ONNX and then utilizing a plugin or framework compatible with Unity for ONNX models, like [Unity Barracuda](https://docs.unity3d.com/Packages/com.unity.barracuda @cmilanes93).

Here’s a basic example of how you might export your model to ONNX:

yolo export model=yolov8n.pt format=onnx

Then, load this ONNX model into Unity with Barracuda. Ensure to optimize your model for mobile deployment to achieve good FPS, such as using smaller model variants and quantization if necessary.

Feel free to ask more if you need further guidance! 😊

from ultralytics.

cmilanes93 avatar cmilanes93 commented on September 24, 2024

Hi there! πŸš€

Integrating YOLOv8 in Unity for mobile deployment isn't directly supported, but you can achieve it by exporting the model to ONNX and then utilizing a plugin or framework compatible with Unity for ONNX models, like [Unity Barracuda](https://docs.unity3d.com/Packages/com.unity.barracuda @cmilanes93).

Here’s a basic example of how you might export your model to ONNX:

yolo export model=yolov8n.pt format=onnx

Then, load this ONNX model into Unity with Barracuda. Ensure to optimize your model for mobile deployment to achieve good FPS, such as using smaller model variants and quantization if necessary.

Feel free to ask more if you need further guidance! 😊

Quantization? We already build our mobile app with the yolov8, but we are trying to solve the problem of fps on mobile.
We retrain our model only using CPU, and the smaller version, but still having poor performance on cell.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on September 24, 2024

Hi! Glad to hear you've made progress with YOLOv8 on mobile. If you're still facing low FPS issues, consider the following:

  1. Model Quantization: Reduces the precision of the weights from floating point to int8, which can significantly improve performance without a large sacrifice in accuracy. ONNX provides tools for quantization that you can utilize.

  2. Optimize the Inference Pipeline: Ensure that input preprocessing and output postprocessing are optimized. Reducing the resolution or simplifying preprocessing steps might help speed up the process.

  3. Use Hardware Accelerators: If your mobile device supports it, make use of hardware accelerators like GPU or DSP.

Here's a quick snippet on how you might quantize in ONNX:

import onnx
from onnxruntime.quantization import quantize_dynamic, QuantType

model_path = "model.onnx"
quantized_model_path = "quantized_model.onnx"

model = onnx.load(model_path)
quantized_model = quantize_dynamic(model, quantized_model_path, weight_type=QuantType.QInt8)

onnx.save(quantized_model, quantized_model_path)

Implementing these can potentially help improve your app's performance. Let me know if this helps or if you need more details!

from ultralytics.

github-actions avatar github-actions commented on September 24, 2024

πŸ‘‹ 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 ⭐

from ultralytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.