dnn(test): reuse test/test_common.hpp, eliminate dead code warning

pull/11695/head
Alexander Alekhin 7 years ago
parent b2cff44084
commit 6816495bee
  1. 24
      modules/dnn/perf/perf_net.cpp
  2. 15
      modules/dnn/test/test_common.hpp

@ -10,6 +10,8 @@
#include "opencv2/dnn/shape_utils.hpp"
#include "../test/test_common.hpp"
namespace opencv_test {
CV_ENUM(DNNBackend, DNN_BACKEND_DEFAULT, DNN_BACKEND_HALIDE, DNN_BACKEND_INFERENCE_ENGINE)
@ -29,28 +31,6 @@ public:
target = (dnn::Target)(int)get<1>(GetParam());
}
static bool checkMyriadTarget()
{
#ifndef HAVE_INF_ENGINE
return false;
#endif
cv::dnn::Net net;
cv::dnn::LayerParams lp;
net.addLayerToPrev("testLayer", "Identity", lp);
net.setPreferableBackend(cv::dnn::DNN_BACKEND_INFERENCE_ENGINE);
net.setPreferableTarget(cv::dnn::DNN_TARGET_MYRIAD);
net.setInput(cv::Mat::zeros(1, 1, CV_32FC1));
try
{
net.forward();
}
catch(...)
{
return false;
}
return true;
}
void processNet(std::string weights, std::string proto, std::string halide_scheduler,
const Mat& input, const std::string& outputLayer = "")
{

@ -42,12 +42,12 @@
#ifndef __OPENCV_TEST_COMMON_HPP__
#define __OPENCV_TEST_COMMON_HPP__
inline const std::string &getOpenCVExtraDir()
static inline const std::string &getOpenCVExtraDir()
{
return cvtest::TS::ptr()->get_data_path();
}
inline void normAssert(cv::InputArray ref, cv::InputArray test, const char *comment = "",
static inline void normAssert(cv::InputArray ref, cv::InputArray test, const char *comment = "",
double l1 = 0.00001, double lInf = 0.0001)
{
double normL1 = cvtest::norm(ref, test, cv::NORM_L1) / ref.getMat().total();
@ -74,7 +74,7 @@ static std::vector<cv::Rect2d> matToBoxes(const cv::Mat& m)
return boxes;
}
inline void normAssertDetections(const std::vector<int>& refClassIds,
static inline void normAssertDetections(const std::vector<int>& refClassIds,
const std::vector<float>& refScores,
const std::vector<cv::Rect2d>& refBoxes,
const std::vector<int>& testClassIds,
@ -128,7 +128,7 @@ inline void normAssertDetections(const std::vector<int>& refClassIds,
// For SSD-based object detection networks which produce output of shape 1x1xNx7
// where N is a number of detections and an every detection is represented by
// a vector [batchId, classId, confidence, left, top, right, bottom].
inline void normAssertDetections(cv::Mat ref, cv::Mat out, const char *comment = "",
static inline void normAssertDetections(cv::Mat ref, cv::Mat out, const char *comment = "",
double confThreshold = 0.0, double scores_diff = 1e-5,
double boxes_iou_diff = 1e-4)
{
@ -147,11 +147,11 @@ inline void normAssertDetections(cv::Mat ref, cv::Mat out, const char *comment =
testBoxes, comment, confThreshold, scores_diff, boxes_iou_diff);
}
inline bool checkMyriadTarget()
static inline bool checkMyriadTarget()
{
#ifndef HAVE_INF_ENGINE
return false;
#endif
#else
cv::dnn::Net net;
cv::dnn::LayerParams lp;
net.addLayerToPrev("testLayer", "Identity", lp);
@ -167,9 +167,10 @@ inline bool checkMyriadTarget()
return false;
}
return true;
#endif
}
inline bool readFileInMemory(const std::string& filename, std::string& content)
static inline bool readFileInMemory(const std::string& filename, std::string& content)
{
std::ios::openmode mode = std::ios::in | std::ios::binary;
std::ifstream ifs(filename.c_str(), mode);

Loading…
Cancel
Save