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
9ff1c39d
Commit
9ff1c39d
authored
Dec 05, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnn: fixup available backends/targets
parent
fe459c82
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
dnn.cpp
modules/dnn/src/dnn.cpp
+13
-10
test_backends.cpp
modules/dnn/test/test_backends.cpp
+1
-1
test_common.hpp
modules/dnn/test/test_common.hpp
+6
-0
No files found.
modules/dnn/src/dnn.cpp
View file @
9ff1c39d
...
@@ -74,6 +74,16 @@ static int PARAM_DNN_BACKEND_DEFAULT = (int)utils::getConfigurationParameterSize
...
@@ -74,6 +74,16 @@ static int PARAM_DNN_BACKEND_DEFAULT = (int)utils::getConfigurationParameterSize
#endif
#endif
);
);
// Additional checks (slowdowns execution!)
static
bool
DNN_CHECK_NAN_INF
=
utils
::
getConfigurationParameterBool
(
"OPENCV_DNN_CHECK_NAN_INF"
,
false
);
static
bool
DNN_CHECK_NAN_INF_DUMP
=
utils
::
getConfigurationParameterBool
(
"OPENCV_DNN_CHECK_NAN_INF_DUMP"
,
false
);
static
bool
DNN_CHECK_NAN_INF_RAISE_ERROR
=
utils
::
getConfigurationParameterBool
(
"OPENCV_DNN_CHECK_NAN_INF_RAISE_ERROR"
,
false
);
using
std
::
vector
;
using
std
::
map
;
using
std
::
make_pair
;
using
std
::
set
;
//==================================================================================================
//==================================================================================================
class
BackendRegistry
class
BackendRegistry
...
@@ -160,6 +170,9 @@ std::vector< std::pair<Backend, Target> > getAvailableBackends()
...
@@ -160,6 +170,9 @@ std::vector< std::pair<Backend, Target> > getAvailableBackends()
std
::
vector
<
Target
>
getAvailableTargets
(
Backend
be
)
std
::
vector
<
Target
>
getAvailableTargets
(
Backend
be
)
{
{
if
(
be
==
DNN_BACKEND_DEFAULT
)
be
=
(
Backend
)
PARAM_DNN_BACKEND_DEFAULT
;
std
::
vector
<
Target
>
result
;
std
::
vector
<
Target
>
result
;
const
BackendRegistry
::
BackendsList
all_backends
=
getAvailableBackends
();
const
BackendRegistry
::
BackendsList
all_backends
=
getAvailableBackends
();
for
(
BackendRegistry
::
BackendsList
::
const_iterator
i
=
all_backends
.
begin
();
i
!=
all_backends
.
end
();
++
i
)
for
(
BackendRegistry
::
BackendsList
::
const_iterator
i
=
all_backends
.
begin
();
i
!=
all_backends
.
end
();
++
i
)
...
@@ -172,16 +185,6 @@ std::vector<Target> getAvailableTargets(Backend be)
...
@@ -172,16 +185,6 @@ std::vector<Target> getAvailableTargets(Backend be)
//==================================================================================================
//==================================================================================================
// Additional checks (slowdowns execution!)
static
bool
DNN_CHECK_NAN_INF
=
utils
::
getConfigurationParameterBool
(
"OPENCV_DNN_CHECK_NAN_INF"
,
false
);
static
bool
DNN_CHECK_NAN_INF_DUMP
=
utils
::
getConfigurationParameterBool
(
"OPENCV_DNN_CHECK_NAN_INF_DUMP"
,
false
);
static
bool
DNN_CHECK_NAN_INF_RAISE_ERROR
=
utils
::
getConfigurationParameterBool
(
"OPENCV_DNN_CHECK_NAN_INF_RAISE_ERROR"
,
false
);
using
std
::
vector
;
using
std
::
map
;
using
std
::
make_pair
;
using
std
::
set
;
namespace
namespace
{
{
typedef
std
::
vector
<
MatShape
>
ShapesVec
;
typedef
std
::
vector
<
MatShape
>
ShapesVec
;
...
...
modules/dnn/test/test_backends.cpp
View file @
9ff1c39d
...
@@ -292,6 +292,6 @@ TEST_P(DNNTestNetwork, FastNeuralStyle_eccv16)
...
@@ -292,6 +292,6 @@ TEST_P(DNNTestNetwork, FastNeuralStyle_eccv16)
processNet
(
"dnn/fast_neural_style_eccv16_starry_night.t7"
,
""
,
inp
,
""
,
""
,
l1
,
lInf
);
processNet
(
"dnn/fast_neural_style_eccv16_starry_night.t7"
,
""
,
inp
,
""
,
""
,
l1
,
lInf
);
}
}
INSTANTIATE_TEST_CASE_P
(
/*nothing*/
,
DNNTestNetwork
,
dnnBackendsAndTargets
());
INSTANTIATE_TEST_CASE_P
(
/*nothing*/
,
DNNTestNetwork
,
dnnBackendsAndTargets
(
true
,
true
,
false
));
}}
// namespace
}}
// namespace
modules/dnn/test/test_common.hpp
View file @
9ff1c39d
...
@@ -236,8 +236,14 @@ testing::internal::ParamGenerator< tuple<Backend, Target> > dnnBackendsAndTarget
...
@@ -236,8 +236,14 @@ testing::internal::ParamGenerator< tuple<Backend, Target> > dnnBackendsAndTarget
{
{
available
=
getAvailableTargets
(
DNN_BACKEND_OPENCV
);
available
=
getAvailableTargets
(
DNN_BACKEND_OPENCV
);
for
(
std
::
vector
<
Target
>::
const_iterator
i
=
available
.
begin
();
i
!=
available
.
end
();
++
i
)
for
(
std
::
vector
<
Target
>::
const_iterator
i
=
available
.
begin
();
i
!=
available
.
end
();
++
i
)
{
if
(
!
withCpuOCV
&&
*
i
==
DNN_TARGET_CPU
)
continue
;
targets
.
push_back
(
make_tuple
(
DNN_BACKEND_OPENCV
,
*
i
));
targets
.
push_back
(
make_tuple
(
DNN_BACKEND_OPENCV
,
*
i
));
}
}
}
if
(
targets
.
empty
())
// validate at least CPU mode
targets
.
push_back
(
make_tuple
(
DNN_BACKEND_OPENCV
,
DNN_TARGET_CPU
));
return
testing
::
ValuesIn
(
targets
);
return
testing
::
ValuesIn
(
targets
);
}
}
...
...
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