namespace opencv_test { namespace {
-CV_ENUM(DNNBackend, DNN_BACKEND_DEFAULT, DNN_BACKEND_HALIDE, DNN_BACKEND_INFERENCE_ENGINE)
-CV_ENUM(DNNTarget, DNN_TARGET_CPU, DNN_TARGET_OPENCL)
-
static void loadNet(const std::string& weights, const std::string& proto,
const std::string& framework, Net* net)
{
#include "test_precomp.hpp"
#include "npy_blob.hpp"
#include <opencv2/dnn/shape_utils.hpp>
-#include <opencv2/core/ocl.hpp>
-#include <opencv2/ts/ocl_test.hpp>
namespace opencv_test { namespace {
-CV_ENUM(DNNTarget, DNN_TARGET_CPU, DNN_TARGET_OPENCL)
-static testing::internal::ParamGenerator<DNNTarget> availableBackends()
-{
- static std::vector<DNNTarget> 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);
-}
-
template<typename TString>
static std::string _tf(TString filename)
{
normAssert(ref, out);
}
-INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_AlexNet, Combine(testing::Bool(), availableBackends()));
+INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_AlexNet, Combine(testing::Bool(), availableDnnTargets()));
#if !defined(_WIN32) || defined(_WIN64)
TEST(Reproducibility_FCN, Accuracy)
normAssert(outBatch.rowRange(0, numDetections), ref);
normAssert(outBatch.rowRange(numDetections, 2 * numDetections).colRange(1, 7), ref.colRange(1, 7));
}
-INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_MobileNet_SSD, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_MobileNet_SSD, availableDnnTargets());
typedef testing::TestWithParam<DNNTarget> Reproducibility_ResNet50;
TEST_P(Reproducibility_ResNet50, Accuracy)
normAssert(ref, out_umats[0], "out_umat_vector");
}
}
-INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_ResNet50, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_ResNet50, availableDnnTargets());
typedef testing::TestWithParam<DNNTarget> Reproducibility_SqueezeNet_v1_1;
TEST_P(Reproducibility_SqueezeNet_v1_1, Accuracy)
Mat ref = blobFromNPY(_tf("squeezenet_v1.1_prob.npy"));
normAssert(ref, out);
}
-INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_SqueezeNet_v1_1, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Reproducibility_SqueezeNet_v1_1, availableDnnTargets());
TEST(Reproducibility_AlexNet_fp16, Accuracy)
{
#include "opencv2/ts.hpp"
#include "opencv2/ts/ts_perf.hpp"
#include "opencv2/core/utility.hpp"
+#include "opencv2/core/ocl.hpp"
#include "opencv2/dnn.hpp"
#include "test_common.hpp"
namespace opencv_test {
using namespace cv::dnn;
+
+CV_ENUM(DNNBackend, DNN_BACKEND_DEFAULT, DNN_BACKEND_HALIDE, DNN_BACKEND_INFERENCE_ENGINE)
+CV_ENUM(DNNTarget, DNN_TARGET_CPU, DNN_TARGET_OPENCL)
+
+static testing::internal::ParamGenerator<DNNTarget> availableDnnTargets()
+{
+ static std::vector<DNNTarget> 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);
+}
+
}
#endif
#include "test_precomp.hpp"
#include "npy_blob.hpp"
-#include <opencv2/core/ocl.hpp>
-#include <opencv2/ts/ocl_test.hpp>
namespace opencv_test
{
return (getOpenCVExtraDir() + "/dnn/") + filename;
}
-CV_ENUM(DNNTarget, DNN_TARGET_CPU, DNN_TARGET_OPENCL)
-static testing::internal::ParamGenerator<DNNTarget> availableBackends()
-{
- static std::vector<DNNTarget> 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);
-}
-
TEST(Test_TensorFlow, read_inception)
{
Net net;
runTensorFlowNet("flatten", targetId, true);
}
-INSTANTIATE_TEST_CASE_P(/**/, Test_TensorFlow_layers, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Test_TensorFlow_layers, availableDnnTargets());
typedef testing::TestWithParam<DNNTarget> Test_TensorFlow_nets;
normAssert(out.reshape(1, out.total() / 7).rowRange(0, 6).colRange(2, 7), ref, "", 2.8e-4, 3.4e-3);
}
-INSTANTIATE_TEST_CASE_P(/**/, Test_TensorFlow_nets, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Test_TensorFlow_nets, availableDnnTargets());
TEST(Test_TensorFlow, defun)
{
#include "test_precomp.hpp"
#include "npy_blob.hpp"
#include <opencv2/dnn/shape_utils.hpp>
-#include <opencv2/ts/ocl_test.hpp>
namespace opencv_test
{
return findDataFile(path, false);
}
-CV_ENUM(DNNTarget, DNN_TARGET_CPU, DNN_TARGET_OPENCL)
-static testing::internal::ParamGenerator<DNNTarget> availableBackends()
-{
- static std::vector<DNNTarget> 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);
-}
-
TEST(Torch_Importer, simple_read)
{
Net net;
runTorchNet("net_non_spatial", GetParam(), "", false, true);
}
-INSTANTIATE_TEST_CASE_P(/**/, Test_Torch_layers, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Test_Torch_layers, availableDnnTargets());
typedef testing::TestWithParam<DNNTarget> Test_Torch_nets;
}
}
-INSTANTIATE_TEST_CASE_P(/**/, Test_Torch_nets, availableBackends());
+INSTANTIATE_TEST_CASE_P(/**/, Test_Torch_nets, availableDnnTargets());
// TODO: fix OpenCL and add to the rest of tests
TEST(Torch_Importer, run_paralel)