You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mask rcnn model using OpenVINO is not accurate #14509
##### System information (version)
OpenCV => 4.1.0
Operating System / Platform => Windows10 64 Bit
Compiler => Visual Studio 2017
OpenVINO => w_openvino_toolkit_p_2018.5.456
##### Detailed description
I have trained a mask rcnn model with tensorflow and I used openvino to accelerate it. But I found the
result with using parameter DNN_BACKEND_OPENCV is more accurate than using DNN_BACKEND_INFERENCE_ENGINE.
##### Steps to reproduce
Test code is OpenCV_Mask_RCNN.cpp, test images are 2.png and 7.png. All files are packed as files.zip. files.zip
Here is my test result. DNN_BACKEND_INFERENCE_ENGINE result
DNN_BACKEND_OPENCV result
I also test faster rcnn model,both of DNN_BACKEND_OPENCV and DNN_BACKEND_INFERENCE_ENGINE result are same. With mask rcnn model seems bounding rects are same but masks are different. @dkurt This looks like a real bug.
@dkurt. A small addition: I use PC's with old CPU which not support AVX instruction set. Maybe that matters.
In all other models that I tested Inference engine backend works fine.
@Bleach665, probably not. I can reproduce the problem on different CPU. The thing is that it can compute masks and boxes separately but the problem appears if we return both of them. Let me try to find a workaround or fix that.
@dkurt , works great with these changes. The result is the same as when used CUDA or OpenCV backends.
The result with the changes above and inference engine backend:
@stq054188, sorry for late solution, but here it is: #16595. I was not able to download your model but at least with @Bleach665's image we achieve exact outputs.
BTW, for now OpenCV can work with two APIs of Inference Engine: legacy DNNBuilder and nGraph API. With nGraph API we can achieve monolithic model (all the layers are executed by IE) that means the model can work faster and even go to accelerators (i.e. Myriad NCS2).
Note(alalek): nGraph is not enabled by default. It should by this call (or through environment):
Activity
[-]Mask rcnn model use OpenVINO is not accurate[/-][+]Mask rcnn model using OpenVINO is not accurate[/+]alalek commentedon May 8, 2019
Avoid creation of issues for similar problems: #14480
This package is not fresh. Try latest release 2019R1 at first.
stq054188 commentedon May 9, 2019
@alalek @dkurt Although I changed the version to 2019_R1.01, the results did not improve.
stq054188 commentedon May 13, 2019
Has someone encountered a similar situation?
Bleach665 commentedon Feb 16, 2020
The same problem. Win10, OpenCV rev. cc259e4, OpenVINO 2019.3.379.


Model: mask_rcnn_inception_v2_coco_2018_01_28.
OpenCV backend, CPU target:
Inference engine backend, CPU target: 0 object detected.
UPD. Test image source:
Bleach665 commentedon Feb 16, 2020
@dkurt. A small addition: I use PC's with old CPU which not support AVX instruction set. Maybe that matters.
In all other models that I tested Inference engine backend works fine.
dkurt commentedon Feb 16, 2020
@Bleach665, probably not. I can reproduce the problem on different CPU. The thing is that it can compute masks and boxes separately but the problem appears if we return both of them. Let me try to find a workaround or fix that.
dkurt commentedon Feb 16, 2020
@Bleach665, May I ask you to open a
.pbtxtfile and try to apply these changes?and try to run with IE backend?
Bleach665 commentedon Feb 16, 2020
@dkurt , works great with these changes. The result is the same as when used CUDA or OpenCV backends.

The result with the changes above and inference engine backend:
dkurt commentedon Feb 16, 2020
@Bleach665, great. thanks! Based on this experiment we will propose a patch so old version of
.pbtxtwill also work.dkurt commentedon Feb 16, 2020
@stq054188, sorry for late solution, but here it is: #16595. I was not able to download your model but at least with @Bleach665's image we achieve exact outputs.
BTW, for now OpenCV can work with two APIs of Inference Engine: legacy DNNBuilder and nGraph API. With nGraph API we can achieve monolithic model (all the layers are executed by IE) that means the model can work faster and even go to accelerators (i.e. Myriad NCS2).
Note(alalek): nGraph is not enabled by default. It should by this call (or through environment):
sctrueew commentedon Apr 14, 2021
@stq054188 Hi,
How did you convert yours .h5 to .pb? I'm going to use C++ API.
Thanks