YOLOv8n validated for Unity Sentis (Version 1.4.0-pre.3*)
This is Yolov8n object detection example code for unity sentis, not real-time inference, for instance image.
** this is almost same code with ref, but only for image. **
ref: https://huggingface.co/unity/sentis-YOLOv8n
YOLOv8n is a real-time multi-object recognition model confirmed to run in Unity 2023.
How to Use
First get the package com.unity.sentis
from the package manager.
You will also need the Unity UI package.
- Create a new scene in Unity 2023 or higher (include in Unity 6000).
- Install
com.unity.sentis
version1.4.0-pre.3
from the package manager - Add the c# script to the Main Camera.
- Create a Raw Image in the scene and link it as the
displayImage
- Drag the yolov8n.sentis or yolov8n.onnx file into the model asset field
- Drag the classes.txt on to the labelAssets field
- Place a *.png image file in the Assets folder and drag onto Input Texture field
- Set the fields for the bounding box texture sprite (you can create your own one using a transparent texture or use an inbuilt one) and the font
Preview
If working correctly you should see something like this:
Information
The NMS selection will be improved in later versions of Sentis. Currently uses singular-class approach.
Unity Sentis
Unity Sentis is the inference engine that runs in Unity 3D. More information can be found at here
License
The YOLO models use the GPLv3 license.