Skip to content

Commit e8d94ea

Browse files
committed
Unite deep learning object detection samples
1 parent 667f5b6 commit e8d94ea

14 files changed

+555
-995
lines changed

doc/tutorials/dnn/dnn_yolo/dnn_yolo.markdown

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,26 @@ VIDEO DEMO:
1818
Source Code
1919
-----------
2020

21-
The latest version of sample source code can be downloaded [here](https://github.com/opencv/opencv/blob/master/samples/dnn/yolo_object_detection.cpp).
21+
Use a universal sample for object detection models written
22+
[in C++](https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.cpp) and
23+
[in Python](https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.py) languages
2224

23-
@include dnn/yolo_object_detection.cpp
24-
25-
How to compile in command line with pkg-config
26-
----------------------------------------------
27-
28-
@code{.bash}
29-
30-
# g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` yolo_object_detection.cpp -o yolo_object_detection
31-
32-
@endcode
25+
Usage examples
26+
--------------
3327

3428
Execute in webcam:
3529

3630
@code{.bash}
3731

38-
$ yolo_object_detection -camera_device=0 -cfg=[PATH-TO-DARKNET]/cfg/yolo.cfg -model=[PATH-TO-DARKNET]/yolo.weights -class_names=[PATH-TO-DARKNET]/data/coco.names
39-
40-
@endcode
41-
42-
Execute with image:
43-
44-
@code{.bash}
45-
46-
$ yolo_object_detection -source=[PATH-IMAGE] -cfg=[PATH-TO-DARKNET]/cfg/yolo.cfg -model=[PATH-TO-DARKNET]/yolo.weights -class_names=[PATH-TO-DARKNET]/data/coco.names
32+
$ 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
4733

4834
@endcode
4935

50-
Execute in video file:
36+
Execute with image or video file:
5137

5238
@code{.bash}
5339

54-
$ yolo_object_detection -source=[PATH-TO-VIDEO] -cfg=[PATH-TO-DARKNET]/cfg/yolo.cfg -model=[PATH-TO-DARKNET]/yolo.weights -class_names=[PATH-TO-DARKNET]/data/coco.names
40+
$ 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]
5541

5642
@endcode
5743

modules/dnn/include/opencv2/dnn/dnn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
222222
/** @brief Returns index of output blob in output array.
223223
* @see inputNameToIndex()
224224
*/
225-
virtual int outputNameToIndex(String outputName);
225+
CV_WRAP virtual int outputNameToIndex(String outputName);
226226

227227
/**
228228
* @brief Ask layer if it support specific backend for doing computations.

samples/dnn/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# OpenCV deep learning module samples
2+
3+
## Model Zoo
4+
5+
### Object detection
6+
7+
| Model | Scale | Size WxH| Mean subtraction | Channels order |
8+
|---------------|-------|-----------|--------------------|-------|
9+
| [MobileNet-SSD, Caffe](https://github.com/chuanqi305/MobileNet-SSD/) | `0.00784 (2/255)` | `300x300` | `127.5 127.5 127.5` | BGR |
10+
| [OpenCV face detector](https://github.com/opencv/opencv/tree/master/samples/dnn/face_detector) | `1.0` | `300x300` | `104 177 123` | BGR |
11+
| [SSDs from TensorFlow](https://github.com/tensorflow/models/tree/master/research/object_detection/) | `0.00784 (2/255)` | `300x300` | `127.5 127.5 127.5` | RGB |
12+
| [YOLO](https://pjreddie.com/darknet/yolo/) | `0.00392 (1/255)` | `416x416` | `0 0 0` | RGB |
13+
| [VGG16-SSD](https://github.com/weiliu89/caffe/tree/ssd) | `1.0` | `300x300` | `104 117 123` | BGR |
14+
| [Faster-RCNN](https://github.com/rbgirshick/py-faster-rcnn) | `1.0` | `800x600` | `102.9801, 115.9465, 122.7717` | BGR |
15+
| [R-FCN](https://github.com/YuwenXiong/py-R-FCN) | `1.0` | `800x600` | `102.9801 115.9465 122.7717` | BGR |
16+
17+
## References
18+
* [Models downloading script](https://github.com/opencv/opencv_extra/blob/master/testdata/dnn/download_models.py)
19+
* [Configuration files adopted for OpenCV](https://github.com/opencv/opencv_extra/tree/master/testdata/dnn)
20+
* [How to import models from TensorFlow Object Detection API](https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API)

samples/dnn/faster_rcnn.cpp

Lines changed: 0 additions & 93 deletions
This file was deleted.

samples/dnn/mobilenet_ssd_python.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)