Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
0a61ebdd
Commit
0a61ebdd
authored
Mar 07, 2018
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace DNNTarget and DNNBackend in tests
parent
e1c32375
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
61 deletions
+27
-61
test_backends.cpp
modules/dnn/test/test_backends.cpp
+0
-3
test_caffe_importer.cpp
modules/dnn/test/test_caffe_importer.cpp
+4
-21
test_precomp.hpp
modules/dnn/test/test_precomp.hpp
+19
-0
test_tf_importer.cpp
modules/dnn/test/test_tf_importer.cpp
+2
-19
test_torch_importer.cpp
modules/dnn/test/test_torch_importer.cpp
+2
-18
No files found.
modules/dnn/test/test_backends.cpp
View file @
0a61ebdd
...
...
@@ -10,9 +10,6 @@
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
)
{
...
...
modules/dnn/test/test_caffe_importer.cpp
View file @
0a61ebdd
...
...
@@ -42,26 +42,9 @@
#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
)
{
...
...
@@ -132,7 +115,7 @@ TEST_P(Reproducibility_AlexNet, Accuracy)
normAssert
(
ref
,
out
);
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Reproducibility_AlexNet
,
Combine
(
testing
::
Bool
(),
available
Backend
s
()));
INSTANTIATE_TEST_CASE_P
(
/**/
,
Reproducibility_AlexNet
,
Combine
(
testing
::
Bool
(),
available
DnnTarget
s
()));
#if !defined(_WIN32) || defined(_WIN64)
TEST
(
Reproducibility_FCN
,
Accuracy
)
...
...
@@ -232,7 +215,7 @@ TEST_P(Reproducibility_MobileNet_SSD, 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
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Reproducibility_MobileNet_SSD
,
available
DnnTarget
s
());
typedef
testing
::
TestWithParam
<
DNNTarget
>
Reproducibility_ResNet50
;
TEST_P
(
Reproducibility_ResNet50
,
Accuracy
)
...
...
@@ -263,7 +246,7 @@ TEST_P(Reproducibility_ResNet50, Accuracy)
normAssert
(
ref
,
out_umats
[
0
],
"out_umat_vector"
);
}
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Reproducibility_ResNet50
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Reproducibility_ResNet50
,
available
DnnTarget
s
());
typedef
testing
::
TestWithParam
<
DNNTarget
>
Reproducibility_SqueezeNet_v1_1
;
TEST_P
(
Reproducibility_SqueezeNet_v1_1
,
Accuracy
)
...
...
@@ -291,7 +274,7 @@ 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
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Reproducibility_SqueezeNet_v1_1
,
available
DnnTarget
s
());
TEST
(
Reproducibility_AlexNet_fp16
,
Accuracy
)
{
...
...
modules/dnn/test/test_precomp.hpp
View file @
0a61ebdd
...
...
@@ -44,12 +44,31 @@
#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
modules/dnn/test/test_tf_importer.cpp
View file @
0a61ebdd
...
...
@@ -11,8 +11,6 @@ Test for Tensorflow models loading
#include "test_precomp.hpp"
#include "npy_blob.hpp"
#include <opencv2/core/ocl.hpp>
#include <opencv2/ts/ocl_test.hpp>
namespace
opencv_test
{
...
...
@@ -26,21 +24,6 @@ static std::string _tf(TString filename)
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
;
...
...
@@ -204,7 +187,7 @@ TEST_P(Test_TensorFlow_layers, reshape)
runTensorFlowNet
(
"flatten"
,
targetId
,
true
);
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_TensorFlow_layers
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_TensorFlow_layers
,
available
DnnTarget
s
());
typedef
testing
::
TestWithParam
<
DNNTarget
>
Test_TensorFlow_nets
;
...
...
@@ -302,7 +285,7 @@ TEST_P(Test_TensorFlow_nets, opencv_face_detector_uint8)
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
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_TensorFlow_nets
,
available
DnnTarget
s
());
TEST
(
Test_TensorFlow
,
defun
)
{
...
...
modules/dnn/test/test_torch_importer.cpp
View file @
0a61ebdd
...
...
@@ -42,7 +42,6 @@
#include "test_precomp.hpp"
#include "npy_blob.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/ts/ocl_test.hpp>
namespace
opencv_test
{
...
...
@@ -62,21 +61,6 @@ static std::string _tf(TStr filename, bool inTorchDir = true)
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
;
...
...
@@ -221,7 +205,7 @@ TEST_P(Test_Torch_layers, net_non_spatial)
runTorchNet
(
"net_non_spatial"
,
GetParam
(),
""
,
false
,
true
);
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_Torch_layers
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_Torch_layers
,
available
DnnTarget
s
());
typedef
testing
::
TestWithParam
<
DNNTarget
>
Test_Torch_nets
;
...
...
@@ -323,7 +307,7 @@ TEST_P(Test_Torch_nets, FastNeuralStyle_accuracy)
}
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_Torch_nets
,
available
Backend
s
());
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_Torch_nets
,
available
DnnTarget
s
());
// TODO: fix OpenCL and add to the rest of tests
TEST
(
Torch_Importer
,
run_paralel
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment