mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
dnn: added "hidden" experimental namespace
Main purpose of this namespace is to avoid using of incompatible binaries that will cause applications crashes. This additional namespace will not impact "Source code API". This change allows to maintain ABI checks (with easy filtering out).
This commit is contained in:
@@ -40,8 +40,6 @@
|
||||
//M*/
|
||||
|
||||
#include "../precomp.hpp"
|
||||
using namespace cv;
|
||||
using namespace cv::dnn;
|
||||
|
||||
#if HAVE_PROTOBUF
|
||||
#include "caffe.pb.h"
|
||||
@@ -54,7 +52,13 @@ using namespace cv::dnn;
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||
#include "caffe_io.hpp"
|
||||
#endif
|
||||
|
||||
namespace cv {
|
||||
namespace dnn {
|
||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||
|
||||
#ifdef HAVE_PROTOBUF
|
||||
using ::google::protobuf::RepeatedField;
|
||||
using ::google::protobuf::RepeatedPtrField;
|
||||
using ::google::protobuf::Message;
|
||||
@@ -357,14 +361,14 @@ public:
|
||||
|
||||
}
|
||||
|
||||
Ptr<Importer> cv::dnn::createCaffeImporter(const String &prototxt, const String &caffeModel)
|
||||
Ptr<Importer> createCaffeImporter(const String &prototxt, const String &caffeModel)
|
||||
{
|
||||
return Ptr<Importer>(new CaffeImporter(prototxt.c_str(), caffeModel.c_str()));
|
||||
}
|
||||
|
||||
#else //HAVE_PROTOBUF
|
||||
|
||||
Ptr<Importer> cv::dnn::createCaffeImporter(const String&, const String&)
|
||||
Ptr<Importer> createCaffeImporter(const String&, const String&)
|
||||
{
|
||||
CV_Error(cv::Error::StsNotImplemented, "libprotobuf required to import data from Caffe models");
|
||||
return Ptr<Importer>();
|
||||
@@ -372,7 +376,7 @@ Ptr<Importer> cv::dnn::createCaffeImporter(const String&, const String&)
|
||||
|
||||
#endif //HAVE_PROTOBUF
|
||||
|
||||
Net cv::dnn::readNetFromCaffe(const String &prototxt, const String &caffeModel /*= String()*/)
|
||||
Net readNetFromCaffe(const String &prototxt, const String &caffeModel /*= String()*/)
|
||||
{
|
||||
Ptr<Importer> caffeImporter = createCaffeImporter(prototxt, caffeModel);
|
||||
Net net;
|
||||
@@ -380,3 +384,6 @@ Net cv::dnn::readNetFromCaffe(const String &prototxt, const String &caffeModel /
|
||||
caffeImporter->populateNet(net);
|
||||
return net;
|
||||
}
|
||||
|
||||
CV__DNN_EXPERIMENTAL_NS_END
|
||||
}} // namespace
|
||||
|
||||
@@ -50,8 +50,9 @@
|
||||
#include <opencv2/dnn/shape_utils.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv::dnn;
|
||||
namespace cv {
|
||||
namespace dnn {
|
||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||
|
||||
using std::vector;
|
||||
using std::map;
|
||||
@@ -74,11 +75,6 @@ namespace
|
||||
};
|
||||
}
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace dnn
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
static String toString(const T &v)
|
||||
{
|
||||
@@ -2030,5 +2026,5 @@ BackendWrapper::BackendWrapper(const Ptr<BackendWrapper>& base, const MatShape&
|
||||
|
||||
BackendWrapper::~BackendWrapper() {}
|
||||
|
||||
}
|
||||
}
|
||||
CV__DNN_EXPERIMENTAL_NS_END
|
||||
}} // namespace
|
||||
|
||||
@@ -42,10 +42,9 @@
|
||||
#include "precomp.hpp"
|
||||
#include <opencv2/dnn/layer.details.hpp>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace dnn
|
||||
{
|
||||
namespace cv {
|
||||
namespace dnn {
|
||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||
|
||||
static Mutex* __initialization_mutex = NULL;
|
||||
Mutex& getInitializationMutex()
|
||||
@@ -98,4 +97,5 @@ void initializeLayerFactory()
|
||||
CV_DNN_REGISTER_LAYER_CLASS(Scale, ScaleLayer);
|
||||
}
|
||||
|
||||
}} //namespace
|
||||
CV__DNN_EXPERIMENTAL_NS_END
|
||||
}} // namespace
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include <opencv2/dnn/all_layers.hpp>
|
||||
|
||||
namespace cv { namespace dnn {
|
||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||
Mutex& getInitializationMutex();
|
||||
void initializeLayerFactory();
|
||||
CV__DNN_EXPERIMENTAL_NS_END
|
||||
}} // namespace
|
||||
|
||||
@@ -10,8 +10,6 @@ Implementation of Tensorflow models parser
|
||||
*/
|
||||
|
||||
#include "../precomp.hpp"
|
||||
using namespace cv;
|
||||
using namespace cv::dnn;
|
||||
|
||||
#if HAVE_PROTOBUF
|
||||
#include "graph.pb.h"
|
||||
@@ -24,6 +22,13 @@ using namespace cv::dnn;
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||
#include "tf_io.hpp"
|
||||
#endif
|
||||
|
||||
namespace cv {
|
||||
namespace dnn {
|
||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||
|
||||
#if HAVE_PROTOBUF
|
||||
|
||||
using ::google::protobuf::RepeatedField;
|
||||
using ::google::protobuf::RepeatedPtrField;
|
||||
@@ -734,14 +739,14 @@ void TFImporter::populateNet(Net dstNet)
|
||||
|
||||
} // namespace
|
||||
|
||||
Ptr<Importer> cv::dnn::createTensorflowImporter(const String &model)
|
||||
Ptr<Importer> createTensorflowImporter(const String &model)
|
||||
{
|
||||
return Ptr<Importer>(new TFImporter(model.c_str()));
|
||||
}
|
||||
|
||||
#else //HAVE_PROTOBUF
|
||||
|
||||
Ptr<Importer> cv::dnn::createTensorflowImporter(const String&)
|
||||
Ptr<Importer> createTensorflowImporter(const String&)
|
||||
{
|
||||
CV_Error(cv::Error::StsNotImplemented, "libprotobuf required to import data from TensorFlow models");
|
||||
return Ptr<Importer>();
|
||||
@@ -749,7 +754,7 @@ Ptr<Importer> cv::dnn::createTensorflowImporter(const String&)
|
||||
|
||||
#endif //HAVE_PROTOBUF
|
||||
|
||||
Net cv::dnn::readNetFromTensorflow(const String &model)
|
||||
Net readNetFromTensorflow(const String &model)
|
||||
{
|
||||
Ptr<Importer> importer = createTensorflowImporter(model);
|
||||
Net net;
|
||||
@@ -757,3 +762,6 @@ Net cv::dnn::readNetFromTensorflow(const String &model)
|
||||
importer->populateNet(net);
|
||||
return net;
|
||||
}
|
||||
|
||||
CV__DNN_EXPERIMENTAL_NS_END
|
||||
}} // namespace
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
namespace cv {
|
||||
namespace dnn {
|
||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||
|
||||
#if defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
|
||||
#include "THDiskFile.h"
|
||||
|
||||
@@ -1021,5 +1023,5 @@ Net readNetFromTorch(const String &model, bool isBinary)
|
||||
return net;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
CV__DNN_EXPERIMENTAL_NS_END
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user