This guide explains how to integrate a pretrained YOLOv8 model with MATLAB's Ground Truth Labeler App to automatically generate human bounding box annotations and manually assign IDs using attributes.
- MATLAB R2023b or later
- Toolboxes:
- Computer Vision Toolbox
- Deep Learning Toolbox
- Deep Learning Toolbox Converter for ONNX Model Format
Download the YOLOv8 model integration from:
🔗 https://github.com/matlab-deep-learning/Pretrained-YOLOv8-Network-For-Object-Detection.git
In MATLAB, navigate to the downloaded folder in the Current Folder pane and run:
addpath(genpath(pwd));
Go to the Home tab → click Add-Ons → Get Add-Ons. In the Add-On Explorer, search for and install the following:
- Computer Vision Toolbox
- Deep Learning Toolbox
- Deep Learning Toolbox Converter for ONNX Model Format
- Place the custom automation file
yolov8_label.m
in the same folder. - Add your
.png
image folder (e.g.,output_images
) and the fileload_timestamps.m
(from this repo: https://github.com/Cyano0/Label-the-AoC-Rosbag-Data/tree/main) into the same directory. - Run the following command in MATLAB:
load_timestamps;
In the MATLAB Command Window, run:
groundTruthLabeler
- Load the folder containing your
.png
frames (e.g.,output_images
).
- Add a new rectangle ROI label named "human".
- Go to Select Algorithm → click Import Algorithm → choose
yolov8_label.m
.
- Choose "YOLOv8 Human Labeler" from the automation list.
- Click Automate → then click Run. YOLOv8 will automatically draw bounding boxes for detected humans.
- Once satisfied, click Accept to keep the generated labels.
- Click the checkbox next to the label "human" in the label list.
- Click Attribute → Add a new attribute called ID.
- Set the Type to "List" and provide values like
1, 2, 3, ...
.
For each frame:
- Click on each bounding box.
- In the right panel, assign the correct ID (e.g.,
1
for person1,2
for person2, etc.).