Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

OpenCV(3.4.11) Error: Unspecified error (Number of input channels should be multiple of 3 but got 4

$
0
0
I mauising opencv 3.4.11 for android. I get this error when i used the forward of Net function: Mat imageBlob = Dnn.blobFromImage(frame, 0.00392, new Size(416,416),new Scalar(0, 0, 0),/*swapRB*/false, /*crop*/false); tinyV4.setInput(imageBlob); /* the result */ java.util.List result = new java.util.ArrayList(2); List outputLayers = new java.util.ArrayList<>(); /* the outputs layers are 30 and 37*/ outputLayers.add(0, "yolo_30"); outputLayers.add(1, "yolo_37"); /*we are looking for layers yolo30 and yolo37, and we want to save them into result */ tinyV4.forward(result, outputLayers); The full error: OpenCV(3.4.11) Error: Unspecified error (Number of input channels should be multiple of 3 but got 4) in virtual bool cv::dnn::ConvolutionLayerImpl::getMemoryShapes(const std::vector>&, int, std::vector>&, std::vector>&) const, file /build/3_4_pack-android/opencv/modules/dnn/src/layers/convolution_layer.cpp, line 306 [ERROR:0] OPENCV/DNN: [Convolution]:(conv_0): getMemoryShapes() throws exception. inputs=1 outputs=0/1 blobs=1 [ERROR:0] input[0] = [ 1 4 510 510 ] [ERROR:0] blobs[0] = CV_32FC1 [ 32 3 3 3 ] [ERROR:0] Exception message: OpenCV(3.4.11) /build/3_4_pack-android/opencv/modules/dnn/src/layers/convolution_layer.cpp:306: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'virtual bool cv::dnn::ConvolutionLayerImpl::getMemoryShapes(const std::vector>&, int, std::vector>&, std::vector>&) const' E/org.opencv.dnn: dnn::forward_14() caught cv::Exception: OpenCV(3.4.11) /build/3_4_pack-android/opencv/modules/dnn/src/layers/convolution_layer.cpp:306: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'virtual bool cv::dnn::ConvolutionLayerImpl::getMemoryShapes(const std::vector>&, int, std::vector>&, std::vector>&) const' I tried to change the size to to 512X512, 1024x980, it not helped.

Viewing all articles
Browse latest Browse all 41027