Coder Social home page Coder Social logo

maheshmb13 / traffic-management Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 42.88 MB

License Plate Recognition and Speed detection using a camera.

Python 6.70% Jupyter Notebook 56.98% Makefile 0.09% C 33.85% Shell 0.06% Cuda 2.13% C++ 0.18%
license-plate-recognition speed-detection ocr-recognition

traffic-management's Introduction

Issues LinkedIn


Traffic Management

License Plate Recognition and Speed detection using camera.

Table of Contents

About The Project

Automatic number-plate recognition can be used to store the images captured by the cameras as well as the text from the license plate.

Here's why:

  • Secure an area, such as a military base or research facility.
  • Find a stolen vehicle or car involved in a crime.
  • Monitor gated entrances & parking lot traffic.

We tested some best ways available for license plate detection.

Features

  • License plate detection
    • Yolo-v3
    • MasK-RCNN
    • Dimensions based
    • Cascade features
  • Speed Detection
  • Recognition using OCR

Detection using Mask-RCNN

Instance image segmentation

Results :

The Colab version for training and testing is provided here.

Model weights (mask_rcnn_plate_0134.h5) are available here.

Training
We collected over 400 images of indian cars with number plates.
Annotated using VGG image annotator

Advantages
It classifies each and every pixel into pre-defined categories. This helps removing the edges of the number plate image which inturn helps in ocr recognition.

It gave good accuracy though the data is very low in number.

Disadvantages
Slow and not suitable for real time usage.


Detection using Yolo-v3

Single shot detection

Results :

The file for testing is provided here.

Model weights (yolov3_1000.weights) are available here.

Training
Since we need around 2k images for better results, we did it for belgian cars dataset (around 1600 images)
Annotated using Yolo-Annotation-Tool-New

Testing
Using open-cv dnn and yolo weights got from the training process.

Advantages
Single shot detection. Speed and reliable. It is suitable for real time usage.

It gave better results on training data. Coming to testing data it failed for some images. Though we provided very low dataset Mask-RCNN gave better results than yolo-v3 for small object detection (number plate).

Disadvantages
Needs a large dataset.


Detection using dimensions of number plate

We hard-coded the approximate dimensions of number plate.

Results :

Click here to navigate to the folder.

plate_dimensions = (0.03*label_image.shape[0], 0.08*label_image.shape[0], 0.15*label_image.shape[1], 0.3*label_image.shape[1])
plate_dimensions2 = (0.08*label_image.shape[0], 0.2*label_image.shape[0], 0.15*label_image.shape[1], 0.4*label_image.shape[1])
min_height, max_height, min_width, max_width = plate_dimensions

Range of dimensions are given.

Disadvantages
It doesn't work in all conditions. Only a few set of angles work fine.


Detection using cascade features

Using haar-cascades.

Results :

Click here to navigate to the folder.

The xml files are provided in the respective directory. Use opencv cascade classifier for testing purpose

It gives good results but doesn't work in low light conditions. Works fine only with few conditions.

It is not as accurate as object detection using neural nets. Providing good balanced data (negative and positive samples) would give better results.


OCR model

Click here to navigate to the folder. Model weights (ocrmodel.h5) are available in the directory.

We collected 9 images of each character from internet.

We created a basic CNN model using keras with categorical crossentropy loss. Trained it over the dataset (0-9 & A-Z characters).

Pre-processing of test data like character segmentation, finding contours etc. are provided here

A jupyter version is also provided for training and testing.


Speed detection using cameras

We used haar cascades classifier for detecting cars in the video.

Each car is alloted with an id when it enters the camera view. The id is tracked till it moves out of the view using OpenCV.

Speed is calculated using pixel per meter(ppm) which depends on camera angle. Here, we gave ppm as 8.4(approx.)

We assume camera to be static.


⚠️ This is a basic project and not useful for production. We followed many blogs and data is collected from kaggle, google images and some repos.

traffic-management's People

Contributors

maheshmb13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.