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

(-215:Assertion failed) 1

$
0
0
I'm trying to import my own pre-trained Caffe googlenet model using OpenCV v.3.4.3, where i run a Caffe test after training using the model deploy file and everything was working fine. However when feeding the OpenCv net (after loading it) with image blob i get an exception. **OpenCv Code:** Net net = Dnn.readNetFromCaffe("deploy.prototxt","bvlc_googlenet.caffemodel"); Mat image = Imgcodecs.imread(input.getAbsolutePath(), Imgcodecs.IMREAD_COLOR); Mat blob = Dnn.blobFromImage(image); System.out.println(image); System.out.println(blob); net.setInput(blob); Mat result = net.forward().reshape(1); **Output Error:** Mat [ 24*15*CV_8UC3, isCont=true, isSubmat=false, nativeObj=0x1bcd0740, dataAddr=0x1a9d1880 ] Mat [ -1*-1*CV_32FC1, isCont=true, isSubmat=false, nativeObj=0x1bcd0eb0, dataAddr=0x1a4e4340 ] .......... Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.3) Z:\build tools\opencv-3.4.3\modules\dnn\src\layers\fully_connected_layer.cpp:73: error: (-215:Assertion failed) 1 <= blobs.size() && blobs.size() <= 2 in function 'cv::dnn::FullyConnectedLayerImpl::FullyConnectedLayerImpl' ] at org.opencv.dnn.Net.forward_1(Native Method) at org.opencv.dnn.Net.forward(Net.java:62) at test.OpenCVTests.main(OpenCVTests.java:54) [Caffe-train-val-model.prototxt](https://www.dropbox.com/s/vm8sw16vu0ec2kp/train_val.prototxt?dl=0) [Caffe-deploy-model.prototxt](https://www.dropbox.com/s/6kmtmsdlkufygoj/deploy.prototxt?dl=0)

Viewing all articles
Browse latest Browse all 4615

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>