Awesome Open Source
Awesome Open Source

Deep Learning Applied To Vehicle Registration Plate Detection and Recognition

Python 3.6

What's this repo about?

This is a simple approach for handling the problem of vehicle license plate recognition. It is not an end-to-end system, instead, two different deep learning algorithms were stacked together to complete this task. First, license plates regions were extracted by using the YOLO object detection algorithm, then the region proposals were submitted to an Attention Based Optical Character Recognition, Attention-OCR, to finally recognize the characters.


Make sure you have all the dependencies installed:

pip install -r requirements.txt

Both YOLO and Attention-OCR were trained on the Brazilian SSIG-ALPR dataset:

  • Images were resized to 1056x576 during training, so YOLO will perform best if applied to this shape.
  • Cropped bounding box images (i.e. license plates) were resized to 160x60 to train the Attention-OCR.

Download the pretrained models as well as the configuration files and put them in the config directory.

Run the application service:


The application service will be listening to requests on http://localhost:5000/

Send an Http POST request with a form-data body with an attribute file containing the image, like this curl example:

curl --location --request POST 'localhost:5000/' \
--form '[email protected]/path/to/the/image/file/image_file.png'


The API will output all the detections with the corresponding bounding boxes and its confidence scores as well as the OCR prediction for each bounding box. Also, we draw all these information on the input image and also outputs it as a base64 image.

json object response will look like the following:

  "detections": [
      "bb_confidence": 0.973590612411499,
      "bounding_box": [
      "ocr_pred": "ABC1234-"
      "bb_confidence": 0.9556514024734497,
      "bounding_box": [
      "ocr_pred": "ABC1234-"
  "output_image": "/9j/4AAQS..."

Note: If DEBUG flag is set to True in the, images will be produced in the debug directory to make debugging a bit easier.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (1,120,145
Deep Learning (23,007
Pytorch (11,214
Neural Network (8,448
Opencv (6,161
Convolutional Neural Networks (3,672
Ocr (1,448
Yolov3 (632
Yolo (620
Optical Character Recognition (153
Related Projects