Hi,
I’m using an ONNX classification model and I’m testing inference using opencv 4.12.0. I have no problem using the net over a single image sample:
cv::dnn::blobFromImage( frame, blob, 1.0/255.0, imgSz, cv::Scalar(), true, false );
net.setInput( blob );
net.forward( outs, outputlayers );
but if I try to perform an inference over several samples at a time I got a net.forward() crash:
cv::dnn::blobFromImages( frames, blob, 1.0/255.0, imgSz, cv::Scalar(), true, false );
net.setInput( blob );
net.forward( outs, outputlayers_all );
the crash is the following one:
OpenCV Error: Assertion failed ((int)_numAxes == inputs[0].size()) in cv::dnn::PermuteLayerImpl::getMemoryShapes, file D:\Data\opencv\opencv-4.12.0\modules\dnn\src\layers\permute_layer.cpp, line 162
my net model take as input a NCHW image (1, 3, 320, 320). How have I to call net.forward using the multisample input got from blobFromImages, i.e. (4, 3, 320, 320)? I’m trying to improve performace using some kind of parallelism rather than execute each sample in sequence.
thank you, best regards
Andrea