Skip to content

Commit 6ec7536

Browse files
committed
Update devel branch
1 parent e8e2a82 commit 6ec7536

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+5184
-548
lines changed

.gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
.ipynb_checkpoints/
2-
video_data/
2+
examples/video_data/
33
.idea/
44
examples/output.avi
5-
pretrained_models/caffemodel_weights/
6-
pretrained_models/tensorflow_weights/
7-
pretrained_models/yolo_weights/
5+
examples/pretrained_models/caffemodel_weights/
6+
examples/pretrained_models/tensorflow_weights/
7+
examples/pretrained_models/yolo_weights/
88

99
# Byte-compiled / optimized / DLL files
1010
__pycache__/

README.md

+35-41
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1-
[cars-yolo-output]: ./assets/cars.gif "Sample Output with YOLO"
2-
[cows-tf-ssd-output]: ./assets/cows.gif "Sample Output with SSD"
1+
[cars-yolo-output]: examples/assets/cars.gif "Sample Output with YOLO"
2+
[cows-tf-ssd-output]: examples/assets/cows.gif "Sample Output with SSD"
33

44
# Multi-object trackers in Python
55
Object detection using deep learning and multi-object tracking
66

77
[![DOI](https://zenodo.org/badge/148338463.svg)](https://zenodo.org/badge/latestdoi/148338463)
88

9-
### Available Trackers
10-
```
11-
SimpleTracker
9+
### Available Multi Object Trackers
1210

13-
SimpleTracker2
11+
```
12+
CentroidTracker
13+
CentroidKF_Tracker
14+
IOUTracker
15+
SORT
1416
```
1517

16-
#### YOLO
17-
Video Source: [link](https://flic.kr/p/89KYXt)
18-
19-
![Cars with YOLO][cars-yolo-output]
18+
### Available OpenCV-based object detectors:
2019

21-
#### Tensorflow-SSD-MobileNet
22-
Video Source: [link](https://flic.kr/p/26WeEWy)
20+
```
21+
detector.TF_SSDMobileNetV2
22+
detector.Caffe_SSDMobileNet
23+
detector.YOLOv3
24+
```
2325

24-
![Cows with tf-SSD][cows-tf-ssd-output]
26+
`YOLOv3 + CentroidTracker` | `TF-MobileNetSSD + CentroidTracker`
27+
:-------------------------:|:-------------------------:
28+
![Cars with YOLO][cars-yolo-output] | ![Cows with tf-SSD][cows-tf-ssd-output]
29+
Video source: [link](https://flic.kr/p/89KYXt) | Video source: [link](https://flic.kr/p/26WeEWy)
2530

2631

2732
### Installation
@@ -43,54 +48,43 @@ cd multi-object-tracker
4348
pip install -e .
4449
```
4550

46-
### YOLO
51+
For using the opencv `dnn`-based object detection modules provided in this repository with GPU, you may have to compile a CUDA enabled version of OpenCV from source.
52+
53+
For building opencv from source, you can refer the following: [[link-1](https://docs.opencv.org/master/df/d65/tutorial_table_of_content_introduction.html)], [[link-2](https://www.pyimagesearch.com/2020/02/03/how-to-use-opencvs-dnn-module-with-nvidia-gpus-cuda-and-cudnn/)]
54+
55+
### How to use?: Examples
56+
57+
Examples for how to use `motrackers` are provided [examples](./examples/) folder of this repository.
58+
You can clone and run the examples as shown in the [readme](examples/readme.md) inside the [examples](./examples/) folder.
59+
60+
### Pretrained Object Detection Models
4761

48-
Do the following in the terminal to download a pretrained weights of YOLO:
62+
You will have to download the pretrained weights for the model. The shell scripts for downloading are provided in [examples](examples/) folder.
63+
64+
##### YOLOv3
4965
```
50-
cd ./pretrained_models/yolo_weights
66+
cd ./examples/pretrained_models/yolo_weights
5167
sudo chmod +x ./get_yolo.sh
5268
./get_yolo.sh
5369
```
5470

55-
### TensorFlow model
56-
57-
Do the following in the terminal to download a pretrained model:
71+
##### TensorFlow MobileNetSSDv2
5872
```
5973
cd ./pretrained_models/tensorflow_weights
6074
sudo chmod +x ./get_ssd_model.sh
6175
./get_ssd_model.sh
6276
```
6377

64-
**SSD-Mobilenet_v2_coco_2018_03_29** was used for this example.
65-
Other networks can be downloaded and ran: Go through `tracking-tensorflow-ssd_mobilenet_v2_coco_2018_03_29.ipynb` for more details.
66-
67-
### Caffemodel
68-
69-
Do the following in the terminal to download a pretrained model:
78+
##### Caffemodel
7079
```
7180
cd ./pretrained_models/caffemodel_weights
7281
sudo chmod +x ./get_caffemodel.sh
7382
./get_caffemodel.sh
7483
```
7584

76-
This is a MobileNet-SSD caffemodel.
77-
78-
### Examples and How to use:
79-
80-
For examples and how to use this repository, please refer [examples/](examples/) folder.
81-
8285
### References and Credits
83-
This work is based on the following literature:
84-
1. Bochinski, E., Eiselein, V., & Sikora, T. (2017, August). High-speed tracking-by-detection without using image information. In 2017 14th IEEE International Conference on Advanced Video and Signal Based Surveillance (AVSS) (pp. 1-6). IEEE. [[paper-pdf](http://elvera.nue.tu-berlin.de/files/1517Bochinski2017.pdf)]
85-
2. Pyimagesearch [link-1](https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/), [link-2](https://www.pyimagesearch.com/2018/11/12/yolo-object-detection-with-opencv/)
86-
3. [correlationTracker](https://github.com/Wenuka/correlationTracker)
87-
4. [Caffemodel zoo](http://caffe.berkeleyvision.org/model_zoo.html)
88-
5. [Caffemodel zoo GitHub](https://github.com/BVLC/caffe/tree/master/models)
89-
6. [YOLO v3](https://pjreddie.com/media/files/papers/YOLOv3.pdf)
90-
91-
Use the caffemodel zoo from the reference [4,5] mentioned above to vary the CNN models and Play around with the codes.
9286

93-
***Suggestion**: If you are looking for speed go for SSD-mobilenet. If you are looking for accurracy and speed go with YOLO. The best way is to train and fine tune your models on your dataset. Although, Faster-RCNN gives more accurate object detections, you will have to compromise on the detection speed as it is slower as compared to YOLO.*
87+
Please see [references.md](REFERENCES.md)
9488

9589
### Citation
9690

REFERENCES.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# References and Credits
2+
3+
This work is based on the following literature:
4+
5+
1. Bochinski, E., Eiselein, V., & Sikora, T. (2017, August). High-speed tracking-by-detection without using image information. In 2017 14th IEEE International Conference on Advanced Video and Signal Based Surveillance (AVSS) (pp. 1-6). IEEE. [[pdf](http://elvera.nue.tu-berlin.de/files/1517Bochinski2017.pdf)]
6+
2. Bewley, A., Ge, Z., Ott, L., Ramos, F., & Upcroft, B. (2016, September). Simple online and realtime tracking. In 2016 IEEE International Conference on Image Processing (ICIP) (pp. 3464-3468). IEEE. [[arxiv](https://arxiv.org/abs/1602.00763)]
7+
3. YOLOv3. [[pdf](https://pjreddie.com/media/files/papers/YOLOv3.pdf)][[website](https://pjreddie.com/darknet/yolo/)]
8+
4. Kalman Filter. [[wiki](https://en.wikipedia.org/wiki/Kalman_filter)]
9+
5. TensorFlow Object Detection API [[github](https://github.com/tensorflow/models/tree/master/research/object_detection)]
10+
6. Caffe [[website](https://caffe.berkeleyvision.org/)][[github](https://github.com/BVLC/caffe)]
11+
12+
13+
#### Link to `multi-object-tracker` [[webpage](https://adipandas.github.io/multi-object-tracker/)][[GitHub Repo](https://github.com/adipandas/multi-object-tracker)]

_config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
title: Multi-object trackers in Python
2+
description:
23
theme: jekyll-theme-cayman
File renamed without changes.
File renamed without changes.

examples/IOUTracker-caffe-model-mobilenetSSD.ipynb renamed to examples/example_notebooks/IOUTracker-caffe-model-mobilenetSSD.ipynb

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
"source": [
99
"import numpy as np\n",
1010
"import cv2 as cv\n",
11-
"from motrackers import IOUTracker\n",
12-
"from motrackers.utils import select_caffemodel, select_videofile"
11+
"from motrackers.utils import select_caffemodel, select_videofile\n",
12+
"from motrackers.iou_tracker import IOUTracker\n",
13+
"from motrackers.detectors.caffe import Caffe_MobileNetSSD"
1314
]
1415
},
1516
{
@@ -23,7 +24,7 @@
2324
},
2425
{
2526
"cell_type": "code",
26-
"execution_count": 2,
27+
"execution_count": 3,
2728
"metadata": {},
2829
"outputs": [],
2930
"source": [
@@ -32,7 +33,7 @@
3233
"# display(video_file, prototxt, weights)\n",
3334
"\n",
3435
"video_file = \"./../video_data/people.mp4\"\n",
35-
"prototxt = \"./../pretrained_models/caffemodel_weights/MobileNetSSD_deploy.prototxt\" \n",
36+
"prototxt = \"./../pretrained_models/caffemodel_weights/MobileNetSSD_deploy.prototxt\"\n",
3637
"weights = \"./../pretrained_models/caffemodel_weights/MobileNetSSD_deploy.caffemodel\""
3738
]
3839
},
@@ -156,6 +157,7 @@
156157
" image_resized, model[\"pixel_std\"], model[\"input_size\"], \n",
157158
" (model[\"pixel_mean\"], model[\"pixel_mean\"], model[\"pixel_mean\"]), False\n",
158159
" )\n",
160+
" \n",
159161
" net.setInput(blob)\n",
160162
" detections = net.forward()\n",
161163
"\n",
@@ -192,7 +194,7 @@
192194
" boxes.append([left, top, width, height])\n",
193195
" confidences.append(float(confidence))\n",
194196
" classIDs.append(int(class_id))\n",
195-
" \n",
197+
"\n",
196198
" indices = cv.dnn.NMSBoxes(boxes, confidences, model[\"confidence_threshold\"], model[\"threshold\"])\n",
197199
" \n",
198200
" class_ids_to_track = []\n",
@@ -222,7 +224,7 @@
222224
" cv.FILLED)\n",
223225
" \n",
224226
" cv.putText(image, label, (x, y_label), cv.FONT_HERSHEY_SIMPLEX, 0.5, clr, 2)\n",
225-
" \n",
227+
" \n",
226228
" tracks = tracker.update(detections_bbox, class_ids_to_track, confidences_track)\n",
227229
" \n",
228230
" if print_tracks:\n",

examples/SimpleTracker-caffe-model-mobilenetSSD.ipynb renamed to examples/example_notebooks/SimpleTracker-caffe-model-mobilenetSSD.ipynb

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 2,
66
"metadata": {},
77
"outputs": [],
88
"source": [
99
"import numpy as np\n",
1010
"import cv2 as cv\n",
11-
"from motrackers import SimpleTracker\n",
11+
"# from motrackers import SimpleTracker\n",
1212
"from motrackers.utils import select_caffemodel, select_videofile"
1313
]
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": 2,
17+
"execution_count": 3,
1818
"metadata": {},
1919
"outputs": [
2020
{
2121
"data": {
2222
"application/vnd.jupyter.widget-view+json": {
23-
"model_id": "1d3c3a3a86324074b3461a40bda983ea",
23+
"model_id": "cb30715c81274880b0f1ff9b0bab206f",
2424
"version_major": 2,
2525
"version_minor": 0
2626
},
@@ -34,7 +34,7 @@
3434
{
3535
"data": {
3636
"application/vnd.jupyter.widget-view+json": {
37-
"model_id": "46b604d3ae4d4853aa0a644f9edfe463",
37+
"model_id": "14f91c21118d4e2ba2135fcdb0bbcce7",
3838
"version_major": 2,
3939
"version_minor": 0
4040
},
@@ -48,7 +48,7 @@
4848
{
4949
"data": {
5050
"application/vnd.jupyter.widget-view+json": {
51-
"model_id": "9f31f72dfb7446b29e258b97fa8f1a2f",
51+
"model_id": "e256f1517fd44cbd9b1b89e950550807",
5252
"version_major": 2,
5353
"version_minor": 0
5454
},

0 commit comments

Comments
 (0)