Notice: As of March 26, 2024, the depthai-sdk does not offer official support for running YOLO instance segmentation inference alongside depth on the device.
This repository provides code that facilitates inference on YOLOv8 models, extracting segmentation masks and depth information in millimeters (mm). The depth is extracted as the median of depth points within the rotated rectangle region of segment masks.
Follow these steps to execute the inference on a custom-trained YOLOv8 model:
- Open
helpers/export.py. - Modify the dimensions (height & width) values as required.
- Run the script. This action will generate a file in ONNX format.
- Note down the values of shapes for input, output0 and output1 from the terminal output. Open
helpers/config.jsonand update the corresponding values. Also, update the class names in order in theclass_namesarray. - Next, Open a web browser and navigate to http://blobconverter.luxonis.com/.
- Select the OpenVino default version.
- Choose ONNX as the model source and click continue.
- Upload the ONNX file.
- In the model optimizer params, update it to
--data_type=FP16 --mean_values=[0,0,0] --scale_values=[255,255,255]and click convert. - This will download the
.blobfile. - Move/Copy this blob file to the
modelsdirectory. - Update the blob path in the variable
path_to_yolo_blobat line 19 inmain.py.
Special thanks to pedro-UCA and jakaskerl for the support provided in the Luxonis forum.
Note: For any further assistance, please refer to the Luxonis forum.