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
dnn: assertion failure with multiple images #13626
using the face_detector_uint8.pb model with multiple images (using dnn::blobFromImages), i get :
OpenCV(4.0.1-dev) Error: Assertion failed (start <= (int)shape.size() && end <= (int)shape.size() && start <= end) in total, file C:/p/opencv/modules/dnn/include/opencv
2/dnn/shape_utils.hpp, line 161
debugging it, i found, that in the 2nd ScaleLayer, the endAxis exceeds the size of the inpShape:
Thread 1 hit Breakpoint 9, cv::dnn::ScaleLayerImpl::forward (this=0xa5c1090, inputs_arr=..., outputs_arr=..., internals_arr=...)
at C:\p\opencv\modules\dnn\src\layers\scale_layer.cpp:94
94 CV_Assert(total(inpShape, axis, endAxis) == numWeights);
(gdb) p inpShape
$16 = std::vector of length 4, capacity 4 = {3, 32, 24, 32}
(gdb) p axis
$17 = 0
(gdb) p endAxis
$18 = 5 // this is 2 with one image, and 5 with 3 of them !
CV_Assert(start <= (int)shape.size() && end <= (int)shape.size() &&
start <= end);
Steps to reproduce
```
dnn::Net net = dnn::readNetFromTensorflow("opencv_face_detector_uint8.pb","opencv_face_detector.pbtxt");
Mat f1=imread("../img/h1.png");
Mat f2=imread("../img/h2.png");
Mat f3=imread("../img/h3.png");
vector<Mat> vf {f1, f2, f3};
Mat blob = dnn::blobFromImages(vf, 1, Size(128,96), Scalar(104, 177, 123, 0), false, false);
net.setInput(blob);
Mat res = net.forward("detection_out");
```
Activity
AyushP123 commentedon Jan 16, 2019
can I assign this to myself, it seems like a good first bug.
Mancancode commentedon Mar 15, 2019
berak commentedon Mar 15, 2019
alalek commentedon Dec 24, 2021
probably related to #16630
asmorkalov commentedon May 18, 2023
@fengyuentau Could you take a look?