Fixed CMake and CPP build errors

pull/265/head
Vitaliy Lyudvichenko 10 years ago
parent 48ab440f8e
commit 09ffc43ce6
  1. 4
      modules/dnn/CMakeLists.txt
  2. 2
      modules/dnn/include/opencv2/dnn/dict.hpp
  3. 13
      modules/dnn/src/dnn.cpp

@ -9,7 +9,7 @@ if(${PROTOBUF_FOUND} AND EXISTS ${PROTOBUF_PROTOC_EXECUTABLE})
file(GLOB PROTO_FILES src/*.proto) file(GLOB PROTO_FILES src/*.proto)
PROTOBUF_GENERATE_CPP(PROTO_HDRS PROTO_SRCS ${PROTO_FILES}) PROTOBUF_GENERATE_CPP(PROTO_HDRS PROTO_SRCS ${PROTO_FILES})
set(HAVE_PROTOBUF ON) set(HAVE_PROTOBUF ON)
add_definitions(-DHAVE_PROTOBUF 1) add_definitions(-DHAVE_PROTOBUF=1)
else() else()
message(STATUS "PROTOBUF not found. Caffe import function will be disabled.") message(STATUS "PROTOBUF not found. Caffe import function will be disabled.")
set(HAVE_PROTOBUF OFF) set(HAVE_PROTOBUF OFF)
@ -19,9 +19,9 @@ endif()
endmacro(_dnn_find_protobuf) endmacro(_dnn_find_protobuf)
if(BUILD_opencv_core)#build as OpenCV module if(BUILD_opencv_core)#build as OpenCV module
_dnn_find_protobuf()
set(the_description "Deep neural network module. It allows to load models and to make forward pass") set(the_description "Deep neural network module. It allows to load models and to make forward pass")
set(OPENCV_MODULE_IS_PART_OF_WORLD OFF) set(OPENCV_MODULE_IS_PART_OF_WORLD OFF)
_dnn_find_protobuf()
ocv_add_module(dnn opencv_imgproc opencv_core opencv_highgui WRAP python matlab) ocv_add_module(dnn opencv_imgproc opencv_core opencv_highgui WRAP python matlab)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-shadow -Wno-parentheses) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-shadow -Wno-parentheses)

@ -43,7 +43,7 @@ private:
void release(); void release();
}; };
class Dict class CV_EXPORTS Dict
{ {
//TODO: maybe this mechanism was realized somewhere in OpenCV? //TODO: maybe this mechanism was realized somewhere in OpenCV?
typedef std::map<String, DictValue> _Dict; typedef std::map<String, DictValue> _Dict;

@ -145,9 +145,8 @@ struct LayerOutId
struct LayerData struct LayerData
{ {
LayerData() {} LayerData() {}
LayerData(const String &_name, const String &_type, LayerParams &_params = LayerParams()) LayerData(const String &_name, const String &_type, LayerParams &_params)
: name(_name), type(_type), params(_params) : name(_name), type(_type), params(_params) {}
{}
String name; String name;
String type; String type;
@ -179,7 +178,8 @@ struct Net::Impl
{ {
Impl() Impl()
{ {
layers.insert(make_pair(0, LayerData("_input", "_input"))); LayerParams paramsEmpty;
layers.insert(make_pair(0, LayerData("_input", "_noType", paramsEmpty)));
lastLayerId = 1; lastLayerId = 1;
netWasAllocated = false; netWasAllocated = false;
} }
@ -218,9 +218,12 @@ struct Net::Impl
if (v.isString()) if (v.isString())
return getLayerId(v.get<String>()); return getLayerId(v.get<String>());
else if (v.isInt()) else if (v.isInt())
int id = v.get<int>(); return v.get<int>();
else else
{
CV_Assert(v.isString() || v.isInt()); CV_Assert(v.isString() || v.isInt());
return -1;
}
} }
LayerData& getLayerData(const DictValue &v) LayerData& getLayerData(const DictValue &v)

Loading…
Cancel
Save