1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Make external cv::dnn::Importer usage is deprecated

This commit is contained in:
Dmitry Kurtaev
2017-08-03 17:43:52 +03:00
parent 37ba1d6f2d
commit bd8e6b7e14
17 changed files with 86 additions and 150 deletions
+4 -18
View File
@@ -91,19 +91,11 @@ int main(int argc, char **argv)
vector<cv::Vec3b> colors = readColors();
//! [Create the importer of Caffe model]
Ptr<dnn::Importer> importer;
try //Try to import Caffe GoogleNet model
{
importer = dnn::createCaffeImporter(modelTxt, modelBin);
}
catch (const cv::Exception &err) //Importer can throw errors, we will catch them
{
cerr << err.msg << endl;
}
//! [Create the importer of Caffe model]
//! [Initialize network]
dnn::Net net = readNetFromCaffe(modelTxt, modelBin);
//! [Initialize network]
if (!importer)
if (net.empty())
{
cerr << "Can't load network by using the following files: " << endl;
cerr << "prototxt: " << modelTxt << endl;
@@ -113,12 +105,6 @@ int main(int argc, char **argv)
exit(-1);
}
//! [Initialize network]
dnn::Net net;
importer->populateNet(net);
importer.release(); //We don't need importer anymore
//! [Initialize network]
//! [Prepare blob]
Mat img = imread(imageFile);
if (img.empty())