• DepthAI
  • Gen2 YOLOv5 detections problem

Hi,

I'd like to use Yolov5 with on device decoding. I used these files: https://github.com/luxonis/depthai-experiments/tree/master/gen2-yolo/device-decoding . I downloaded a .blob file for yolov5s, with default weights provided by the YoloV5 repo, by following this notebook https://colab.research.google.com/github/luxonis/depthai-ml-training/blob/master/colab-notebooks/YoloV5_training.ipynb .

However, I obtain bad detection results with the main.py file and default yolov5.json files from the gen2-yolo repo. Here's an example on car detections:

This problem reminds me this one: https://discuss.luxonis.com/d/134-yolo-v4-implementation-problem but I did not figure out how to solve it.

Thank you,

Pierre

Hey,

Did you follow the tutorial exactly and executed the needed ONNX steps?

Have you changed the input shape or any other parameters? As if you did, you might have to change the yolov5.json as well.

Yes, I executed the notebook as it is provided. I think this problem comes from missing Non Max suppression in the main.py program in gen2_yolo. I'll try to implement it

Hi, even with custom non max suppression to counter multiple detections, I'm not able to have correct detections with YOLOv5 on my Oak, has anyone succeed in that? The boxes are still very noisy...

Hey, if you executed the correct steps the NMS will be done automatically on the device. But correct settings must be provided in the accompanied JSON.

Can you tell me:
a) what's the shape of your model?
b) how does your JSON look?
c) how are you executing the script in gen2-yolo/device-decoding?

hi,
here's my json file.

{
    "nn_config":
    {
        "output_format" : "detection",
        "NN_family" : "YOLO",
        "input_size": "416x416",
        "NN_specific_metadata" :
        {
            "classes" : 80,
            "coordinates" : 4,
            "anchors" : [10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326],
            "anchor_masks" :
            {
                "side52" : [0,1,2],
                "side26" : [3,4,5],
                "side13" : [6,7,8]
            },
            "iou_threshold" : 0.5,
            "confidence_threshold" : 0.5
        }
    },
    "mappings":
    {
        "labels":
        [
            "person",
            "bicycle",
            "car",
            "motorbike",
            "aeroplane",
            "bus",
            "train",
            "truck",
            "boat",
            "traffic light",
            "fire hydrant",
            "stop sign",
            "parking meter",
            "bench",
            "bird",
            "cat",
            "dog",
            "horse",
            "sheep",
            "cow",
            "elephant",
            "bear",
            "zebra",
            "giraffe",
            "backpack",
            "umbrella",
            "handbag",
            "tie",
            "suitcase",
            "frisbee",
            "skis",
            "snowboard",
            "sports ball",
            "kite",
            "baseball bat",
            "baseball glove",
            "skateboard",
            "surfboard",
            "tennis racket",
            "bottle",
            "wine glass",
            "cup",
            "fork",
            "knife",
            "spoon",
            "bowl",
            "banana",
            "apple",
            "sandwich",
            "orange",
            "broccoli",
            "carrot",
            "hot dog",
            "pizza",
            "donut",
            "cake",
            "chair",
            "sofa",
            "pottedplant",
            "bed",
            "diningtable",
            "toilet",
            "tvmonitor",
            "laptop",
            "mouse",
            "remote",
            "keyboard",
            "cell phone",
            "microwave",
            "oven",
            "toaster",
            "sink",
            "refrigerator",
            "book",
            "clock",
            "vase",
            "scissors",
            "teddy bear",
            "hair drier",
            "toothbrush"
        ]
    }
}

My model input shape is 416x416, and I execute main.py with python3 main.py -m yolov5s_openvino_2021.4_6shave.blob -c json/yolov5.json

    a month later

    Hey, sorry for a late reply here. Did you manage to solve the problem pierreia ? You should try using DepthAI==2.14.1.0.