How to Build an Automated License Plate Reading Application
Published Jul 25, 2024 • 5 min read

Using computer vision, you can detect the presence of license plates in an image, video, or livestream, then read the contents of those license plates into text that can be processed by a computer.

With Roboflow Workflows, you can build a system to detect and read license plates in a web interface without writing any application logic code. You can then deploy your system using a cloud API, or on edge devices such as an NVIDIA Jetson or a Raspberry Pi.

In this guide, we are going to walk through how to create a license plate recognition and reading system with computer vision. By the end of the guide, we will be able to detect license plates in an image and read them as text.

Here is a demo showing our system in action, recorded using the interactive Workflow preview interface:

0:00
/0:23
💡
Test the workflow on your own data and use the template in Roboflow to follow along with the guide

Without further ado, let’s get started!

Detect and Read License Plates with Computer Vision

To build our license plate recognition system, we are going to use the following logic:

  1. Detect cars with an object detection model.
  2. Filter out detections from the model to only process cars.
  3. Crop each car.
  4. Run a license plate object detection model on each car.
  5. Crop each license plate.
  6. Send each license plate to GPT-4 with Vision to read the text on the plate.
  7. Return the results as JSON for use in an application.

By detecting cars first, then running a license plate detection on each car, we can isolate each license plate to improve accuracy when the license plate is sent to a multimodal model.

The system above also allows us to preserve the relationship between each car recognized by the car detection model and the resulting text when the license plate is processed. This means that we can return an image of a car, a focused image of the license plate, and the text in the license plate. We can do this for each car in an image.

Let’s talk through the key components of this system.

What is Roboflow Workflows?

Workflows is a low-code computer vision application builder. With Workflows, you can build complex computer vision applications in a web interface and then deploy Workflows with the Roboflow cloud, on an edge device such as an NVIDIA Jetson, or on any cloud provider like GCP or AWS.

Workflows has a wide range of pre-built functions available for use in your projects and you can test your pipeline in the Workflows web editor, allowing you to iteratively develop logic without writing any code.

Detecting Cars and License Plates

For this guide, we are using a model trained on the Microsoft COCO dataset. This model can detect vehicles, among other objects.

In your Workflow, you can configure models by clicking on the object detection model blocks and customizing the values in the configuration pane:

coco/24 is a publicly available model trained on the COCO dataset. You can use public models available on Roboflow Universe as well as private models in your workspace.

After our model runs, we use a Detections Filter block to only include detections with the car class. We then crop all cars using the Dynamic Crop block so that we can process them independently.

We then run another model that detects license plates. This model runs independently on every individual vehicle identified by our vehicle detection model.

We are using a publicly available license plate detection model.

Finally, we crop each license plate so that we have images that focus on license plates. These images can then independently be passed into a multimodal model to read the text in the image.

Reading License Plates with Computer Vision

To read license plates, we are going to use OpenAI's GPT-4 with Vision. GPT-4 with Vision is an accurate multimodal model. You can use GPT-4 with Vision for tasks like OCR and visual question answering. GPT-4 with Vision is one of the Large Multimodal Models (LMMs) supported by Workflows.

We provide the following prompt to the model:

read the license plate, output should just be the text

This prompt will ensure our model returns specifically the text in the license plate.

To use GPT-4 with Vision with Workflows, you will need to provide an OpenAI API key. Learn how to retrieve your OpenAI API key. You can then paste the key into the “Remote API key” field associated with your Workflow.

Workflow Response

Our Workflow is configured to return:

  1. The cropped cars identified by the vehicle detection model;
  2. The cropped license plate regions identified by the license plate recognition model;
  3. The license plate text returned by the multimodal model.

The Workflow returns JSON data.

Let’s run the Workflow on the following image:

Here is an example of the response from the Workflow:

Our Workflow successfully identified the license plate, and returned the text in the license plate (“40800F3”).

Conclusion

Roboflow Workflows is a web-based computer vision application builder. With Workflows, you can build complex computer vision workflows using an extensive range of pre-made blocks.

In this guide, we walked through how to use a pre-build license plate detection and recognition Workflow. This Workflow can be customized to meet your requirements by adding blocks or changing the contents of the Workflow, from the blocks to the models that are used.

To learn more about how to use Workflows, refer to the Roboflow Workflows documentation.

Cite this Post

Use the following entry to cite this post in your research:

James Gallagher. (Jul 25, 2024). How to Build an Automated License Plate Reading Application. Roboflow Blog: https://blog.roboflow.com/license-plate-recognition/

Discuss this Post

If you have any questions about this blog post, start a discussion on the Roboflow Forum.

Written by

James Gallagher
James is a Technical Marketer at Roboflow, working toward democratizing access to computer vision.

Topics