Skip to content

Commit 50a5242

Browse files
committed
dnn: fix possible build problem with tensor flow, get rid of catch(...)
1 parent 10aee91 commit 50a5242

File tree

3 files changed

+11
-35
lines changed

3 files changed

+11
-35
lines changed

modules/dnn/src/caffe/caffe_importer.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,15 +374,7 @@ Ptr<Importer> cv::dnn::createCaffeImporter(const String&, const String&)
374374

375375
Net cv::dnn::readNetFromCaffe(const String &prototxt, const String &caffeModel /*= String()*/)
376376
{
377-
Ptr<Importer> caffeImporter;
378-
try
379-
{
380-
caffeImporter = createCaffeImporter(prototxt, caffeModel);
381-
}
382-
catch(...)
383-
{
384-
}
385-
377+
Ptr<Importer> caffeImporter = createCaffeImporter(prototxt, caffeModel);
386378
Net net;
387379
if (caffeImporter)
388380
caffeImporter->populateNet(net);

modules/dnn/src/tensorflow/tf_importer.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -736,23 +736,6 @@ void TFImporter::populateNet(Net dstNet)
736736

737737
} // namespace
738738

739-
Net cv::dnn::readNetFromTensorflow(const String &model)
740-
{
741-
Ptr<Importer> importer;
742-
try
743-
{
744-
importer = createTensorflowImporter(model);
745-
}
746-
catch(...)
747-
{
748-
}
749-
750-
Net net;
751-
if (importer)
752-
importer->populateNet(net);
753-
return net;
754-
}
755-
756739
Ptr<Importer> cv::dnn::createTensorflowImporter(const String &model)
757740
{
758741
return Ptr<Importer>(new TFImporter(model.c_str()));
@@ -767,3 +750,12 @@ Ptr<Importer> cv::dnn::createTensorflowImporter(const String&)
767750
}
768751

769752
#endif //HAVE_PROTOBUF
753+
754+
Net cv::dnn::readNetFromTensorflow(const String &model)
755+
{
756+
Ptr<Importer> importer = createTensorflowImporter(model);
757+
Net net;
758+
if (importer)
759+
importer->populateNet(net);
760+
return net;
761+
}

modules/dnn/src/torch/torch_importer.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -989,15 +989,7 @@ Mat readTorchBlob(const String&, bool)
989989

990990
Net readNetFromTorch(const String &model, bool isBinary)
991991
{
992-
Ptr<Importer> importer;
993-
try
994-
{
995-
importer = createTorchImporter(model, isBinary);
996-
}
997-
catch(...)
998-
{
999-
}
1000-
992+
Ptr<Importer> importer = createTorchImporter(model, isBinary);
1001993
Net net;
1002994
if (importer)
1003995
importer->populateNet(net);

0 commit comments

Comments
 (0)