Skip to content

Commit ebfaef9

Browse files
committed
First Commit
0 parents  commit ebfaef9

File tree

149 files changed

+5157
-0
lines changed

Some content is hidden

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

149 files changed

+5157
-0
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = test/*

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# Weight files
3+
bin/
4+
5+
# Input files
6+
inputs/input.mp4
7+
8+
# Output giles
9+
outputs/production.avi
10+
11+
# Built cython files
12+
darkflow/cython_utils/*.pyd
13+
darkflow/cython_utils/*.c
14+
15+
#egg-info
16+
darkflow.egg-info/
17+
18+
#Other build stuff
19+
build/

.ionide/symbolCache.db

8 KB
Binary file not shown.

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
dist: trusty
2+
sudo: required
3+
4+
language: python
5+
python:
6+
- "3.6"
7+
8+
cache:
9+
directories:
10+
- bin #cache .weights files
11+
12+
# command to install dependencies
13+
install:
14+
- pip install -r test/requirements-testing.txt
15+
- pip install -e .
16+
17+
# command to run tests
18+
script: pytest -x --cov=./
19+
20+
#Upload code coverage statistics
21+
after_success:
22+
- codecov

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "C:\\Users\\natthasath.sak\\envs\\graduate-gpu\\Scripts\\python.exe"
3+
}

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# YOLO-Object-Counting-API
2+
Real time Object Counting api. Implemented with the [YOLO](https://arxiv.org/pdf/1612.08242.pdf) algorithm and with the [SORT](https://arxiv.org/pdf/1703.07402.pdf) algorithm
3+
4+
The implementation is using model in same format as darkflow and darknet. Weight files, as well as cfg files can be found [here](http://pjreddie.com/darknet/yolo/). Darklow supports only YOLOv1 and YOLOv2. Support for YOLOv3 has not yet been implemented.
5+
6+
In order to achieve the best performance, you should have Cuda and tensorflow-gpu installed on Your device.
7+
8+
## Demo
9+
### Count objects of a specified class crossing a virtual line
10+
11+
#### Graduate pedestrian
12+
13+
[![Watch the video](https://i9.ytimg.com/vi/CF_UPJvWr-s/mq1.jpg?sqp=COjT7pcG&rs=AOn4CLBR2yVAPbF6F7rqkYxeudTkc0KwOA)](https://www.youtube.com/watch?v=CF_UPJvWr-s&ab_channel=NatthasathSaksupanara)
14+
15+
#### Counting pedestrains
16+
17+
<p align="center"> <img src="inputs/pedestrians_output.gif"/> </p>
18+
19+
#### Highway traffic counting
20+
21+
<p align="center"> <img src="inputs/highway_traffic_output.gif"/> </p>
22+
23+
### Count objects on a video
24+
25+
<p align="center"> <img src="inputs/count_objects_on_video.gif"/> </p>
26+
27+
### Count objects on a single frame
28+
29+
<p align="center"> <img src="inputs/count_people_output.jpg"/> </p>
30+
31+
32+
# Set up
33+
## Dependencies
34+
35+
```
36+
-tensorflow 1.0
37+
-numpy
38+
-opencv 3
39+
```
40+
41+
## Getting started
42+
43+
You can choose _one_ of the following three ways to get started with darkflow.
44+
45+
1. Just build the Cython extensions in place. NOTE: If installing this way you will have to use `./flow` in the cloned darkflow directory instead of `flow` as darkflow is not installed globally.
46+
```
47+
python3 setup.py build_ext --inplace
48+
```
49+
50+
2. Let pip install darkflow globally in dev mode (still globally accessible, but changes to the code immediately take effect)
51+
```
52+
pip3 install -e .
53+
```
54+
55+
3. Install with pip globally
56+
```
57+
pip3 install .
58+
```
59+
60+
## Required files
61+
62+
The YOLO algoritym impementation used in this project requires 3 files. Configuration of network (.cfg), trained weights (.weights) and labels.txt.
63+
64+
YOLO implementation used in this project enables usage of YOLOv1 and YOLOv2, and its tiny versions. Support for YOLOv3 has not yet been implemented.
65+
66+
67+
### .cfg files
68+
Configuration file determines a network architecture. Configurations can be found [here](http://pjreddie.com/darknet/yolo/). In example scripts we assume that the configuration is placed in cfg/ folder. Location of used .cfg file is specyfied in the options object used in the code.
69+
70+
The .cfg file can be downloaded using the following command:
71+
```bash
72+
wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov2.cfg -O cfg/yolov2.cfg
73+
```
74+
### .weights files
75+
The .weights files contain trained parameters of a network. In example scripts we assume the weights are placed in bin/ folder. Location of used .weights file is specyfied in the options object used in the code.
76+
77+
The .weights file can be downloaded using the following command:
78+
```bash
79+
wget https://pjreddie.com/media/files/yolov2.weights -O bin/yolov2.weights
80+
```
81+
### labels.txt files
82+
83+
This file is list of classes detected by a YOLO netowork. It shoud contain as many classes as it is specyfied in a .cfg file.
84+
85+
## Run counting
86+
87+
Once You have all dependencies instaled and all required files You can start counting objects. Object counting is carried out by an ObjectCuntingAPI object.
88+
89+
Examples of counting below
90+
91+
### Count cars on crosing a virtual line
92+
```bash
93+
python3 count_cars_crosing_virtual_line.py
94+
```
95+
96+
### Count objects on video from Video Camera
97+
```bash
98+
python3 count_objects_from_camera.py
99+
```
100+
101+
### Count people on image
102+
```bash
103+
python3 count_people_on_image.py
104+
```
105+
106+
## Credits
107+
The following open source projects were used in the implementation
108+
109+
### Darkflow
110+
111+
The YOLO algorithm impementation - [Darkflow](https://github.com/thtrieu/darkflow)
112+
113+
### Python Traffic Counter
114+
115+
[Object counting with YOLO and SORT](https://github.com/bharath5673/python-traffic-counter-with-yolo-and-sort). Similar project, but instead of using the darklow YOLO implementation, it uses the opencv YOLO implementation, so there is no GPU acceleration.
116+
117+
### Deep Sort
118+
Object tracking and counting - [SORT](https://github.com/abewley/sort)
119+
120+
## Images and Videos sources
121+
Highway surveillance [video](https://www.youtube.com/watch?v=PJ5xXXcfuTc)
122+
123+
Pedestrian surveillance [video](https://www.youtube.com/watch?v=aUdKzb4LGJI)
124+
125+
## Authors
126+
* [tugot17](https://github.com/tugot17)
127+
128+
## License
129+
130+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details
131+
132+
133+
That's all.
6.89 KB
Binary file not shown.

__pycache__/sort.cpython-36.pyc

7.41 KB
Binary file not shown.

__pycache__/sort.cpython-37.pyc

7.35 KB
Binary file not shown.

0 commit comments

Comments
 (0)