mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
dnn: protobuf shutdown
This commit is contained in:
parent
aad6d28e13
commit
3f102e5d3a
@ -42,6 +42,8 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include <opencv2/dnn/layer.details.hpp>
|
#include <opencv2/dnn/layer.details.hpp>
|
||||||
|
|
||||||
|
#include <google/protobuf/stubs/common.h>
|
||||||
|
|
||||||
namespace cv {
|
namespace cv {
|
||||||
namespace dnn {
|
namespace dnn {
|
||||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||||
@ -56,11 +58,26 @@ Mutex& getInitializationMutex()
|
|||||||
// force initialization (single-threaded environment)
|
// force initialization (single-threaded environment)
|
||||||
Mutex* __initialization_mutex_initializer = &getInitializationMutex();
|
Mutex* __initialization_mutex_initializer = &getInitializationMutex();
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using namespace google::protobuf;
|
||||||
|
class ProtobufShutdown {
|
||||||
|
public:
|
||||||
|
bool initialized;
|
||||||
|
ProtobufShutdown() : initialized(true) {}
|
||||||
|
~ProtobufShutdown()
|
||||||
|
{
|
||||||
|
initialized = false;
|
||||||
|
google::protobuf::ShutdownProtobufLibrary();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void initializeLayerFactory()
|
void initializeLayerFactory()
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
|
|
||||||
|
static ProtobufShutdown protobufShutdown; (void)protobufShutdown;
|
||||||
|
|
||||||
CV_DNN_REGISTER_LAYER_CLASS(Slice, SliceLayer);
|
CV_DNN_REGISTER_LAYER_CLASS(Slice, SliceLayer);
|
||||||
CV_DNN_REGISTER_LAYER_CLASS(Split, SplitLayer);
|
CV_DNN_REGISTER_LAYER_CLASS(Split, SplitLayer);
|
||||||
CV_DNN_REGISTER_LAYER_CLASS(Concat, ConcatLayer);
|
CV_DNN_REGISTER_LAYER_CLASS(Concat, ConcatLayer);
|
||||||
|
Loading…
Reference in New Issue
Block a user