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
Hello,
According to opencv tensorflow object detection api I run segmentation with trained Mask-RCNN Inception v2 model. Mainly it works well, but with about 15% images I get the error:
boxes, masks = net.forward(['detection_out_final', 'detection_masks'])
cv2.error: OpenCV(4.1.0) /io/opencv/modules/core/src/matrix.cpp:541: error: (-215:Assertion failed) r == Range::all() || (0 <= r.start && r.start < r.end && r.end <= m.size[i]) in function 'Mat'
At the same time if I try these images with original tensorflow object detection api it works well, so I conclude it's not because of corrupted images or model mistakes, but because of opencv error.
Can you help me please?
Thank you in advance.
Hello @alalek ,
Please check this example code with .pb and .pbtxt - https://yadi.sk/d/I8xDeLPQ4-4DEw
To get right result please run: python mask_rcnn.py --input https://ayamama.ru/wp-content/uploads/2017/06/snils.jpg --model frozen_inference_graph.pb --config graphcv.pbtxt --width 500 --height 500
To get error run: python mask_rcnn.py --input https://pensioved.ru/wp-content/uploads/2018/02/1-7.jpg --model frozen_inference_graph.pb --config graphcv.pbtxt --width 500 --height 500
Thank you
Hello @dkurt
I've rebuilt opencv and it works! Thank you.
But I have another question. The mask and bounding box that I get with opencv differs from the mask and box with tensorflow:
Original image:
Detected with opencv:
Detected with tensorflow:
Can it be somehow improved?
Thank you.
Hello @dkurt
I used this code form tensorflow object detection repo. I got the same result with your code example. So it's not a problem with opencv. We can close this issue. Thank you.
Activity
alalek commentedon May 10, 2019
Provide complete minimal reproducer with included input images with issues.
ConsMe commentedon May 10, 2019
Hello @alalek ,
Please check this example code with .pb and .pbtxt - https://yadi.sk/d/I8xDeLPQ4-4DEw
To get right result please run:
python mask_rcnn.py --input https://ayamama.ru/wp-content/uploads/2017/06/snils.jpg --model frozen_inference_graph.pb --config graphcv.pbtxt --width 500 --height 500To get error run:
python mask_rcnn.py --input https://pensioved.ru/wp-content/uploads/2018/02/1-7.jpg --model frozen_inference_graph.pb --config graphcv.pbtxt --width 500 --height 500Thank you
ConsMe commentedon May 13, 2019
@alalek , will you help me?
dkurt commentedon May 14, 2019
@ConsMe, Please try the changes from #14552
This is result from TensorFlow:
and with mask_rcnn.py sample:
Please note that I had to replace a
swapRBflag toFalse(perhaps the training was different for your model)ConsMe commentedon May 14, 2019
Hello @dkurt ,
Sorry for my backwardness, but how can I apply these changes for v.3.4 to my installed v.4.1.0?
dkurt commentedon May 14, 2019
You need to rebuild OpenCV. After merge the changes will be ported to master branch as well.
ConsMe commentedon May 15, 2019
Hello @dkurt



I've rebuilt opencv and it works! Thank you.
But I have another question. The mask and bounding box that I get with opencv differs from the mask and box with tensorflow:
Original image:
Detected with opencv:
Detected with tensorflow:
Can it be somehow improved?
Thank you.
dkurt commentedon May 16, 2019
@ConsMe, have you considered
?
ConsMe commentedon May 16, 2019
@dkurt, yes, sure, I've got that result with swapRB = False
dkurt commentedon May 18, 2019
Ok, let's reopen the issue so we won't lose it. Thanks!
dkurt commentedon May 22, 2019
This is my experiment:
Using the following script I get similar results in TensorFlow:
So please share the code you used to get target result.
ConsMe commentedon May 25, 2019
Hello @dkurt
I used this code form tensorflow object detection repo. I got the same result with your code example. So it's not a problem with opencv. We can close this issue. Thank you.
ajinkya933 commentedon Jul 19, 2019
this code is good