Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6392 Discussions

OpenVINO - OpenCV back end API issue

Lavanya_K_Intel
Employee
2,501 Views

Hi,

Processor: Intel Core i5
OS: Windows
OpenVINO version: OpenVINO Toolkit 2021.1
Intel pre-trained model: face-detection-retail-0004.xml
input: video.264

I have tried running the object_detection_demo_ssd_async python sample in OpenVINO by giving backend API(CAP_INTEL_MFX) to VideoCapture for decoding the resulting file.
cap = cv2.VideoCapture(input_stream,cv2.CAP_INTEL_MFX)

I am able to view output but displaying the below line on terminal.
"MFX: getproperty() is not implemented"


Command used: python object_detection_demo_ssd_async.py -i=video.264 -m <path-to-model>\face-detection-retail-0004.xml

Please find the attached screenshots for your reference

Kindly let me know if you have any inputs.

TIA,
Lavanya

0 Kudos
1 Solution
Maksim_S_Intel
Employee
2,420 Views

The problem with CPP demo is the same as with Python one: VideoCapture with MediaSDK does not return frame dimensions via properties (get method). But CPP demo relies on these values  not only to draw graphs but also to draw detections.

See:

https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/object_detection_demo_ssd_async/main.cpp#L91-L92

https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/object_detection_demo_ssd_async/main.cpp#L375-L396

Try to add initialization of width and height variables after the first frame have been read (https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/object_detection_demo_ssd_async/main.cpp#L95), e.g. "width = curr_frame.width(); height = curr_frame.height();"

View solution in original post

7 Replies
Maksim_S_Intel
Employee
2,482 Views

MediaSDK backend in OpenCV does not implement getProperty method yet, so it does not return anything. As I can see the demo application uses frame width and height to create presenter and draw graphs: 

https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/python_demos/object_detection_demo_ssd_async/object_detection_demo_ssd_async.py#L465-L466

https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/python_demos/common/monitors.py#L24

I think you can ignore this warning or hardcode sizes passed to presenter if you need graphs to show correctly.

0 Kudos
Lavanya_K_Intel
Employee
2,462 Views

Hi Maksim,

Thank you for the response.

OS: Windows

I have tried even running the object_detection_demo_ssd_async CPP demo with person-detection-retail-0013.xml and Input is video.264

Command: object_detection_demo_ssd_async.exe -i <path>\video.264 -m <path>\person_model\intel\person-detection-retail-0013\FP32\person-detection-retail-0013.xml 

 

Not able to view the detection results on output frame.

Please find the attached screenshot and let me know your inputs.

 

TIA,

Lavanya

0 Kudos
Munesh_Intel
Moderator
2,444 Views

Hi Lavanya,

person-detection-retail-0013 model is a pedestrian detector for the retail scenario. 

I've just validated using people-detection video, available at https://github.com/intel-iot-devkit/sample-videos, and it works fine.


Regards,

Munesh


0 Kudos
Lavanya_K_Intel
Employee
2,437 Views

Hi Mukesh,

Thank you for the response.

My aim is to use backend API in conjunction of OpenVINO when using OpenCV videoCapture method for video.264.

                cap = new cv::VideoCapture(source, backendAPI); 

So, I ran the object_detection_ssd_async CPP demo with video.264 format input using the opencv back end API for Video capture. so modified the  below code accordingly.

cv::VideoCapture cap;
if (!((FLAGS_i == "cam") ? cap.open(0) : cap.open(FLAGS_i.c_str(),cv::CAP_INTEL_MFX))) {
throw std::logic_error("Cannot open input file or camera: " + FLAGS_i);
}

Converted the person-detection.mp4 to out_person_detection.264 using below command.

ffmpeg -i <path>\Downloads\people-detection.mp4 -an -vcodec libx264 -crf 23 out_people_detection.264

Command: object_detection_demo_ssd_async.exe -m <path_to_model>\intel\person-detection-retail-0013\FP32\person-detection-retail-0013.xml -i <path_to_video>\out_car-detection.h264

Sample is running but not able to view the detection results on output frame. Also getting below line in terminal.

"MFX: getproperty() is not implemented"

Please find the attached screenshots for your reference and let me know if you have any inputs.

 

TIA,

Lavanya.

 

 

 

0 Kudos
Lavanya_K_Intel
Employee
2,430 Views

Hi Munesh,

Ignore my previous reply.

Thank you for the response.

My aim is to use backend API in conjunction of OpenVINO when using OpenCV videoCapture method for video.264.

                cap = new cv::VideoCapture(source, backendAPI); 

So, I ran the object_detection_ssd_async CPP demo with video.264 format input using the opencv back end API for Video capture. so modified the  below code accordingly.

cv::VideoCapture cap;
if (!((FLAGS_i == "cam") ? cap.open(0) : cap.open(FLAGS_i.c_str(),cv::CAP_INTEL_MFX))) {
throw std::logic_error("Cannot open input file or camera: " + FLAGS_i);
}

Converted the person-detection.mp4 to out_person_detection.264 using below command.

ffmpeg -i <path>\Downloads\people-detection.mp4 -an -vcodec libx264 -crf 23 out_people_detection.264

Command: object_detection_demo_ssd_async.exe -m <path_to_model>\intel\person-detection-retail-0013\FP32\person-detection-retail-0013.xml -i <path_to_video>\out_people_detection.264

Sample is running but not able to view the detection results on output frame. Also getting below line in terminal.

"MFX: getproperty() is not implemented"

Please find the attached screenshots for your reference and let me know if you have any inputs.

 

TIA,

Lavanya.

 

0 Kudos
Maksim_S_Intel
Employee
2,421 Views

The problem with CPP demo is the same as with Python one: VideoCapture with MediaSDK does not return frame dimensions via properties (get method). But CPP demo relies on these values  not only to draw graphs but also to draw detections.

See:

https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/object_detection_demo_ssd_async/main.cpp#L91-L92

https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/object_detection_demo_ssd_async/main.cpp#L375-L396

Try to add initialization of width and height variables after the first frame have been read (https://github.com/openvinotoolkit/open_model_zoo/blob/75ec8ad4b6c4fd7fb161ae9d2c3056281b2443de/demos/object_detection_demo_ssd_async/main.cpp#L95), e.g. "width = curr_frame.width(); height = curr_frame.height();"

Munesh_Intel
Moderator
2,295 Views

Hi Lavanya,


This thread will no longer be monitored since a solution has been provided. If you need any additional information from Intel, please submit a new question. 


Regards,

Munesh


0 Kudos
Reply