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.
6403 Discussions

Segmentation - different results between demo and sample code

jbb455
Novice
802 Views

Hi,

 

I'm playing with the road-segmentation-adas-0001 model from the model zoo. I've run the demo script on a video I have and the results are pretty good. However, I then split that video into jpg frames (using FFMPEG) and tried to run inference on individual frames using code from here: https://docs.openvino.ai/latest/notebooks/003-hello-segmentation-with-output.html but the results I get on each frame are much worse.

I've tried to comb through the demo program to see what the difference is, but it's so coupled up with 'helper' classes etc it's impossible to tell what's going on. I can't find where the actual inference code is within all the AsyncPipeline stuff to see what the difference is between that and the sample code.

My questions:

  1. is
    result = compiled_model([input_image])[output_layer_ir]
    the best way to do inference on a model? If not, is there any simple sample code to use which doesn't depend on lots of other files to run?
  2. is it ok to then call the same function with a different input image to get inference results on a different frame, or do I have to recompile etc or do anything else to reset between frames?

The image below shows the difference in results: pausing the demo script on frame 49 of my video on the left, and using the 'hello segmentation' code on frame 49 on the right.

jbb455_0-1681220986786.png

Thanks!

0 Kudos
1 Solution
Hairul_Intel
Moderator
772 Views

Hi jbb455,

Thank you for reaching out to us.

 

For your information, I've validated both Image Segmentation Python Demo and Hello Image Segmentation in OpenVINO 2022.3.0. Here are the results:

 

Image Segmentation Python Demo:

omz.pngomz_nm.png

 

Hello Image Segmentation:

notebook.png

 

Both sample results produces different colors for their masking as the color values for both sample codes are different.

 

The Image Segmentation Python Demo is using Pascal VOC palettes while Hello Image Segmentation color palette is defined in this array colormap = np.array([[68, 1, 84], [48, 103, 141], [53, 183, 120], [199, 216, 52]]). Hence, the difference in image results.

 

Here is the result for running Image Segmentation Python Demo using the custom array colormap values:

arr_omz.pngarr_omz_nm.png

 

 

On another note, could you elaborate more regarding the "worse" results (FPS, throughput, etc.) between the sample codes?

 

Here are the answer to your questions:

  1. The result = compiled_model([input_image])[output_layer_ir] is a validated method for calling the inference result. You can try referring to our Hello Classification Python Sample for a simple method however, there's no guarantee on the effects on performance.
  2. If you're using the same model, then the only thing you should do would be to change the input image. However, do note the pre-processing of the image before inferencing as each images will also need to follow the same process.

 

 

Regards,

Hairul

 

 

View solution in original post

3 Replies
Hairul_Intel
Moderator
773 Views

Hi jbb455,

Thank you for reaching out to us.

 

For your information, I've validated both Image Segmentation Python Demo and Hello Image Segmentation in OpenVINO 2022.3.0. Here are the results:

 

Image Segmentation Python Demo:

omz.pngomz_nm.png

 

Hello Image Segmentation:

notebook.png

 

Both sample results produces different colors for their masking as the color values for both sample codes are different.

 

The Image Segmentation Python Demo is using Pascal VOC palettes while Hello Image Segmentation color palette is defined in this array colormap = np.array([[68, 1, 84], [48, 103, 141], [53, 183, 120], [199, 216, 52]]). Hence, the difference in image results.

 

Here is the result for running Image Segmentation Python Demo using the custom array colormap values:

arr_omz.pngarr_omz_nm.png

 

 

On another note, could you elaborate more regarding the "worse" results (FPS, throughput, etc.) between the sample codes?

 

Here are the answer to your questions:

  1. The result = compiled_model([input_image])[output_layer_ir] is a validated method for calling the inference result. You can try referring to our Hello Classification Python Sample for a simple method however, there's no guarantee on the effects on performance.
  2. If you're using the same model, then the only thing you should do would be to change the input image. However, do note the pre-processing of the image before inferencing as each images will also need to follow the same process.

 

 

Regards,

Hairul

 

 

jbb455
Novice
762 Views

Hi Hairul, thanks so much for your reply!

 

It turns out my issue was with compressing the frames when extracting from the video - saving as png using FFMPEG leads to the expected inference results using the Hello script (comparable to using the video in the demo script), vs saving as jpg.

 

Thanks for your time!

0 Kudos
Hairul_Intel
Moderator
746 Views

Hi jbb455,

Thank you for sharing your solution with us.

 

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

 

 

Regards,

Hairul


0 Kudos
Reply