Skip to content

Commit d47a495

Browse files
committed
Update with YOLO model in OpenCV
1 parent a072b41 commit d47a495

File tree

7 files changed

+375
-9
lines changed

7 files changed

+375
-9
lines changed

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
[output_video]: ./assets/sample-output.gif "Sample Output"
2+
13
# multi-object-tracker
2-
object detection using deep learning and multi-object tracking
4+
object detection using deep learning and multi-object tracking
35

46
The work here is based on the following literature available:
57
1. http://elvera.nue.tu-berlin.de/files/1517Bochinski2017.pdf
6-
2. https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/
7-
3. https://github.com/Wenuka/correlationTracker
8+
2. Pyimagesearch [1](https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/), [2](https://www.pyimagesearch.com/2018/11/12/yolo-object-detection-with-opencv/)
9+
3. [correlationTracker](https://github.com/Wenuka/correlationTracker)
810
4. [Caffemodel zoo](http://caffe.berkeleyvision.org/model_zoo.html)
911
5. [Caffemodel zoo GitHub](https://github.com/BVLC/caffe/tree/master/models)
12+
6. [YOLO v3](https://pjreddie.com/media/files/papers/YOLOv3.pdf)
1013

1114
Use the caffemodel zoo from the reference [4,5] mentioned above to vary the CNN models and Play around with the codes.
1215

@@ -15,9 +18,27 @@ Pip install for OpenCV (version 3.4.3 or later) is available [here](https://pypi
1518

1619
`pip install opencv-contrib-python`
1720

21+
### Run with YOLO
22+
23+
1. Open the terminal
24+
2. Go to `yolo_dir` in this repository: `cd ./yolo_dir`
25+
3. Run: `sudo chmod +x ./get_yolo.sh`
26+
4. Run: `./get_yolo.sh`
27+
28+
The model and the config files will be downloaded in `./yolo_dir`. These will be used `tracking-yolo-model.ipynb`.
29+
30+
- The video input can be specified in the cell named `Initiate opencv video capture object` in the notebook.
31+
- To make the source as the webcam, use `video_src=0` else provide the path of the video file (example: `video_src="/path/of/videofile.mp4"`).
1832

33+
Example video link: https://flic.kr/p/L6qyxj
1934

35+
Output of the example video:
2036

21-
NOTE: The algorithm shared in this repository was programmed and tested on Windows PC.
37+
![Output Sample][output_video]
2238

2339

40+
### Run with Caffemodel
41+
- You have to use `tracking-caffe-model.ipynb`.
42+
- The model for use is provided in the folder named `caffemodel_dir`.
43+
- The video input can be specified in the cell named `Initiate opencv video capture object` in the notebook.
44+
- To make the source as the webcam, use `video_src=0` else provide the path of the video file (example: `video_src="/path/of/videofile.mp4"`).

assets/sample-output.gif

23.6 MB
Loading
File renamed without changes.

tracking.ipynb renamed to tracking-caffe-model.ipynb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,19 @@
110110
"cell_type": "markdown",
111111
"metadata": {},
112112
"source": [
113-
"##### Loading Object Detector Model\n",
113+
"#### Loading Object Detector Model"
114+
]
115+
},
116+
{
117+
"cell_type": "markdown",
118+
"metadata": {},
119+
"source": [
120+
"##### Face Detection and Tracking\n",
114121
"\n",
115122
"Here, the Face Detection Caffe Model is used.\n",
116123
"\n",
117124
"The files are taken from the following link:\n",
118-
"https://github.com/opencv/opencv_3rdparty/tree/dnn_samples_face_detector_20170830\n"
125+
"https://github.com/opencv/opencv_3rdparty/tree/dnn_samples_face_detector_20170830"
119126
]
120127
},
121128
{
@@ -124,8 +131,8 @@
124131
"metadata": {},
125132
"outputs": [],
126133
"source": [
127-
"caffemodel = {\"prototxt\":\"./deploy.prototxt\",\n",
128-
" \"model\":\"./res10_300x300_ssd_iter_140000.caffemodel\",\n",
134+
"caffemodel = {\"prototxt\":\"./caffemodel_dir/deploy.prototxt\",\n",
135+
" \"model\":\"./caffemodel_dir/res10_300x300_ssd_iter_140000.caffemodel\",\n",
129136
" \"acc_threshold\":0.50 # neglected detections with probability less than acc_threshold value\n",
130137
" }\n",
131138
"\n",
@@ -255,7 +262,7 @@
255262
"name": "python",
256263
"nbconvert_exporter": "python",
257264
"pygments_lexer": "ipython3",
258-
"version": "3.6.4"
265+
"version": "3.6.8"
259266
}
260267
},
261268
"nbformat": 4,

0 commit comments

Comments
 (0)