Unable to load caffe framework models in opencv [closed]

asked 2017-05-16 16:25:39 -0600

harman gravatar image

I'm following this tutorial, but I'm unable to successfully run the model. I have built opencv commit id:

4b7c0b9c76cf201172ab66cf77f9cdbf6fb9c586

along with opencv_modules commit id;

072956924b0c086e00395dcf1ce6fdda3af0f4a5

I was successfully able to build opencv, but when I run the tutorial code using :

$ g++ googlenet.cpp -o lenet `pkg-config --libs --cflags opencv`

I get the following error:

googlenet.cpp: In function ‘int main(int, char**)’:
googlenet.cpp:118:38: error: ‘blobFromImage’ was not declared in this scope
     Mat inputBlob = blobFromImage(img);   //Convert Mat to batch of images
                                      ^
googlenet.cpp:122:35: error: no matching function for call to ‘cv::dnn::Net::setBlob(const char [6], cv::Mat&)’
     net.setBlob(".data", inputBlob);        //set the network input
                                   ^
googlenet.cpp:122:35: note: candidate is:
In file included from /usr/local/include/opencv2/dnn.hpp:62:0,
                 from googlenet.cpp:41:
/usr/local/include/opencv2/dnn/dnn.hpp:248:22: note: void cv::dnn::Net::setBlob(cv::String, const cv::dnn::Blob&)
         CV_WRAP void setBlob(String outputName, const Blob &blob);
                      ^
/usr/local/include/opencv2/dnn/dnn.hpp:248:22: note:   no known conversion for argument 2 from ‘cv::Mat’ to ‘const cv::dnn::Blob&’
googlenet.cpp:130:34: error: conversion from ‘cv::dnn::Blob’ to non-scalar type ‘cv::Mat’ requested
     Mat prob = net.getBlob("prob");   //gather output of "prob" layer
                                  ^

Details of my setup are:

Linux harman 3.19.0-78-generic #86~14.04.1-Ubuntu SMP Tue Dec 6 17:58:35 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

How do I resolve this error ?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-04 07:26:31.310233

Comments

yea, changes. have a look here

so the tutorial on the web does no more fit your version, but you should have the correct version of caffe_googlenet.cpp in opencv_contrib/modules/dnn/samples, right ?

berak gravatar imageberak ( 2017-05-17 00:32:03 -0600 )edit