dnn(perf): fix and merge Convolution tests#12142
Conversation
| static const tuple<Backend, Target> testBackendsAndTargets[] = { | ||
| tuple<Backend, Target>(DNN_BACKEND_OPENCV, DNN_TARGET_CPU), | ||
| tuple<Backend, Target>(DNN_BACKEND_OPENCV, DNN_TARGET_OPENCL), | ||
| tuple<Backend, Target>(DNN_BACKEND_OPENCV, DNN_TARGET_OPENCL_FP16) |
There was a problem hiding this comment.
I think we can skip OpenCL targets if OpenCL is not available to reduce duplications:
static testing::internal::ParamGenerator<tuple<Backend, Target> > testBackendsAndTargets()
{
static std::vector<tuple<Backend, Target> > targets;
if (targets.empty())
{
targets.push_back(tuple<Backend, Target>(DNN_BACKEND_OPENCV, DNN_TARGET_CPU));
#ifdef HAVE_OPENCL
if (cv::ocl::useOpenCL())
{
targets.push_back(tuple<Backend, Target>(DNN_BACKEND_OPENCV, DNN_TARGET_OPENCL));
targets.push_back(tuple<Backend, Target>(DNN_BACKEND_OPENCV, DNN_TARGET_OPENCL_FP16));
}
#endif
}
return testing::ValuesIn(targets);
}
INSTANTIATE_TEST_CASE_P(/**/, Conv, Combine(
ConvParamID::all(),
testBackendsAndTargets()
));| return testing::ValuesIn(targets); | ||
| } | ||
|
|
||
| static testing::internal::ParamGenerator<tuple<Backend, Target> > dnnBackendsAndTargets() |
There was a problem hiding this comment.
Moved into test_common.hpp (file is shared between accuracy and perf tests)
There was a problem hiding this comment.
@alalek, Could you please also replace DNNBackend and DNNTarget at https://github.com/opencv/opencv/blob/3.4/modules/dnn/perf/perf_net.cpp?
There was a problem hiding this comment.
Done, these changes are placed as a separate commit.
modules/dnn/test/test_common.hpp
Outdated
|
|
||
| using namespace cv::dnn; | ||
|
|
||
| static testing::internal::ParamGenerator<tuple<Backend, Target> > dnnBackendsAndTargets(bool withInferenceEngine = true, bool withHalide = true) |
There was a problem hiding this comment.
May be make withHalide is false by default? There are only two places where it's tested:
opencv/modules/dnn/test/test_halide_layers.cpp
Lines 47 to 64 in 3e027df
opencv/modules/dnn/test/test_backends.cpp
Lines 288 to 301 in 3e027df
Both have no DNN_BACKEND_OPENCV, DNN_TARGET_CPU because it is used as reference for outputs so I think we can apply this method something like this:
dnnBackendsAndTargets(bool withInferenceEngine = true, bool withHalide = false, bool withCpuOCV = true)- OpenCL tests didn't run any OpenCL kernels - use real configuration from existed models (the first 100 cases) - batch size = 1
Configuration list is prepared by using of this patch: alalek@dnn_dump_conv_kernels
update: 4.5.3 - https://github.com/alalek/opencv/commit/dnn_dump_conv_kernels_4.5.3
resolves #10238