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
959a12cb
Commit
959a12cb
authored
May 09, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11478 from cabelo:select-device-dnn
parents
2025650d
1b3e0783
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
14 deletions
+16
-14
dnn_yolo.markdown
doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown
+2
-2
object_detection.cpp
samples/dnn/object_detection.cpp
+5
-4
openpose.cpp
samples/dnn/openpose.cpp
+4
-4
segmentation.cpp
samples/dnn/segmentation.cpp
+5
-4
No files found.
doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown
View file @
959a12cb
...
@@ -29,7 +29,7 @@ Execute in webcam:
...
@@ -29,7 +29,7 @@ Execute in webcam:
@code{.bash}
@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
$ 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
--rgb
@endcode
@endcode
...
@@ -37,7 +37,7 @@ Execute with image or video file:
...
@@ -37,7 +37,7 @@ Execute with image or video file:
@code{.bash}
@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
]
--rgb
@endcode
@endcode
...
...
samples/dnn/object_detection.cpp
View file @
959a12cb
...
@@ -7,12 +7,13 @@
...
@@ -7,12 +7,13 @@
const
char
*
keys
=
const
char
*
keys
=
"{ help h | | Print help message. }"
"{ help h | | Print help message. }"
"{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
"{ device | 0 | camera device number. }"
"{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera. }"
"{ model m | | Path to a binary file of model contains trained weights. "
"{ model m | | Path to a binary file of model contains trained weights. "
"It could be a file with extensions .caffemodel (Caffe), "
"It could be a file with extensions .caffemodel (Caffe), "
".pb (TensorFlow), .t7 or .net (Torch), .weights (Darknet)
}"
".pb (TensorFlow), .t7 or .net (Torch), .weights (Darknet)
.
}"
"{ config c | | Path to a text file of model contains network configuration. "
"{ config c | | Path to a text file of model contains network configuration. "
"It could be a file with extensions .prototxt (Caffe), .pbtxt (TensorFlow), .cfg (Darknet)
}"
"It could be a file with extensions .prototxt (Caffe), .pbtxt (TensorFlow), .cfg (Darknet)
.
}"
"{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }"
"{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }"
"{ classes | | Optional path to a text file with names of classes to label detected objects. }"
"{ classes | | Optional path to a text file with names of classes to label detected objects. }"
"{ mean | | Preprocess input image by subtracting mean values. Mean values should be in BGR order and delimited by spaces. }"
"{ mean | | Preprocess input image by subtracting mean values. Mean values should be in BGR order and delimited by spaces. }"
...
@@ -91,7 +92,7 @@ int main(int argc, char** argv)
...
@@ -91,7 +92,7 @@ int main(int argc, char** argv)
if
(
parser
.
has
(
"input"
))
if
(
parser
.
has
(
"input"
))
cap
.
open
(
parser
.
get
<
String
>
(
"input"
));
cap
.
open
(
parser
.
get
<
String
>
(
"input"
));
else
else
cap
.
open
(
0
);
cap
.
open
(
parser
.
get
<
int
>
(
"device"
)
);
// Process frames.
// Process frames.
Mat
frame
,
blob
;
Mat
frame
,
blob
;
...
...
samples/dnn/openpose.cpp
View file @
959a12cb
...
@@ -61,12 +61,16 @@ int main(int argc, char **argv)
...
@@ -61,12 +61,16 @@ int main(int argc, char **argv)
"{ p proto | | (required) model configuration, e.g. hand/pose.prototxt }"
"{ p proto | | (required) model configuration, e.g. hand/pose.prototxt }"
"{ m model | | (required) model weights, e.g. hand/pose_iter_102000.caffemodel }"
"{ m model | | (required) model weights, e.g. hand/pose_iter_102000.caffemodel }"
"{ i image | | (required) path to image file (containing a single person, or hand) }"
"{ i image | | (required) path to image file (containing a single person, or hand) }"
"{ width | 368 | Preprocess input image by resizing to a specific width. }"
"{ height | 368 | Preprocess input image by resizing to a specific height. }"
"{ t threshold | 0.1 | threshold or confidence value for the heatmap }"
"{ t threshold | 0.1 | threshold or confidence value for the heatmap }"
);
);
String
modelTxt
=
parser
.
get
<
string
>
(
"proto"
);
String
modelTxt
=
parser
.
get
<
string
>
(
"proto"
);
String
modelBin
=
parser
.
get
<
string
>
(
"model"
);
String
modelBin
=
parser
.
get
<
string
>
(
"model"
);
String
imageFile
=
parser
.
get
<
String
>
(
"image"
);
String
imageFile
=
parser
.
get
<
String
>
(
"image"
);
int
W_in
=
parser
.
get
<
int
>
(
"width"
);
int
H_in
=
parser
.
get
<
int
>
(
"height"
);
float
thresh
=
parser
.
get
<
float
>
(
"threshold"
);
float
thresh
=
parser
.
get
<
float
>
(
"threshold"
);
if
(
parser
.
get
<
bool
>
(
"help"
)
||
modelTxt
.
empty
()
||
modelBin
.
empty
()
||
imageFile
.
empty
())
if
(
parser
.
get
<
bool
>
(
"help"
)
||
modelTxt
.
empty
()
||
modelBin
.
empty
()
||
imageFile
.
empty
())
{
{
...
@@ -75,10 +79,6 @@ int main(int argc, char **argv)
...
@@ -75,10 +79,6 @@ int main(int argc, char **argv)
return
0
;
return
0
;
}
}
// fixed input size for the pretrained network
int
W_in
=
368
;
int
H_in
=
368
;
// read the network model
// read the network model
Net
net
=
readNetFromCaffe
(
modelTxt
,
modelBin
);
Net
net
=
readNetFromCaffe
(
modelTxt
,
modelBin
);
...
...
samples/dnn/segmentation.cpp
View file @
959a12cb
...
@@ -7,12 +7,13 @@
...
@@ -7,12 +7,13 @@
const
char
*
keys
=
const
char
*
keys
=
"{ help h | | Print help message. }"
"{ help h | | Print help message. }"
"{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
"{ device | 0 | camera device number. }"
"{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera. }"
"{ model m | | Path to a binary file of model contains trained weights. "
"{ model m | | Path to a binary file of model contains trained weights. "
"It could be a file with extensions .caffemodel (Caffe), "
"It could be a file with extensions .caffemodel (Caffe), "
".pb (TensorFlow), .t7 or .net (Torch), .weights (Darknet) }"
".pb (TensorFlow), .t7 or .net (Torch), .weights (Darknet)
.
}"
"{ config c | | Path to a text file of model contains network configuration. "
"{ config c | | Path to a text file of model contains network configuration. "
"It could be a file with extensions .prototxt (Caffe), .pbtxt (TensorFlow), .cfg (Darknet) }"
"It could be a file with extensions .prototxt (Caffe), .pbtxt (TensorFlow), .cfg (Darknet)
.
}"
"{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }"
"{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }"
"{ classes | | Optional path to a text file with names of classes. }"
"{ classes | | Optional path to a text file with names of classes. }"
"{ colors | | Optional path to a text file with colors for an every class. "
"{ colors | | Optional path to a text file with colors for an every class. "
...
@@ -111,7 +112,7 @@ int main(int argc, char** argv)
...
@@ -111,7 +112,7 @@ int main(int argc, char** argv)
if
(
parser
.
has
(
"input"
))
if
(
parser
.
has
(
"input"
))
cap
.
open
(
parser
.
get
<
String
>
(
"input"
));
cap
.
open
(
parser
.
get
<
String
>
(
"input"
));
else
else
cap
.
open
(
0
);
cap
.
open
(
parser
.
get
<
int
>
(
"device"
)
);
//! [Open a video file or an image file or a camera stream]
//! [Open a video file or an image file or a camera stream]
// Process frames.
// Process frames.
...
...
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