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
Assertion failed (inputs.size()) in cv::dnn::dnn4_v20190122::Layer::getMemoryShapes #14713
Operating System / Platform => Mac OS High Sierra (also had this issue on Windows 10)
Compiler => XCode
Detailed description
So I have 3 PyTorch models where 2 of them give me trouble when loading in ONNX, the inference works fine in PyTorch and the conversion is all ok too.
So in the first model I get this error when reading the ONNX model in OpenCV:
Assertion failed (inputs.size()) in cv::dnn::dnn4_v20190122::Layer::getMemoryShapese
With the other model I get this error:
Blob 64 not found in const blobs
This has all something to do with the input where in the first error the inputs.size() is 0 and in the second model the blob isn't big enough somehow.
I don't know which framework or action I did I can pinpoint the error to..
@alalek My mistake, I actually get an error just for that 1 wrong ONNX model, it just can't parse it and gives an "Can't read ONNX model file" error.
As the first one works fine, I suppose the conversion to my ONNX model went fine, although something may have not converted properly. Here is some info of the model:
changed the title [-]Crash on reading specific dnn::readNetFromONNX file[/-][+]Assertion failed (inputs.size()) in cv::dnn::dnn4_v20190122::Layer::getMemoryShapes[/+]on Jun 7, 2019
So I get this error now: OpenCV(4.1.0) Error: Assertion failed (inputs.size()) in cv::dnn::dnn4_v20190122::Layer::getMemoryShapes, file c:\build\master_winpack-build-win64-vc15\opencv\modules\dnn\src\dnn.cpp, line 3616
I suppose OpenCV is unable to generate a tensor to test the model out? @dkurt Could you possibly remove the incomplete/needs reproducer labels? Thanks! Also, is this issue the same as #14290 ? Sadly I haven't been able to convert the ONNX model to TensorFlow as the ONNX -> Tensorflow converter doesn't seem to like INT64's and only wants Floats...
Activity
alalek commentedon Jun 4, 2019
Due static initialization order fiasco it is a bad practice in general.
Please provide:
[-]Crash on reading second dnn::readNetFromONNX file[/-][+]Crash on reading specific dnn::readNetFromONNX file[/+]Aeroxander commentedon Jun 5, 2019
@alalek My mistake, I actually get an error just for that 1 wrong ONNX model, it just can't parse it and gives an "Can't read ONNX model file" error.
As the first one works fine, I suppose the conversion to my ONNX model went fine, although something may have not converted properly. Here is some info of the model:
format: ONNX v4
producer: pytorch 1.1
imports: ai.onnx v9
name: torch-jit-export
Should I try out ONNX v5 that may be more compatible with converting from PyTorch to ONNX, or how can I discover what's wrong with my model?
Could still something be wrong with OpenCV? According to the ONNX valid model check code the model is fine:
Output:
I'd think if ONNX missed converting something at least the output of the forward pass would give something faulty..
[-]Crash on reading specific dnn::readNetFromONNX file[/-][+]Assertion failed (inputs.size()) in cv::dnn::dnn4_v20190122::Layer::getMemoryShapes[/+]Aeroxander commentedon Jun 7, 2019
So I get this error now:
OpenCV(4.1.0) Error: Assertion failed (inputs.size()) in cv::dnn::dnn4_v20190122::Layer::getMemoryShapes, file c:\build\master_winpack-build-win64-vc15\opencv\modules\dnn\src\dnn.cpp, line 3616@alalek as requested, here is the standalone project:
https://github.com/Aeroxander/decodererror
Just unzip the lib+include.zip file in the same folder and the opencv_world410.7z in /x64/Debug, then it should work out of the box!
Aeroxander commentedon Jun 7, 2019
I suppose OpenCV is unable to generate a tensor to test the model out?
@dkurt Could you possibly remove the incomplete/needs reproducer labels? Thanks! Also, is this issue the same as #14290 ? Sadly I haven't been able to convert the ONNX model to TensorFlow as the ONNX -> Tensorflow converter doesn't seem to like INT64's and only wants Floats...
Aeroxander commentedon Jun 11, 2019
It looks like it's referencing to the Mul layer with ID 18;
Have no idea why there isn't an input..
I also get this error in another model:
And this seems to be in the MatMul layer, so there must be something wrong with the PyTorch -> ONNX conversion right?
ashishkrshrivastava commentedon Feb 24, 2020
Hii @Aeroxander , are you still working with this model ?
dkurt commentedon Mar 3, 2020
@ashishkrshrivastava, Please check if we can close this issue because it's resolved by #16709 or not (if we can run a model).
ashishkrshrivastava commentedon Mar 5, 2020
@dkurt It is resolved. I am able to load it successfully.