• Stars
    star
    193
  • Rank 201,081 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 5 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The code of the Object Counting API, implemented with the YOLO algorithm and with the SORT algorithm

YOLO-Object-Counting-API

Real time Object Counting api. Implemented with the YOLO algorithm and with the SORT algorithm

The implementation is using model in same format as darkflow and darknet. Weight files, as well as cfg files can be found here. Darklow supports only YOLOv1 and YOLOv2. Support for YOLOv3 has not yet been implemented.

In order to achieve the best performance, you should have Cuda and tensorflow-gpu installed on Your device.

Demo

Count objects of a specified class crossing a virtual line

Counting pedestrains

Highway traffic counting

Count objects on a video

Count objects on a single frame

Set up

Dependencies

-tensorflow 1.0
-numpy
-opencv 3

Getting started

You can choose one of the following three ways to get started with darkflow.

  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.

    python3 setup.py build_ext --inplace
    
  2. Let pip install darkflow globally in dev mode (still globally accessible, but changes to the code immediately take effect)

    pip3 install -e .
    
  3. Install with pip globally

    pip3 install .
    

Required files

The YOLO algoritym impementation used in this project requires 3 files. Configuration of network (.cfg), trained weights (.weights) and labels.txt.

YOLO implementation used in this project enables usage of YOLOv1 and YOLOv2, and its tiny versions. Support for YOLOv3 has not yet been implemented.

.cfg files

Configuration file determines a network architecture. Configurations can be found here. 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.

The .cfg file can be downloaded using the following command:

wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov2.cfg -O cfg/yolov2.cfg

.weights files

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.

The .weights file can be downloaded using the following command:

wget https://pjreddie.com/media/files/yolov2.weights -O bin/yolov2.weights

labels.txt files

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.

Run counting

Once You have all dependencies instaled and all required files You can start counting objects. Object counting is carried out by an ObjectCuntingAPI object.

Examples of counting below

Count cars on crosing a virtual line

python3 count_cars_crosing_virtual_line.py

Count objects on video from Video Camera

python3 count_objects_from_camera.py

Count people on image

python3 count_people_on_image.py

Credits

The following open source projects were used in the implementation

Darkflow

The YOLO algorithm impementation - Darkflow

Python Traffic Counter

Object counting 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.

Deep Sort

Object tracking and counting - SORT

Images and Videos sources

Highway surveillance video

Pedestrian surveillance video

Authors

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details

That's all.

More Repositories

1

K-Means-Algorithm-From-Scratch

The K-Means algorithm, written from scratch using the Python programming language
Jupyter Notebook
15
star
2

data-science-blog

Data science blog, https://tugot17.github.io/data-science-blog/
Jupyter Notebook
8
star
3

FastAPI-Model-Deployement

Template of simple API for machine learning models deployment
Python
4
star
4

Linear-Regression-From-Scratch

Linear Regression concepts and intuitions presented using Jupyter Notebooks
Jupyter Notebook
4
star
5

Swarm-Algorithms

Python implementation of swarm algorithms used for solving non-convex optimization problems
Python
4
star
6

ML-In-Cybersecurity-Paper

Summary of the presentation on Real and Stealthy Attacks on State-of-the-Art Face Recognition Systems at the Seminar: Machine Learning in Cyber-security at FU Berlin
TeX
3
star
7

RNN-Time-lagged-Autoencoder

Tensorflow 2.0 implementation of time-lagged autoencoder using Recurrent Neural Networks
Jupyter Notebook
3
star
8

KNN-Algorithm-From-Scratch

The K Nearest Neighbors algorithm, written from scratch using the Python programming language
Jupyter Notebook
2
star
9

Vision-Transformer-Presentation

Presentation on An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
HTML
2
star
10

Discord-Language-Detection-Bot

Restrict the use of forbidden languages on your discord server with transformers
Python
2
star
11

Pytorch-Lightning-Templates

Set of templates for popular deep learning problems using PyTorch Lightning
Python
1
star
12

YOLO-Paper

Summary of my presentation about Object Detection using the YOLO Algorithm at the Seminar: Artificial Intelligence - Autonomous Vehicles at FU Berlin
TeX
1
star
13

surfer_seo_hacatohon

Jupyter Notebook
1
star
14

RGB-Infrared-Classification

Research code for experimenting with different approaches to image classification from multi-channel image sources
Jupyter Notebook
1
star
15

Recommendation-With-Transformers

Recommender system for Steam Games, based on a BERT-like approach for recommendations
Jupyter Notebook
1
star