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
538fd423
Commit
538fd423
authored
Mar 12, 2018
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for Scalar arguments at CommandLineParser
parent
130546e1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
9 deletions
+33
-9
dnn_yolo.markdown
doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown
+1
-1
test_utils.cpp
modules/core/test/test_utils.cpp
+22
-0
all_layers.hpp
modules/dnn/include/opencv2/dnn/all_layers.hpp
+1
-1
dnn.hpp
modules/dnn/include/opencv2/dnn/dnn.hpp
+2
-2
dnn.cpp
modules/dnn/src/dnn.cpp
+6
-4
recurrent_layers.cpp
modules/dnn/src/layers/recurrent_layers.cpp
+1
-1
No files found.
doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown
View file @
538fd423
...
...
@@ -37,7 +37,7 @@ Execute with image or video file:
@code{.bash}
$ example_dnn_object_detection --config=
[
PATH-TO-DARKNET
]
/cfg/yolo.cfg --model=
[
PATH-TO-DARKNET
]
/yolo.weights --classes=object_detection_classes_pascal_voc.txt --width=416 --height=416 --scale=0.00392 --input
[
PATH-TO-IMAGE-OR-VIDEO-FILE
]
$ example_dnn_object_detection --config=
[
PATH-TO-DARKNET
]
/cfg/yolo.cfg --model=
[
PATH-TO-DARKNET
]
/yolo.weights --classes=object_detection_classes_pascal_voc.txt --width=416 --height=416 --scale=0.00392 --input
=
[
PATH-TO-IMAGE-OR-VIDEO-FILE
]
@endcode
...
...
modules/core/test/test_utils.cpp
View file @
538fd423
...
...
@@ -261,4 +261,26 @@ TEST(AutoBuffer, allocate_test)
EXPECT_EQ
(
6u
,
abuf
.
size
());
}
TEST
(
CommandLineParser
,
testScalar
)
{
static
const
char
*
const
keys3
=
"{ s0 | 3 4 5 | default scalar }"
"{ s1 | | single value scalar }"
"{ s2 | | two values scalar (default with zeros) }"
"{ s3 | | three values scalar }"
"{ s4 | | four values scalar }"
"{ s5 | | five values scalar }"
;
const
char
*
argv
[]
=
{
"<bin>"
,
"--s1=1.1"
,
"--s3=1.1 2.2 3"
,
"--s4=-4.2 1 0 3"
,
"--s5=5 -4 3 2 1"
};
const
int
argc
=
5
;
CommandLineParser
parser
(
argc
,
argv
,
keys3
);
EXPECT_EQ
(
parser
.
get
<
Scalar
>
(
"s0"
),
Scalar
(
3
,
4
,
5
));
EXPECT_EQ
(
parser
.
get
<
Scalar
>
(
"s1"
),
Scalar
(
1.1
));
EXPECT_EQ
(
parser
.
get
<
Scalar
>
(
"s2"
),
Scalar
(
0
));
EXPECT_EQ
(
parser
.
get
<
Scalar
>
(
"s3"
),
Scalar
(
1.1
,
2.2
,
3
));
EXPECT_EQ
(
parser
.
get
<
Scalar
>
(
"s4"
),
Scalar
(
-
4.2
,
1
,
0
,
3
));
EXPECT_EQ
(
parser
.
get
<
Scalar
>
(
"s5"
),
Scalar
(
5
,
-
4
,
3
,
2
));
}
}}
// namespace
modules/dnn/include/opencv2/dnn/all_layers.hpp
View file @
538fd423
...
...
@@ -153,7 +153,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
*/
int
inputNameToIndex
(
String
inputName
);
int
outputNameToIndex
(
String
outputName
);
int
outputNameToIndex
(
const
String
&
outputName
);
};
/** @brief Classical recurrent layer
...
...
modules/dnn/include/opencv2/dnn/dnn.hpp
View file @
538fd423
...
...
@@ -222,7 +222,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
/** @brief Returns index of output blob in output array.
* @see inputNameToIndex()
*/
CV_WRAP
virtual
int
outputNameToIndex
(
String
outputName
);
CV_WRAP
virtual
int
outputNameToIndex
(
const
String
&
outputName
);
/**
* @brief Ask layer if it support specific backend for doing computations.
...
...
@@ -704,7 +704,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
* @ref readNetFromTorch or @ref readNetFromDarknet. An order of @p model and @p config
* arguments does not matter.
*/
CV_EXPORTS_W
Net
readNet
(
String
model
,
String
config
=
""
,
String
framework
=
""
);
CV_EXPORTS_W
Net
readNet
(
const
String
&
model
,
const
String
&
config
=
""
,
const
String
&
framework
=
""
);
/** @brief Loads blob which was serialized as torch.Tensor object of Torch7 framework.
* @warning This function has the same limitations as readNetFromTorch().
...
...
modules/dnn/src/dnn.cpp
View file @
538fd423
...
...
@@ -398,7 +398,7 @@ struct DataLayer : public Layer
void
forward
(
std
::
vector
<
Mat
*>&
,
std
::
vector
<
Mat
>&
,
std
::
vector
<
Mat
>
&
)
{}
void
forward
(
InputArrayOfArrays
inputs
,
OutputArrayOfArrays
outputs
,
OutputArrayOfArrays
internals
)
{}
int
outputNameToIndex
(
String
tgtName
)
int
outputNameToIndex
(
const
String
&
tgtName
)
{
int
idx
=
(
int
)(
std
::
find
(
outNames
.
begin
(),
outNames
.
end
(),
tgtName
)
-
outNames
.
begin
());
return
(
idx
<
(
int
)
outNames
.
size
())
?
idx
:
-
1
;
...
...
@@ -2513,7 +2513,7 @@ int Layer::inputNameToIndex(String)
return
-
1
;
}
int
Layer
::
outputNameToIndex
(
String
)
int
Layer
::
outputNameToIndex
(
const
String
&
)
{
return
-
1
;
}
...
...
@@ -2805,9 +2805,11 @@ BackendWrapper::BackendWrapper(const Ptr<BackendWrapper>& base, const MatShape&
BackendWrapper
::~
BackendWrapper
()
{}
Net
readNet
(
String
model
,
String
config
,
String
framework
)
Net
readNet
(
const
String
&
_model
,
const
String
&
_config
,
const
String
&
_
framework
)
{
framework
=
framework
.
toLowerCase
();
String
framework
=
_framework
.
toLowerCase
();
String
model
=
_model
;
String
config
=
_config
;
const
std
::
string
modelExt
=
model
.
substr
(
model
.
rfind
(
'.'
)
+
1
);
const
std
::
string
configExt
=
config
.
substr
(
config
.
rfind
(
'.'
)
+
1
);
if
(
framework
==
"caffe"
||
modelExt
==
"caffemodel"
||
configExt
==
"caffemodel"
||
...
...
modules/dnn/src/layers/recurrent_layers.cpp
View file @
538fd423
...
...
@@ -355,7 +355,7 @@ int LSTMLayer::inputNameToIndex(String inputName)
return
-
1
;
}
int
LSTMLayer
::
outputNameToIndex
(
String
outputName
)
int
LSTMLayer
::
outputNameToIndex
(
const
String
&
outputName
)
{
if
(
outputName
.
toLowerCase
()
==
"h"
)
return
0
;
...
...
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