Below, I will explain how I solved the problem.
- Modify JSON file
I have modified the file yolov8n_nms_config.json in the path /local/workspace/hailo_model_zoo/hailo_model_zoo/cfg/postprocess_config/
Here, I have added the following values:
- max_proposals_per_class: 250
- max_det: 250
- max_bboxes_per_class: 250
My JSON file looked as follows afterward:
{
“nms_scores_th”: 0.2,
“nms_iou_th”: 0.7,
“image_dims”: [
640,
640
],
“max_proposals_per_class”: 250,
“max_det”: 250,
“max_bboxes_per_class”: 250,
“classes”: 80,
“regression_length”: 16,
“background_removal”: false,
“bbox_decoders”: [
{
“name”: “yolov8n/bbox_decoder41”,
“stride”: 8,
“reg_layer”: “yolov8n/conv41”,
“cls_layer”: “yolov8n/conv42”
},
{
“name”: “yolov8n/bbox_decoder52”,
“stride”: 16,
“reg_layer”: “yolov8n/conv52”,
“cls_layer”: “yolov8n/conv53”
},
{
“name”: “yolov8n/bbox_decoder62”,
“stride”: 32,
“reg_layer”: “yolov8n/conv62”,
“cls_layer”: “yolov8n/conv63”
}
]
}
- Create .hef-File
After that, I create a .hef file using the command hailomz compile yolov8n --ckpt=best.onnx --hw-arch hailo8 --calib-path Yolo/train/images --classes 1 --performance.
- Parse .hef-File
Then I call the command hailortcli parse-hef yolov8n.hef
Architecture HEF was compiled for: HAILO8
Network group name: yolov8n, Single Context
Network name: yolov8n/yolov8n
VStream infos:
Input yolov8n/input_layer1 UINT8, NHWC(640x640x3)
Output yolov8n/yolov8_nms_postprocess FLOAT32, HAILO NMS(number of classes: 1, maximum bounding boxes per class: 250, maximum frame size: 5004)
Operation:
Op YOLOV8
Name: YOLOV8-Post-Process
Score threshold: 0.200
IoU threshold: 0.70
Classes: 1
Cross classes: false
Max bboxes per class: 250
Image height: 640
Image width: 640
The value for maximum bounding boxes per class has been changed to 250.
The value for maximum frame size has been changed to 5004.
- Edit source code.
In my source code, I adjusted the size of hailo_output_vstream.
std::vector<float32_t> vstream_output_data(5004);
I based my work on this example: Hailo-Application-Code-Examples/runtime/windows/yolov8/yolov8_example.cpp at main · hailo-ai/Hailo-Application-Code-Examples · GitHub