Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCV Error: Assertion failed #22

Open
MyraBaba opened this issue Jun 10, 2018 · 14 comments
Open

OpenCV Error: Assertion failed #22

MyraBaba opened this issue Jun 10, 2018 · 14 comments

Comments

@MyraBaba
Copy link

Hi,

After a while , around few thousands frame it gives below error. I couldnt figure it out .

Is there anybody faced same problem ?

thx

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /opt/concourse/worker/volumes/live/d8bcd4d1-79b2-4aa5-797a-b95097f1118f/volume/opencv_1512680501887/work/modules/core/src/matrix.cpp, line 538
/opt/concourse/worker/volumes/live/d8bcd4d1-79b2-4aa5-797a-b95097f1118f/volume/opencv_1512680501887/work/modules/core/src/matrix.cpp:538: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

@githublet
Copy link

because of area not plus 1?

@MyraBaba
Copy link
Author

it is happening when I playing with the number at mtcnn.cpp :
int MIN_DET_SIZE = 12;

to lower values such as 6 or 8.

try to speeding up the detection. Because I am using a stationary cam and there is always one face 1/4 of the screen and centered.

@githublet
Copy link

I think U should study MTCNN paper first,
then train your net with 6 or 8 size?
for better 11 is good ,11113 after s=2 k=3 then out 553

@xggIoU
Copy link

xggIoU commented Jul 25, 2018

I also met the same problem:OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat。I have modified it for a long time, but it is still unsolved. Does anyone know why?

@xggIoU
Copy link

xggIoU commented Jul 30, 2018

I've solved this problem.

@githublet
Copy link

how ?

@xggIoU
Copy link

xggIoU commented Jul 30, 2018

the code Rect temp((*it).y1, (*it).x1, (*it).y2 - (*it).y1, (*it).x2 - (*it).x1);
Mat secImage;
resize(image(temp), secImage, Size(24, 24), 0, 0, cv::INTER_LINEAR);
will lead the coordinate value to exceed the boundary value。so “image(temp)” will cause this kind of error. you can modify “if((*it).exist)” to "if ((*it).exist&& ((*it).y1<(*it).y2)&&((*it).x1<(*it).x2))" on second stage and third stage.

@xggIoU
Copy link

xggIoU commented Jul 30, 2018

都是中国人,我说汉语。就是我测试过,坐标值有时候会超出行列的范围,在图像的矩形ROI选取时就要出错,所以要加个判断条件。

@githublet
Copy link

哎呀,那就好说嘛,加个qq 898600252,还有开源的东西,都是nms在box reg前做,我觉得这也是bug

@MyraBaba
Copy link
Author

What is the maximum cpu core used ? my mac book only using 2-3 cores ? Can we increase it ?

@githublet
Copy link

@MyraBaba may be the first step,you can rewrite it with thread pool.

@MyraBaba
Copy link
Author

if ((*it).exist&& ((*it).y1<(*it).y2)&&((*it).x1<(*it).x2))

@xggIoU I modified as you mentioned but I have still below error.


`OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /media/pi/APULLU-01/opencv-3.4.0/modules/core/src/matrix.cpp, line 538
terminate called after throwing an instance of 'cv::Exception'
  what():  /media/pi/cc-01/opencv-3.4.0/modules/core/src/matrix.cpp:538: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

`

@zyp2014
Copy link

zyp2014 commented May 16, 2019

if ((*it).exist&& ((*it).y1<(*it).y2)&&((*it).x1<(*it).x2))

@xggIoU I modified as you mentioned but I have still below error.


`OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /media/pi/APULLU-01/opencv-3.4.0/modules/core/src/matrix.cpp, line 538
terminate called after throwing an instance of 'cv::Exception'
  what():  /media/pi/cc-01/opencv-3.4.0/modules/core/src/matrix.cpp:538: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

`

it is may be In the mtcnn constructor, cols and rows , should be equal the image cols and rows

@santiweide
Copy link

santiweide commented Aug 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants