• DepthAI-v2
  • Issues getting detections out of yolo-models

Hi there, as the title says, I have some Issues using the yolov5-face and yolov8-face models with any suitable node (YoloSpatialDetectionNetwork, YoloDetectionNetwork). I especially want to use those models with the YoloSpatialDetectionNetwork-node. My Issue is that I can't get any detections out of them to draw the boundingboxes. I could get your example here to work:

luxonis/depthai-coreblob/main/examples/Yolo/tiny_yolo.cpp
With your pretrained yolov4_tiny_coco_416x416.blob model.

As you can guess, I am using: C++ with depthai-core. And I used converted versions of the official pretrained "n"-versions of the mentioned models from .pt to .onnx to .blob From:

deepcam-cn/yolov5-face

(converted this one with the export.py script from .pt -> .onnx )

And:

derronqi/yolov8-face

With this approach from .pt -> .onnx :

In the last step, I converted those models with:

https://blobconverter.luxonis.com/

(standard settings: Model optimizer params: --data_type=FP16 --mean_values=[127.5,127.5,127.5] --scale_values=[255,255,255], Compile parameters: -ip U8, Shaves: 4, (and also 11 ).

I could only find in this yaml here some corresponding Anchor information for the yolov5-face-model:

deepcam-cn/yolov5-faceblob/master/models/yolov5n.yaml

detectionNetwork->setAnchors({ 4,5, 8,10, 13,16, 23,29, 43,55, 73,105, 146,217, 231,300, 335,433 });

detectionNetwork->setAnchorMasks({ {"P3/8", {0, 1, 2}}, {"P4/16", {3, 4, 5}}, {"P5/32", {6, 7, 8}} });// not sure at all if I set that one right...

For the yolov8-face-model I couldn't find any info about anchors. I also tried to not use anchor info at all (with both models). I am an AI / CV newbie and what I found really intresting/confusing that I rarely encountered a .yaml or .cfg or anything giving a info regarding yolo-models and how to set them. Please explain how to deal with that. At the moment, I haven't found the energy and time to learn how to train a model myself.

For both models I set the incoming video material to 640x640 and I set the following params:

detectionNetwork->setNumClasses(1);

detectionNetwork->setCoordinateSize(4);

I also tried the same settings as this guy with his pre-trained model of the yolov8n-face-model:

KoHomerHu/blur-with-oak

Here I have uploaded my conversion attempts:

https://we.tl/t-A9FPdEk48n

Please add some more C++ examples/experiments. A SDK for C++ would also be nice for comparison reasons with your existing python examples. The user experience as a C++ dev is quite challenging if you have trouble translating the python code properly.

Anyway, you already did a great job. So thanks for your effort.

  • Hi @nmd
    Use https://tools.luxonis.com/ to convert Yolo models.
    Then set the anchors as specified in the .json file you get. Also Yolov8 doesn't need them, so you can skip it.

    Thanks,
    Jaka

Hi @nmd
Use https://tools.luxonis.com/ to convert Yolo models.
Then set the anchors as specified in the .json file you get. Also Yolov8 doesn't need them, so you can skip it.

Thanks,
Jaka

  • nmd replied to this.

    jakaskerl Hey Jaka, thanks for your quick reply. I will try that!

    Ok, I am really impressed. With conversion a lot of things can go sideways and that you took the effort to ease that process. It works flawlessly now. Thank you so much!