mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
dnn: reduce set of ignored warnings
This commit is contained in:
parent
02d2cc58d7
commit
96c71dd3d2
@ -252,6 +252,7 @@ PREDEFINED = __cplusplus=1 \
|
|||||||
CV_SSE2=1 \
|
CV_SSE2=1 \
|
||||||
CV__DEBUG_NS_BEGIN= \
|
CV__DEBUG_NS_BEGIN= \
|
||||||
CV__DEBUG_NS_END= \
|
CV__DEBUG_NS_END= \
|
||||||
|
CV_DEPRECATED_EXTERNAL= \
|
||||||
CV_DEPRECATED=
|
CV_DEPRECATED=
|
||||||
EXPAND_AS_DEFINED =
|
EXPAND_AS_DEFINED =
|
||||||
SKIP_FUNCTION_MACROS = YES
|
SKIP_FUNCTION_MACROS = YES
|
||||||
|
@ -363,6 +363,15 @@ Cv64suf;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CV_DEPRECATED_EXTERNAL
|
||||||
|
# if defined(__OPENCV_BUILD)
|
||||||
|
# define CV_DEPRECATED_EXTERNAL /* nothing */
|
||||||
|
# else
|
||||||
|
# define CV_DEPRECATED_EXTERNAL CV_DEPRECATED
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef CV_EXTERN_C
|
#ifndef CV_EXTERN_C
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
# define CV_EXTERN_C extern "C"
|
# define CV_EXTERN_C extern "C"
|
||||||
|
@ -1699,7 +1699,7 @@ transform_( const T* src, T* dst, const WT* m, int len, int scn, int dcn )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CV_SIMD128
|
#if CV_SIMD128 && !defined(__aarch64__)
|
||||||
static inline void
|
static inline void
|
||||||
load3x3Matrix(const float* m, v_float32x4& m0, v_float32x4& m1, v_float32x4& m2, v_float32x4& m3)
|
load3x3Matrix(const float* m, v_float32x4& m0, v_float32x4& m1, v_float32x4& m2, v_float32x4& m3)
|
||||||
{
|
{
|
||||||
@ -1708,7 +1708,9 @@ load3x3Matrix(const float* m, v_float32x4& m0, v_float32x4& m1, v_float32x4& m2,
|
|||||||
m2 = v_float32x4(m[2], m[6], m[10], 0);
|
m2 = v_float32x4(m[2], m[6], m[10], 0);
|
||||||
m3 = v_float32x4(m[3], m[7], m[11], 0);
|
m3 = v_float32x4(m[3], m[7], m[11], 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CV_SIMD128
|
||||||
static inline v_int16x8
|
static inline v_int16x8
|
||||||
v_matmulvec(const v_int16x8 &v0, const v_int16x8 &m0, const v_int16x8 &m1, const v_int16x8 &m2, const v_int32x4 &m3, const int BITS)
|
v_matmulvec(const v_int16x8 &v0, const v_int16x8 &m0, const v_int16x8 &m1, const v_int16x8 &m2, const v_int32x4 &m3, const int BITS)
|
||||||
{
|
{
|
||||||
|
@ -20,11 +20,6 @@ else()
|
|||||||
ocv_cmake_hook_append(INIT_MODULE_SOURCES_opencv_dnn "${CMAKE_CURRENT_LIST_DIR}/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake")
|
ocv_cmake_hook_append(INIT_MODULE_SOURCES_opencv_dnn "${CMAKE_CURRENT_LIST_DIR}/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-shadow -Wno-parentheses -Wmaybe-uninitialized -Wsign-promo
|
|
||||||
-Wmissing-declarations -Wmissing-prototypes
|
|
||||||
)
|
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4701 /wd4100)
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions( -D_CRT_SECURE_NO_WARNINGS=1 )
|
add_definitions( -D_CRT_SECURE_NO_WARNINGS=1 )
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146
|
||||||
@ -33,12 +28,14 @@ if(MSVC)
|
|||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated -Wmissing-prototypes -Wmissing-declarations -Wshadow
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated -Wmissing-prototypes -Wmissing-declarations -Wshadow
|
||||||
-Wunused-parameter -Wunused-local-typedefs -Wsign-compare -Wsign-promo
|
-Wunused-parameter -Wsign-compare
|
||||||
-Wundef -Wtautological-undefined-compare -Wignored-qualifiers -Wextra
|
|
||||||
-Wunused-function -Wunused-const-variable -Wdeprecated-declarations
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT HAVE_CXX11)
|
||||||
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-undef) # LANG_CXX11 from protobuf files
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE_FRAMEWORK)
|
if(APPLE_FRAMEWORK)
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshorten-64-to-32)
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshorten-64-to-32)
|
||||||
endif()
|
endif()
|
||||||
@ -55,8 +52,6 @@ add_definitions(-DHAVE_PROTOBUF=1)
|
|||||||
|
|
||||||
#suppress warnings in autogenerated caffe.pb.* files
|
#suppress warnings in autogenerated caffe.pb.* files
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS
|
ocv_warnings_disable(CMAKE_CXX_FLAGS
|
||||||
-Wunused-parameter -Wundef -Wignored-qualifiers -Wno-enum-compare
|
|
||||||
-Wdeprecated-declarations
|
|
||||||
/wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702
|
/wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702
|
||||||
/wd4456 /wd4510 /wd4610 /wd4800
|
/wd4456 /wd4510 /wd4610 /wd4800
|
||||||
/wd4701 /wd4703 # potentially uninitialized local/pointer variable 'value' used
|
/wd4701 /wd4703 # potentially uninitialized local/pointer variable 'value' used
|
||||||
|
@ -236,7 +236,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
|
|||||||
int type;
|
int type;
|
||||||
Size kernel, stride;
|
Size kernel, stride;
|
||||||
int pad_l, pad_t, pad_r, pad_b;
|
int pad_l, pad_t, pad_r, pad_b;
|
||||||
CV_DEPRECATED Size pad;
|
CV_DEPRECATED_EXTERNAL Size pad;
|
||||||
bool globalPooling;
|
bool globalPooling;
|
||||||
bool computeMaxIdx;
|
bool computeMaxIdx;
|
||||||
String padMode;
|
String padMode;
|
||||||
@ -578,7 +578,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float pnorm, epsilon;
|
float pnorm, epsilon;
|
||||||
CV_DEPRECATED bool acrossSpatial;
|
CV_DEPRECATED_EXTERNAL bool acrossSpatial;
|
||||||
|
|
||||||
static Ptr<NormalizeBBoxLayer> create(const LayerParams& params);
|
static Ptr<NormalizeBBoxLayer> create(const LayerParams& params);
|
||||||
};
|
};
|
||||||
|
@ -60,12 +60,13 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
|
|||||||
struct CV_EXPORTS_W DictValue
|
struct CV_EXPORTS_W DictValue
|
||||||
{
|
{
|
||||||
DictValue(const DictValue &r);
|
DictValue(const DictValue &r);
|
||||||
|
DictValue(bool i) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = i ? 1 : 0; } //!< Constructs integer scalar
|
||||||
DictValue(int64 i = 0) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = i; } //!< Constructs integer scalar
|
DictValue(int64 i = 0) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = i; } //!< Constructs integer scalar
|
||||||
CV_WRAP DictValue(int i) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = i; } //!< Constructs integer scalar
|
CV_WRAP DictValue(int i) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = i; } //!< Constructs integer scalar
|
||||||
DictValue(unsigned p) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = p; } //!< Constructs integer scalar
|
DictValue(unsigned p) : type(Param::INT), pi(new AutoBuffer<int64,1>) { (*pi)[0] = p; } //!< Constructs integer scalar
|
||||||
CV_WRAP DictValue(double p) : type(Param::REAL), pd(new AutoBuffer<double,1>) { (*pd)[0] = p; } //!< Constructs floating point scalar
|
CV_WRAP DictValue(double p) : type(Param::REAL), pd(new AutoBuffer<double,1>) { (*pd)[0] = p; } //!< Constructs floating point scalar
|
||||||
CV_WRAP DictValue(const String &s) : type(Param::STRING), ps(new AutoBuffer<String,1>) { (*ps)[0] = s; } //!< Constructs string scalar
|
CV_WRAP DictValue(const String &s) : type(Param::STRING), ps(new AutoBuffer<String,1>) { (*ps)[0] = s; } //!< Constructs string scalar
|
||||||
DictValue(const char *s) : type(Param::STRING), ps(new AutoBuffer<String,1>) { (*ps)[0] = s; } //!< @overload
|
DictValue(const char *s) : type(Param::STRING), ps(new AutoBuffer<String,1>) { (*ps)[0] = s; } //!< @overload
|
||||||
|
|
||||||
template<typename TypeIter>
|
template<typename TypeIter>
|
||||||
static DictValue arrayInt(TypeIter begin, int size); //!< Constructs integer array
|
static DictValue arrayInt(TypeIter begin, int size); //!< Constructs integer array
|
||||||
|
@ -186,7 +186,8 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
|
|||||||
* If this method is called after network has allocated all memory for input and output blobs
|
* If this method is called after network has allocated all memory for input and output blobs
|
||||||
* and before inferencing.
|
* and before inferencing.
|
||||||
*/
|
*/
|
||||||
CV_DEPRECATED virtual void finalize(const std::vector<Mat*> &input, std::vector<Mat> &output);
|
CV_DEPRECATED_EXTERNAL
|
||||||
|
virtual void finalize(const std::vector<Mat*> &input, std::vector<Mat> &output);
|
||||||
|
|
||||||
/** @brief Computes and sets internal parameters according to inputs, outputs and blobs.
|
/** @brief Computes and sets internal parameters according to inputs, outputs and blobs.
|
||||||
* @param[in] inputs vector of already allocated input blobs
|
* @param[in] inputs vector of already allocated input blobs
|
||||||
@ -203,7 +204,8 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
|
|||||||
* @param[out] output allocated output blobs, which will store results of the computation.
|
* @param[out] output allocated output blobs, which will store results of the computation.
|
||||||
* @param[out] internals allocated internal blobs
|
* @param[out] internals allocated internal blobs
|
||||||
*/
|
*/
|
||||||
CV_DEPRECATED virtual void forward(std::vector<Mat*> &input, std::vector<Mat> &output, std::vector<Mat> &internals);
|
CV_DEPRECATED_EXTERNAL
|
||||||
|
virtual void forward(std::vector<Mat*> &input, std::vector<Mat> &output, std::vector<Mat> &internals);
|
||||||
|
|
||||||
/** @brief Given the @p input blobs, computes the output @p blobs.
|
/** @brief Given the @p input blobs, computes the output @p blobs.
|
||||||
* @param[in] inputs the input blobs.
|
* @param[in] inputs the input blobs.
|
||||||
@ -223,7 +225,8 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
|
|||||||
* @overload
|
* @overload
|
||||||
* @deprecated Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead
|
* @deprecated Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead
|
||||||
*/
|
*/
|
||||||
CV_DEPRECATED void finalize(const std::vector<Mat> &inputs, CV_OUT std::vector<Mat> &outputs);
|
CV_DEPRECATED_EXTERNAL
|
||||||
|
void finalize(const std::vector<Mat> &inputs, CV_OUT std::vector<Mat> &outputs);
|
||||||
|
|
||||||
/** @brief
|
/** @brief
|
||||||
* @overload
|
* @overload
|
||||||
|
@ -175,8 +175,7 @@ PERF_TEST_P_(DNNTestNetwork, MobileNet_SSD_v2_TensorFlow)
|
|||||||
PERF_TEST_P_(DNNTestNetwork, DenseNet_121)
|
PERF_TEST_P_(DNNTestNetwork, DenseNet_121)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_OPENCL_FP16 ||
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)))
|
||||||
target == DNN_TARGET_MYRIAD))
|
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/DenseNet_121.caffemodel", "dnn/DenseNet_121.prototxt", "",
|
processNet("dnn/DenseNet_121.caffemodel", "dnn/DenseNet_121.prototxt", "",
|
||||||
Mat(cv::Size(224, 224), CV_32FC3));
|
Mat(cv::Size(224, 224), CV_32FC3));
|
||||||
@ -185,7 +184,7 @@ PERF_TEST_P_(DNNTestNetwork, DenseNet_121)
|
|||||||
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_coco)
|
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_coco)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt", "",
|
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt", "",
|
||||||
Mat(cv::Size(368, 368), CV_32FC3));
|
Mat(cv::Size(368, 368), CV_32FC3));
|
||||||
@ -194,7 +193,7 @@ PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_coco)
|
|||||||
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_mpi)
|
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_mpi)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt", "",
|
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt", "",
|
||||||
Mat(cv::Size(368, 368), CV_32FC3));
|
Mat(cv::Size(368, 368), CV_32FC3));
|
||||||
@ -203,7 +202,7 @@ PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_mpi)
|
|||||||
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
|
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
// The same .caffemodel but modified .prototxt
|
// The same .caffemodel but modified .prototxt
|
||||||
// See https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp
|
// See https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp
|
||||||
@ -230,7 +229,7 @@ PERF_TEST_P_(DNNTestNetwork, Inception_v2_SSD_TensorFlow)
|
|||||||
PERF_TEST_P_(DNNTestNetwork, YOLOv3)
|
PERF_TEST_P_(DNNTestNetwork, YOLOv3)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
Mat sample = imread(findDataFile("dnn/dog416.png", false));
|
Mat sample = imread(findDataFile("dnn/dog416.png", false));
|
||||||
Mat inp;
|
Mat inp;
|
||||||
@ -241,7 +240,7 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv3)
|
|||||||
PERF_TEST_P_(DNNTestNetwork, EAST_text_detection)
|
PERF_TEST_P_(DNNTestNetwork, EAST_text_detection)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/frozen_east_text_detection.pb", "", "", Mat(cv::Size(320, 320), CV_32FC3));
|
processNet("dnn/frozen_east_text_detection.pb", "", "", Mat(cv::Size(320, 320), CV_32FC3));
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ bool UpgradeV0LayerParameter(V1LayerParameter* v0_layer_connection_,
|
|||||||
PoolingParameter_PoolMethod_STOCHASTIC);
|
PoolingParameter_PoolMethod_STOCHASTIC);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(ERROR) << "Unknown pool method " << pool;
|
LOG(ERROR) << "Unknown pool method " << (int)pool;
|
||||||
is_fully_compatible = false;
|
is_fully_compatible = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -863,7 +863,7 @@ bool UpgradeV1LayerParameter(V1LayerParameter* v1_layer_param_,
|
|||||||
while (layer_param->param_size() <= i) { layer_param->add_param(); }
|
while (layer_param->param_size() <= i) { layer_param->add_param(); }
|
||||||
layer_param->mutable_param(i)->set_name(v1_layer_param.param(i));
|
layer_param->mutable_param(i)->set_name(v1_layer_param.param(i));
|
||||||
}
|
}
|
||||||
ParamSpec_DimCheckMode mode;
|
ParamSpec_DimCheckMode mode = ParamSpec_DimCheckMode_STRICT;
|
||||||
for (int i = 0; i < v1_layer_param.blob_share_mode_size(); ++i) {
|
for (int i = 0; i < v1_layer_param.blob_share_mode_size(); ++i) {
|
||||||
while (layer_param->param_size() <= i) { layer_param->add_param(); }
|
while (layer_param->param_size() <= i) { layer_param->add_param(); }
|
||||||
switch (v1_layer_param.blob_share_mode(i)) {
|
switch (v1_layer_param.blob_share_mode(i)) {
|
||||||
@ -875,8 +875,8 @@ bool UpgradeV1LayerParameter(V1LayerParameter* v1_layer_param_,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(FATAL) << "Unknown blob_share_mode: "
|
LOG(FATAL) << "Unknown blob_share_mode: "
|
||||||
<< v1_layer_param.blob_share_mode(i);
|
<< (int)v1_layer_param.blob_share_mode(i);
|
||||||
break;
|
CV_Error_(Error::StsError, ("Unknown blob_share_mode: %d", (int)v1_layer_param.blob_share_mode(i)));
|
||||||
}
|
}
|
||||||
layer_param->mutable_param(i)->set_share_mode(mode);
|
layer_param->mutable_param(i)->set_share_mode(mode);
|
||||||
}
|
}
|
||||||
@ -1102,12 +1102,12 @@ const char* UpgradeV1LayerType(const V1LayerParameter_LayerType type) {
|
|||||||
case V1LayerParameter_LayerType_THRESHOLD:
|
case V1LayerParameter_LayerType_THRESHOLD:
|
||||||
return "Threshold";
|
return "Threshold";
|
||||||
default:
|
default:
|
||||||
LOG(FATAL) << "Unknown V1LayerParameter layer type: " << type;
|
LOG(FATAL) << "Unknown V1LayerParameter layer type: " << (int)type;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 byte.
|
static const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 byte.
|
||||||
|
|
||||||
bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) {
|
bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) {
|
||||||
CodedInputStream coded_input(input);
|
CodedInputStream coded_input(input);
|
||||||
|
@ -352,7 +352,7 @@ struct LayerPin
|
|||||||
|
|
||||||
bool operator<(const LayerPin &r) const
|
bool operator<(const LayerPin &r) const
|
||||||
{
|
{
|
||||||
return lid < r.lid || lid == r.lid && oid < r.oid;
|
return lid < r.lid || (lid == r.lid && oid < r.oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator ==(const LayerPin &r) const
|
bool operator ==(const LayerPin &r) const
|
||||||
@ -427,7 +427,7 @@ struct DataLayer : public Layer
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && inputsData.size() == 1;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && inputsData.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
||||||
@ -1690,8 +1690,8 @@ struct Net::Impl
|
|||||||
|
|
||||||
void fuseLayers(const std::vector<LayerPin>& blobsToKeep_)
|
void fuseLayers(const std::vector<LayerPin>& blobsToKeep_)
|
||||||
{
|
{
|
||||||
if( !fusion || preferableBackend != DNN_BACKEND_OPENCV &&
|
if( !fusion || (preferableBackend != DNN_BACKEND_OPENCV &&
|
||||||
preferableBackend != DNN_BACKEND_INFERENCE_ENGINE)
|
preferableBackend != DNN_BACKEND_INFERENCE_ENGINE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
|
@ -151,8 +151,8 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() ||
|
(backendId == DNN_BACKEND_HALIDE && haveHalide()) ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -104,8 +104,8 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() && axis == 1 && !padding || // By channels
|
(backendId == DNN_BACKEND_HALIDE && haveHalide() && axis == 1 && !padding) || // By channels
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && !padding;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && !padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChannelConcatInvoker : public ParallelLoopBody
|
class ChannelConcatInvoker : public ParallelLoopBody
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && crop_ranges.size() == 4;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && crop_ranges.size() == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -198,7 +198,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && !_locPredTransposed && _bboxesNormalized && !_clip;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && !_locPredTransposed && _bboxesNormalized && !_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -98,7 +98,7 @@ public:
|
|||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE ||
|
backendId == DNN_BACKEND_HALIDE ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && (op != SUM || coeffs.empty());
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && (op != SUM || coeffs.empty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -123,8 +123,8 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() && axis == 1 ||
|
(backendId == DNN_BACKEND_HALIDE && haveHalide() && axis == 1) ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && axis == 1;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && axis == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool setActivation(const Ptr<ActivationLayer>& layer) CV_OVERRIDE
|
virtual bool setActivation(const Ptr<ActivationLayer>& layer) CV_OVERRIDE
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE ||
|
backendId == DNN_BACKEND_HALIDE ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && (preferableTarget != DNN_TARGET_MYRIAD || type == CHANNEL_NRM);
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && (preferableTarget != DNN_TARGET_MYRIAD || type == CHANNEL_NRM));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
|
@ -35,8 +35,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() &&
|
(backendId == DNN_BACKEND_HALIDE && haveHalide() && !poolPad.width && !poolPad.height);
|
||||||
!poolPad.width && !poolPad.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() && dstRanges.size() == 4;
|
(backendId == DNN_BACKEND_HALIDE && haveHalide() && dstRanges.size() == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -154,8 +154,8 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() &&
|
(backendId == DNN_BACKEND_HALIDE && haveHalide() &&
|
||||||
(type == MAX || type == AVE && !pad_t && !pad_l && !pad_b && !pad_r);
|
(type == MAX || (type == AVE && !pad_t && !pad_l && !pad_b && !pad_r)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
@ -341,8 +341,8 @@ public:
|
|||||||
src.isContinuous(), dst.isContinuous(),
|
src.isContinuous(), dst.isContinuous(),
|
||||||
src.type() == CV_32F, src.type() == dst.type(),
|
src.type() == CV_32F, src.type() == dst.type(),
|
||||||
src.dims == 4, dst.dims == 4,
|
src.dims == 4, dst.dims == 4,
|
||||||
((poolingType == ROI || poolingType == PSROI) && dst.size[0] ==rois.size[0] || src.size[0] == dst.size[0]),
|
(((poolingType == ROI || poolingType == PSROI) && dst.size[0] == rois.size[0]) || src.size[0] == dst.size[0]),
|
||||||
poolingType == PSROI || src.size[1] == dst.size[1],
|
poolingType == PSROI || src.size[1] == dst.size[1],
|
||||||
(mask.empty() || (mask.type() == src.type() && mask.size == dst.size)));
|
(mask.empty() || (mask.type() == src.type() && mask.size == dst.size)));
|
||||||
|
|
||||||
PoolingInvoker p;
|
PoolingInvoker p;
|
||||||
|
@ -271,7 +271,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && preferableTarget != DNN_TARGET_MYRIAD;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && preferableTarget != DNN_TARGET_MYRIAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -175,7 +175,7 @@ public:
|
|||||||
std::vector<MatShape> &outputs,
|
std::vector<MatShape> &outputs,
|
||||||
std::vector<MatShape> &internals) const CV_OVERRIDE
|
std::vector<MatShape> &internals) const CV_OVERRIDE
|
||||||
{
|
{
|
||||||
CV_Assert(!usePeephole && blobs.size() == 3 || usePeephole && blobs.size() == 6);
|
CV_Assert((!usePeephole && blobs.size() == 3) || (usePeephole && blobs.size() == 6));
|
||||||
CV_Assert(inputs.size() == 1);
|
CV_Assert(inputs.size() == 1);
|
||||||
const MatShape& inp0 = inputs[0];
|
const MatShape& inp0 = inputs[0];
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ public:
|
|||||||
std::vector<Mat> input;
|
std::vector<Mat> input;
|
||||||
inputs_arr.getMatVector(input);
|
inputs_arr.getMatVector(input);
|
||||||
|
|
||||||
CV_Assert(!usePeephole && blobs.size() == 3 || usePeephole && blobs.size() == 6);
|
CV_Assert((!usePeephole && blobs.size() == 3) || (usePeephole && blobs.size() == 6));
|
||||||
CV_Assert(input.size() == 1);
|
CV_Assert(input.size() == 1);
|
||||||
const Mat& inp0 = input[0];
|
const Mat& inp0 = input[0];
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -45,13 +45,13 @@ public:
|
|||||||
std::vector<Mat> inputs;
|
std::vector<Mat> inputs;
|
||||||
inputs_arr.getMatVector(inputs);
|
inputs_arr.getMatVector(inputs);
|
||||||
hasWeights = blobs.size() == 2 || (blobs.size() == 1 && !hasBias);
|
hasWeights = blobs.size() == 2 || (blobs.size() == 1 && !hasBias);
|
||||||
CV_Assert(inputs.size() == 2 && blobs.empty() || blobs.size() == (int)hasWeights + (int)hasBias);
|
CV_Assert((inputs.size() == 2 && blobs.empty()) || blobs.size() == (int)hasWeights + (int)hasBias);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE ||
|
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && axis == 1;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && axis == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && sliceRanges.size() == 1 && sliceRanges[0].size() == 4;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && sliceRanges.size() == 1 && sliceRanges[0].size() == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
bool getMemoryShapes(const std::vector<MatShape> &inputs,
|
||||||
|
@ -89,8 +89,8 @@ public:
|
|||||||
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
virtual bool supportBackend(int backendId) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV ||
|
return backendId == DNN_BACKEND_OPENCV ||
|
||||||
backendId == DNN_BACKEND_HALIDE && haveHalide() && axisRaw == 1 ||
|
(backendId == DNN_BACKEND_HALIDE && haveHalide() && axisRaw == 1) ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && !logSoftMax;
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && !logSoftMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
|
@ -638,7 +638,7 @@ void OCL4DNNConvSpatial<Dtype>::generateKey()
|
|||||||
<< "p" << pad_w_ << "x" << pad_h_ << "_"
|
<< "p" << pad_w_ << "x" << pad_h_ << "_"
|
||||||
<< "num" << num_ << "_"
|
<< "num" << num_ << "_"
|
||||||
<< "M" << M_ << "_"
|
<< "M" << M_ << "_"
|
||||||
<< "activ" << fused_activ_ << "_"
|
<< "activ" << (int)fused_activ_ << "_"
|
||||||
<< "eltwise" << fused_eltwise_ << "_"
|
<< "eltwise" << fused_eltwise_ << "_"
|
||||||
<< precision;
|
<< precision;
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ bool InfEngineBackendLayer::getMemoryShapes(const std::vector<MatShape> &inputs,
|
|||||||
bool InfEngineBackendLayer::supportBackend(int backendId)
|
bool InfEngineBackendLayer::supportBackend(int backendId)
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_DEFAULT ||
|
return backendId == DNN_BACKEND_DEFAULT ||
|
||||||
backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine();
|
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfEngineBackendLayer::forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs,
|
void InfEngineBackendLayer::forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs,
|
||||||
|
@ -156,6 +156,7 @@ void blobFromTensor(const tensorflow::TensorProto &tensor, Mat &dstBlob)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void printList(const tensorflow::AttrValue::ListValue &val)
|
void printList(const tensorflow::AttrValue::ListValue &val)
|
||||||
{
|
{
|
||||||
std::cout << "(";
|
std::cout << "(";
|
||||||
@ -235,6 +236,7 @@ void printLayerAttr(const tensorflow::NodeDef &layer)
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool hasLayerAttr(const tensorflow::NodeDef &layer, const std::string &name)
|
bool hasLayerAttr(const tensorflow::NodeDef &layer, const std::string &name)
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,6 @@ using namespace tensorflow;
|
|||||||
using namespace ::google::protobuf;
|
using namespace ::google::protobuf;
|
||||||
using namespace ::google::protobuf::io;
|
using namespace ::google::protobuf::io;
|
||||||
|
|
||||||
const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 byte.
|
|
||||||
|
|
||||||
void ReadTFNetParamsFromBinaryFileOrDie(const char* param_file,
|
void ReadTFNetParamsFromBinaryFileOrDie(const char* param_file,
|
||||||
tensorflow::GraphDef* param) {
|
tensorflow::GraphDef* param) {
|
||||||
CHECK(ReadProtoFromBinaryFile(param_file, param))
|
CHECK(ReadProtoFromBinaryFile(param_file, param))
|
||||||
|
@ -194,7 +194,7 @@ TEST_P(DNNTestNetwork, SSD_VGG16)
|
|||||||
TEST_P(DNNTestNetwork, OpenPose_pose_coco)
|
TEST_P(DNNTestNetwork, OpenPose_pose_coco)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt",
|
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt",
|
||||||
Size(368, 368));
|
Size(368, 368));
|
||||||
@ -203,7 +203,7 @@ TEST_P(DNNTestNetwork, OpenPose_pose_coco)
|
|||||||
TEST_P(DNNTestNetwork, OpenPose_pose_mpi)
|
TEST_P(DNNTestNetwork, OpenPose_pose_mpi)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt",
|
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt",
|
||||||
Size(368, 368));
|
Size(368, 368));
|
||||||
@ -212,7 +212,7 @@ TEST_P(DNNTestNetwork, OpenPose_pose_mpi)
|
|||||||
TEST_P(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
|
TEST_P(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
// The same .caffemodel but modified .prototxt
|
// The same .caffemodel but modified .prototxt
|
||||||
// See https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp
|
// See https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp
|
||||||
|
@ -56,7 +56,7 @@ static inline void PrintTo(const cv::dnn::Backend& v, std::ostream* os)
|
|||||||
case DNN_BACKEND_INFERENCE_ENGINE: *os << "DLIE"; return;
|
case DNN_BACKEND_INFERENCE_ENGINE: *os << "DLIE"; return;
|
||||||
case DNN_BACKEND_OPENCV: *os << "OCV"; return;
|
case DNN_BACKEND_OPENCV: *os << "OCV"; return;
|
||||||
} // don't use "default:" to emit compiler warnings
|
} // don't use "default:" to emit compiler warnings
|
||||||
*os << "DNN_BACKEND_UNKNOWN(" << v << ")";
|
*os << "DNN_BACKEND_UNKNOWN(" << (int)v << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void PrintTo(const cv::dnn::Target& v, std::ostream* os)
|
static inline void PrintTo(const cv::dnn::Target& v, std::ostream* os)
|
||||||
@ -67,7 +67,7 @@ static inline void PrintTo(const cv::dnn::Target& v, std::ostream* os)
|
|||||||
case DNN_TARGET_OPENCL_FP16: *os << "OCL_FP16"; return;
|
case DNN_TARGET_OPENCL_FP16: *os << "OCL_FP16"; return;
|
||||||
case DNN_TARGET_MYRIAD: *os << "MYRIAD"; return;
|
case DNN_TARGET_MYRIAD: *os << "MYRIAD"; return;
|
||||||
} // don't use "default:" to emit compiler warnings
|
} // don't use "default:" to emit compiler warnings
|
||||||
*os << "DNN_TARGET_UNKNOWN(" << v << ")";
|
*os << "DNN_TARGET_UNKNOWN(" << (int)v << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
using opencv_test::tuple;
|
using opencv_test::tuple;
|
||||||
@ -235,7 +235,8 @@ namespace opencv_test {
|
|||||||
|
|
||||||
using namespace cv::dnn;
|
using namespace cv::dnn;
|
||||||
|
|
||||||
static testing::internal::ParamGenerator<tuple<Backend, Target> > dnnBackendsAndTargets(
|
static inline
|
||||||
|
testing::internal::ParamGenerator<tuple<Backend, Target> > dnnBackendsAndTargets(
|
||||||
bool withInferenceEngine = true,
|
bool withInferenceEngine = true,
|
||||||
bool withHalide = false,
|
bool withHalide = false,
|
||||||
bool withCpuOCV = true
|
bool withCpuOCV = true
|
||||||
@ -283,4 +284,103 @@ static testing::internal::ParamGenerator<tuple<Backend, Target> > dnnBackendsAnd
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
|
namespace opencv_test {
|
||||||
|
using namespace cv::dnn;
|
||||||
|
|
||||||
|
static inline
|
||||||
|
testing::internal::ParamGenerator<Target> availableDnnTargets()
|
||||||
|
{
|
||||||
|
static std::vector<Target> targets;
|
||||||
|
if (targets.empty())
|
||||||
|
{
|
||||||
|
targets.push_back(DNN_TARGET_CPU);
|
||||||
|
#ifdef HAVE_OPENCL
|
||||||
|
if (cv::ocl::useOpenCL())
|
||||||
|
targets.push_back(DNN_TARGET_OPENCL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return testing::ValuesIn(targets);
|
||||||
|
}
|
||||||
|
|
||||||
|
class DNNTestLayer : public TestWithParam<tuple<Backend, Target> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dnn::Backend backend;
|
||||||
|
dnn::Target target;
|
||||||
|
double default_l1, default_lInf;
|
||||||
|
|
||||||
|
DNNTestLayer()
|
||||||
|
{
|
||||||
|
backend = (dnn::Backend)(int)get<0>(GetParam());
|
||||||
|
target = (dnn::Target)(int)get<1>(GetParam());
|
||||||
|
getDefaultThresholds(backend, target, &default_l1, &default_lInf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getDefaultThresholds(int backend, int target, double* l1, double* lInf)
|
||||||
|
{
|
||||||
|
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
|
||||||
|
{
|
||||||
|
*l1 = 4e-3;
|
||||||
|
*lInf = 2e-2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*l1 = 1e-5;
|
||||||
|
*lInf = 1e-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkBackend(int backend, int target, Mat* inp = 0, Mat* ref = 0)
|
||||||
|
{
|
||||||
|
if (backend == DNN_BACKEND_OPENCV && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_OPENCL
|
||||||
|
if (!cv::ocl::useOpenCL())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
throw SkipTestException("OpenCL is not available/disabled in OpenCV");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
||||||
|
{
|
||||||
|
if (!checkMyriadTarget())
|
||||||
|
{
|
||||||
|
throw SkipTestException("Myriad is not available/disabled in OpenCV");
|
||||||
|
}
|
||||||
|
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE < 2018030000
|
||||||
|
if (inp && ref && inp->size[0] != 1)
|
||||||
|
{
|
||||||
|
// Myriad plugin supports only batch size 1. Slice a single sample.
|
||||||
|
if (inp->size[0] == ref->size[0])
|
||||||
|
{
|
||||||
|
std::vector<cv::Range> range(inp->dims, Range::all());
|
||||||
|
range[0] = Range(0, 1);
|
||||||
|
*inp = inp->operator()(range);
|
||||||
|
|
||||||
|
range = std::vector<cv::Range>(ref->dims, Range::all());
|
||||||
|
range[0] = Range(0, 1);
|
||||||
|
*ref = ref->operator()(range);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw SkipTestException("Myriad plugin supports only batch size 1");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (inp && ref && inp->dims == 4 && ref->dims == 4 &&
|
||||||
|
inp->size[0] != 1 && inp->size[0] != ref->size[0])
|
||||||
|
throw SkipTestException("Inconsistent batch size of input and output blobs for Myriad plugin");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void checkBackend(Mat* inp = 0, Mat* ref = 0)
|
||||||
|
{
|
||||||
|
checkBackend(backend, target, inp, ref);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -558,7 +558,9 @@ TEST_P(Test_Caffe_layers, FasterRCNN_Proposal)
|
|||||||
normAssert(outs[i].rowRange(0, numDets), ref);
|
normAssert(outs[i].rowRange(0, numDets), ref);
|
||||||
|
|
||||||
if (numDets < outs[i].size[0])
|
if (numDets < outs[i].size[0])
|
||||||
|
{
|
||||||
EXPECT_EQ(countNonZero(outs[i].rowRange(numDets, outs[i].size[0])), 0);
|
EXPECT_EQ(countNonZero(outs[i].rowRange(numDets, outs[i].size[0])), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,9 +140,9 @@ TEST(LayerFactory, custom_layers)
|
|||||||
net.setPreferableBackend(DNN_BACKEND_OPENCV);
|
net.setPreferableBackend(DNN_BACKEND_OPENCV);
|
||||||
Mat output = net.forward();
|
Mat output = net.forward();
|
||||||
|
|
||||||
if (i == 0) EXPECT_EQ(output.at<float>(0), 1);
|
if (i == 0) { EXPECT_EQ(output.at<float>(0), 1); }
|
||||||
else if (i == 1) EXPECT_EQ(output.at<float>(0), 2);
|
else if (i == 1) { EXPECT_EQ(output.at<float>(0), 2); }
|
||||||
else if (i == 2) EXPECT_EQ(output.at<float>(0), 1);
|
else if (i == 2) { EXPECT_EQ(output.at<float>(0), 1); }
|
||||||
}
|
}
|
||||||
LayerFactory::unregisterLayer("CustomType");
|
LayerFactory::unregisterLayer("CustomType");
|
||||||
}
|
}
|
||||||
|
@ -118,8 +118,8 @@ TEST_P(Test_ONNX_layers, Transpose)
|
|||||||
|
|
||||||
TEST_P(Test_ONNX_layers, Multiplication)
|
TEST_P(Test_ONNX_layers, Multiplication)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 ||
|
if ((backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16) ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
testONNXModels("mul");
|
testONNXModels("mul");
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ TEST_P(Test_ONNX_nets, ResNet101_DUC_HDC)
|
|||||||
TEST_P(Test_ONNX_nets, TinyYolov2)
|
TEST_P(Test_ONNX_nets, TinyYolov2)
|
||||||
{
|
{
|
||||||
if (cvtest::skipUnstableTests ||
|
if (cvtest::skipUnstableTests ||
|
||||||
backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) {
|
(backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))) {
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
}
|
}
|
||||||
// output range: [-11; 8]
|
// output range: [-11; 8]
|
||||||
|
@ -49,100 +49,4 @@
|
|||||||
#include "opencv2/dnn.hpp"
|
#include "opencv2/dnn.hpp"
|
||||||
#include "test_common.hpp"
|
#include "test_common.hpp"
|
||||||
|
|
||||||
namespace opencv_test {
|
|
||||||
using namespace cv::dnn;
|
|
||||||
|
|
||||||
static testing::internal::ParamGenerator<Target> availableDnnTargets()
|
|
||||||
{
|
|
||||||
static std::vector<Target> targets;
|
|
||||||
if (targets.empty())
|
|
||||||
{
|
|
||||||
targets.push_back(DNN_TARGET_CPU);
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
if (cv::ocl::useOpenCL())
|
|
||||||
targets.push_back(DNN_TARGET_OPENCL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return testing::ValuesIn(targets);
|
|
||||||
}
|
|
||||||
|
|
||||||
class DNNTestLayer : public TestWithParam<tuple<Backend, Target> >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
dnn::Backend backend;
|
|
||||||
dnn::Target target;
|
|
||||||
double default_l1, default_lInf;
|
|
||||||
|
|
||||||
DNNTestLayer()
|
|
||||||
{
|
|
||||||
backend = (dnn::Backend)(int)get<0>(GetParam());
|
|
||||||
target = (dnn::Target)(int)get<1>(GetParam());
|
|
||||||
getDefaultThresholds(backend, target, &default_l1, &default_lInf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void getDefaultThresholds(int backend, int target, double* l1, double* lInf)
|
|
||||||
{
|
|
||||||
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
|
|
||||||
{
|
|
||||||
*l1 = 4e-3;
|
|
||||||
*lInf = 2e-2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*l1 = 1e-5;
|
|
||||||
*lInf = 1e-4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void checkBackend(int backend, int target, Mat* inp = 0, Mat* ref = 0)
|
|
||||||
{
|
|
||||||
if (backend == DNN_BACKEND_OPENCV && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
|
|
||||||
{
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
if (!cv::ocl::useOpenCL())
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
throw SkipTestException("OpenCL is not available/disabled in OpenCV");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
|
||||||
{
|
|
||||||
if (!checkMyriadTarget())
|
|
||||||
{
|
|
||||||
throw SkipTestException("Myriad is not available/disabled in OpenCV");
|
|
||||||
}
|
|
||||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE < 2018030000
|
|
||||||
if (inp && ref && inp->size[0] != 1)
|
|
||||||
{
|
|
||||||
// Myriad plugin supports only batch size 1. Slice a single sample.
|
|
||||||
if (inp->size[0] == ref->size[0])
|
|
||||||
{
|
|
||||||
std::vector<cv::Range> range(inp->dims, Range::all());
|
|
||||||
range[0] = Range(0, 1);
|
|
||||||
*inp = inp->operator()(range);
|
|
||||||
|
|
||||||
range = std::vector<cv::Range>(ref->dims, Range::all());
|
|
||||||
range[0] = Range(0, 1);
|
|
||||||
*ref = ref->operator()(range);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw SkipTestException("Myriad plugin supports only batch size 1");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (inp && ref && inp->dims == 4 && ref->dims == 4 &&
|
|
||||||
inp->size[0] != 1 && inp->size[0] != ref->size[0])
|
|
||||||
throw SkipTestException("Inconsistent batch size of input and output blobs for Myriad plugin");
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void checkBackend(Mat* inp = 0, Mat* ref = 0)
|
|
||||||
{
|
|
||||||
checkBackend(backend, target, inp, ref);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,7 +101,9 @@ public:
|
|||||||
|
|
||||||
string dataConfig;
|
string dataConfig;
|
||||||
if (hasText)
|
if (hasText)
|
||||||
|
{
|
||||||
ASSERT_TRUE(readFileInMemory(netConfig, dataConfig));
|
ASSERT_TRUE(readFileInMemory(netConfig, dataConfig));
|
||||||
|
}
|
||||||
|
|
||||||
net = readNetFromTensorflow(dataModel.c_str(), dataModel.size(),
|
net = readNetFromTensorflow(dataModel.c_str(), dataModel.size(),
|
||||||
dataConfig.c_str(), dataConfig.size());
|
dataConfig.c_str(), dataConfig.size());
|
||||||
|
@ -423,7 +423,7 @@ class CppHeaderParser(object):
|
|||||||
# it means class methods, not instance methods
|
# it means class methods, not instance methods
|
||||||
decl_str = self.batch_replace(decl_str, [("static inline", ""), ("inline", ""),\
|
decl_str = self.batch_replace(decl_str, [("static inline", ""), ("inline", ""),\
|
||||||
("CV_EXPORTS_W", ""), ("CV_EXPORTS", ""), ("CV_CDECL", ""), ("CV_WRAP ", " "), ("CV_INLINE", ""),
|
("CV_EXPORTS_W", ""), ("CV_EXPORTS", ""), ("CV_CDECL", ""), ("CV_WRAP ", " "), ("CV_INLINE", ""),
|
||||||
("CV_DEPRECATED", "")]).strip()
|
("CV_DEPRECATED", ""), ("CV_DEPRECATED_EXTERNAL", "")]).strip()
|
||||||
|
|
||||||
|
|
||||||
if decl_str.strip().startswith('virtual'):
|
if decl_str.strip().startswith('virtual'):
|
||||||
|
Loading…
Reference in New Issue
Block a user