License Plate Recognition and Speed detection using camera.
- About the Project
- Features
- Detection using Mask-RCNN
- Detection using Yolo
- Detection using dimensions of number plate
- Detection using Cascade features
- OCR for license plate recognition
- Speed Detection
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.
- License plate detection
- Yolo-v3
- MasK-RCNN
- Dimensions based
- Cascade features
- Speed Detection
- Recognition using OCR
Instance image segmentation
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.
Single shot detection
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.
We hard-coded the approximate dimensions of number plate.
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.
Using haar-cascades.
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.
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.
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.
•