0

I'm following the instruction of opencv online documentation to load a caffe framework model. But there is an unhandled exception when I execute to the code net.forward() at the 80th line. Following is the error information.

OpenCV Error: Assertion failed (input.dims() == 4 && (input.type() == CV_32F ||
input.type() == CV_64F)) in cv::dnn::ConvolutionLayerImpl::allocate, file C:\Use
rs\chang\Desktop\opencv_contrib-master\modules\dnn\src\layers\convolution_layer.
cpp, line 89

I really have no idea about this exception.Waiting for any reply.Thanks! opencv dnn online document:http://docs.opencv.org/3.1.0/d5/de7/tutorial_dnn_googlenet.html opencv extra_contrib dnn samples:https://github.com/opencv/opencv_contrib/tree/master/modules/dnn/samples

tsang
  • 1
  • 2

1 Answers1

0

Please try to replace

dnn::Blob inputBlob = dnn::Blob(img);

with

dnn::Blob inputBlob = dnn::Blob::fromImages(img);
VDWWD
  • 35,079
  • 22
  • 62
  • 79
daniel liu
  • 41
  • 5