Giter Site home page Giter Site logo

pascalchristian / crowd-counting-using-tensorflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from darpan-jain/crowd-counting-using-tensorflow

0.0 0.0 0.0 4.39 MB

Tensorflow implementation of crowd counting using CNNs from overhead surveillance cameras.

License: MIT License

Python 81.22% Dockerfile 18.78%

crowd-counting-using-tensorflow's Introduction

CROWD COUNTING

Contents


Introduction

This repository contains the code of performing the task of implementing a people counter from an overhead video surveillance camera by using Transfer Learning.


Using pre-trained models

  • Tensorflow’s Object Detection API provides pre-trained models for object detection, which are capable of detecting around 90 classes (objects) with person being one of the classes.

  • On giving test images to a pretrained model, the inference results were not as per requirements. On some instances the model detected the entire image as a person and also missing out on some fairly obvious ones.

  • Clearly, using the pre-trained models is not the way to go. So, Pre-Trained Models 😕

Training a custom model

A custom model had to trained for accurate implementation. The following steps were taken for the same:

  1. Annotated training data had to be prepared before being given to the model fot training.
  2. LabelImg was used for this purpose, to draw bounding boxes around objects of interest in the training images.
  3. LabelImg gives output as xml files containing coordinates of each of the bounding boxes in an image and the associated label of the object.
  4. All the xml files were converted to a train.csv and then into a train.record format. TFRecord format is required by Tensorflow to perform training of a custom model.
  5. Similarly a val.record was created for validation data.
  6. The architecture of the model is based on the Faster RCNN algorithm, which is an efficient and popular object detection algorithm which uses deep convolutional networks.
  7. The config file of the model was modified. The last 90 neuron classification layer of the network was removed and replaced with a new layer that gives output for only one class i.e. person.
  8. The config file for the same can be found in ./data/utils/faster_rcnn.config
  9. After training the model, the checkpoint model is saved as model.pb file.
  10. This model can now be deployed and used for obtaining inferences on crowd images.
  • The model can be found on this drive link: ​Custom Model

  • Download and place the model in ./data/utils before executing main.py.


Results

Upon running main.py, the results are as shown below. (Refer ./results)

Note: Since the model was trained on only 30 annotated images, the accuracy can be significantly increased by using a larger dataset to build the model.


Prerequisites

All the required dependencies can be install by running the command pip install -r requirements.txt


Usage

  • Place the images (.jpg) you need to run inference on in ./data/images/test
  • Run main.py
  • Results will be saved in ./results

crowd-counting-using-tensorflow's People

Contributors

darpan-jain avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.