Closed chibai closed 7 years ago
using namespace std; using namespace cv; using namespace cv::dnn;
int main()
{
//input
string classNameFile = "synset_words.txt";
String imageFile = "1.jpg";
String modelTxt = "deploy.prototxt";
String modelBin = "squeezenet_v1.0.caffemodel";
// image preprocessing
Mat img = imread(imageFile);
if (img.empty())
{
cerr << "fail to load the image" << endl;
exit(-1);
}
resize(img, img, Size(227, 227));
//read class name syssets word
vector
return 0;
}
this is the full code, and the problem comes from the last line Mat proMat = probBlob.matRefConst().reshape(1, 1);
I somehow solved this by probBlob.getPlane()function but still do not know why probBlob.matRefConst() didn't work
@chibai I download pre-built opencv 3.4.3 on my windows 10. But init_module is not the member of cv::dnn .
@chibai I download pre-built opencv 3.4.3 on my windows 10. But init_module is not the member of cv::dnn .
API always changed. Please refer the newest version https://github.com/opencv/opencv/blob/master/samples/dnn/classification.cpp
I tried to run SqueezeNet in opencv dnn module but i got the opencv error Assertion failed <dim <= 2> in cv::Mat::reshape..............................
Anyone succesfully run squeezeNet in opencv dnn module??!!