How to extract the boxes, class id, score from the results there using the person-vehicle-bike-detection-crossroad-yolov3-1020 Intel pre-trained model?
Consulting the object_detection_demo.py it's not clear how to do that compared to reading the model from Yolo weights and cfg, using the " classes, scores, boxes = model.detect(frame, CONFIDENCE_THRESHOLD, NMS_THRESHOLD)" call.
net = cv.dnn.readNet(person-vehicle-bike-detection-crossroad-yolov3-1020.xml, person-vehicle-bike-detection-crossroad-yolov3-1020.bin)
blob = cv.dnn.blobFromImage(frame, size=(416, 416))
out = net.forward()
for detection in out:
confidence = float(detection)
xmin = int(detection * frame.shape)
ymin = int(detection * frame.shape)
xmax = int(detection * frame.shape)
ymax = int(detection * frame.shape)
if confidence > 0.5:
cv.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))
Thank you for reaching out to us.
For your information, by running Object Detection Python* Demo with person-vehicle-bike-detection-crossroad-yolov3-1020, you can print the raw output inference results by using command -r or --raw_output_message.
You can execute the command as follow:
python object_detection_demo.py -i <path_to_input> -m <path_to_model>\person-vehicle-bike-detection-crossroad-yolov3-1020.xml -at yolo --raw_output_message
Tks Wan for the support.
But what I need is not to use the python demo script as you described. I would like to get the inference's result and extract the bounding boxes, score, and class id, to use it on my own application.
The demo script you pointed out makes use of several other scripts that is very verbose/complex to embedded on my application.
By executing --raw_output_message or -r with Object Detection Python* Demo, you will extract the Bounding Boxes, Detection Score, and Class ID from the inference’s result as shown in the attached picture:
Looking into the object_detection_demo.py, Line 213 to Line 224, you can find the function of extracting the Bounding Boxes, Detection Score, and Class ID from the inference’s result.
Hope this helps.
Did you try OpenCV's DNN object_detection sample? -> https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.py
It reads parameters from the `models` file -> https://github.com/opencv/opencv/blob/master/samples/dnn/models.yml
There are no Intel/OpenVINO models in this file, but I assume person-vehicle-bike-detection-crossroad-yolov3-1020 is very similar to YOLOv3.
This thread will no longer be monitored since we have provided suggestions.
If you need any additional information from Intel, please submit a new question.