intel / webml-polyfill

Deprecated, the Web Neural Network Polyfill project has been moved to https://github.com/webmachinelearning/webnn-polyfill
Apache License 2.0
161 stars 42 forks source link

[OpenVINO] Enable Native Image Segmentation C++ Demo #1218

Closed mingmingtasd closed 4 years ago

mingmingtasd commented 4 years ago

The source code of this Image Segmentation C++ Demo we have enabled blongs to openvino-toolkit, and it seems that the source code can't be found on github. While I find another Image Segmentation C++ Demo on https://github.com/opencv/open_model_zoo/tree/master/demos/segmentation_demo with similar source code and feature.

For the Image Segmentation C++ Demo we have enabled, excute this command ./segmentation_demo -i woman.bmp -m /home/xu/Desktop/deeplabv3_mnv2/without_argmax/deeplabv3_mnv2_224/deeplabv3_mnv2_224.xml, we can segment the first image to get the second image as output: woman out_0

fujunwei commented 4 years ago

How to get the deeplabv3 openvino model? do you have any patches on the Image Segmentation C++ Demo ?

mingmingtasd commented 4 years ago

@fujunwei We converted tensorflow model with openvino tool to get this openvino model. The demo has been upgraded in openvino 2020.2 version and should to be rebuilt if needed.

fujunwei commented 4 years ago

Could you please share the patch you apply to the Demo? i want to verify it with old veriosn.

mingmingtasd commented 4 years ago

OK, I have sent to you privately. @fujunwei

mingmingtasd commented 4 years ago

On openvino 2020.3.194, the Native Image Segmentation C++ Demo has been updated. I tried to re-enable this demo to validate the deeplabv3 model (513*513) on ICL. I find that the updated demo code uses openCV to post-process output data but it doesn't do pre-processing for input. So add some codes to resize the input picture, for example:

cv::Mat res_inImg;
cv::Size sz;
sz.width = 513;
sz.height = 513;
cv::resize(inImg, res_inImg, sz);
......

In addition, must set -delay 0 in the command line as below: ./segmentation_demo -m /home/webnn/Desktop/quantize/deeplabv3_DefaultQuantization/2020-06-22_11-00-05/optimized/deeplabv3.xml -i ~/Downloads/woman.jpg -delay 0

The original deeplabv3 model and the quantized deeplabv3 model can both pass with the demo, check the details as below: Screenshot from 2020-07-02 13-07-46 Screenshot from 2020-07-02 13-09-25

@ibelem @huningxin