Green check
Link copied to clipboard

Build an ANPR system with Ultralytics YOLO11 and GPT-4o Mini

Learn how to build an ANPR system using Ultralytics YOLO11 for number plate detection and GPT-4o Mini for text recognition with real-time accuracy.

Finding parking in a crowded lot, waiting in long toll booth lines, or getting stuck at security checkpoints is frustrating. Manual vehicle checks often take too long and cause delays. Without an automated system, tracking cars efficiently can be challenging. 

Computer vision has changed this by enabling real-time number plate recognition from images and video streams. For instance, Ultralytics YOLO11 is an advanced computer vision model that can perform advanced Vision AI tasks like object detection, classification, and tracking. Using YOLO11's object detection abilities, you can accurately detect vehicle number plates in images. 

Ultralytics offers comprehensive Google Colab notebooks that simplify the process of building Vision AI-powered solutions. These notebooks come pre-configured with essential dependencies, models, and step-by-step guides, making creating applications easier. In particular, there is a dedicated Colab notebook for ANPR (Automatic Number Plate Recognition).

In this article, using the Ultralytics Colab notebook for ANPR, we’ll explore how to build an ANPR solution using Ultralytics YOLO11 for number plate detection and GPT-4o Mini for text recognition. 

Understanding ANPR 

Tracking cars manually is time-consuming and prone to errors, especially when they’re moving quickly. Checking each license plate one by one slows down the process and increases the risk of mistakes. Automatic number plate recognition solves this problem by using computer vision to detect and read license plates instantly, making traffic monitoring and security more efficient.

ANPR systems can capture images or videos of passing vehicles and use real-time object detection to identify number plates. Once detected, text recognition is used to extract the plate numbers automatically, without the need for human intervention. This process ensures accurate results, even when vehicles are moving quickly, or plates are partially obscured.

Fig 1. An example of using YOLO11 to detect a license plate.

Nowadays, toll booths, parking systems, and law enforcement are increasingly relying on ANPR to track vehicles efficiently.

Challenges related to ANPR technology

While ANPR quickly identifies vehicles, there are still some challenges that can affect its accuracy. Here are a few common issues that can impact how well an ANPR system works:

  • Low light and bad weather: Number plates become harder to read at night and in bad weather. Fog, rain, and a headlight’s glare can blur the text, making it unreadable.
  • Blurred or blocked plates: A fast-moving car can leave a blurry image, especially if the camera’s shutter speed is too slow. Dirt, scratches, or parts of the plate being covered can also cause recognition problems. Using high-quality cameras with the right settings helps get clearer results.
  • Inconsistent plate designs: Not all plates look the same. Some have fancy fonts, extra text, or logos that confuse the system.
  • Privacy risks and data security: Storing vehicle data safely is important. The right security measures can prevent unauthorized access and keep information protected. With proper safeguards, ANPR systems can be both secure and reliable.

How YOLO11 improves ANPR systems

Ultralytics YOLO11 can make ANPR systems faster and more accurate. It processes images quickly while maintaining precision and doesn’t require heavy computing power, so it works well on everything from small security cameras to large traffic systems.

With custom training, YOLO11 can be adapted to different license plate styles, languages, and environments. It also performs well in challenging conditions like low light, motion blur, and difficult angles when custom-trained on specialized datasets that include images of these conditions.

By identifying vehicles instantly, YOLO11 helps reduce wait times, prevent errors, and improve security. This makes traffic flow smoother and operations more efficient in parking lots, toll booths, and surveillance systems.

Building an ANPR system with YOLO11 and GPT-4o Mini

Next, let’s walk through how to build an ANPR system using YOLO11 and GPT-4o Mini. 

We’ll be exploring the code showcased in the Ultralytics Google Collab notebook for this solution. The Google Colab notebook is easy to use and anyone can create an ANPR system without needing a complicated setup.

Step 1: Setting up the environment

To get started, we’ll need to install our dependencies, or the essential software packages and libraries required to run our ANPR system. These dependencies help with tasks like object detection, image processing, and text recognition, ensuring the system works efficiently.

We’ll install the Ultralytics Python package as shown below. This package provides pre-trained models, training utilities, and inference tools, making it easier to detect and recognize number plates with YOLO11.

Fig 2. Installing the Ultralytics Python package. 

We'll also need to set up GPT-4o Mini for text recognition. Since GPT-4o Mini is responsible for extracting text from detected plates, we need an API key to access the model. This key can be obtained by signing up for the GPT-4o Mini API. Once you have the key, it can be added to the Colab notebook so the system can connect to the model and process plate numbers.

After completing the setup and running the installation code, YOLO11 will be ready to detect license plates, and GPT-4o Mini will be set up to recognize and extract text from them.

Step 2: Download the custom-trained model

Now that everything is set up, the next step is to download the YOLO11 model that has been custom-trained to detect license plates. Since this model has already been trained to detect number plates, there’s no need to train it from scratch. You can just download it, and it’s ready to use. This saves time and makes the process much easier.

Also, we’ll download a sample video file to test the system. If you want, you can run this solution on your own video files as well. Once downloaded, the model and video files will be stored in the notebook environment.

Fig 3. Downloading the model and video file.

Step 3: Load the video and start detection

Once the model is ready, it's time to see it in action. First, the video file is loaded for processing, ensuring it opens correctly. A video writer is then set up to save the processed footage with detected license plates while maintaining the original size and frame rate. Finally, the model is loaded to detect license plates in each frame of the video.

Fig 4. Reading the video and loading the model.

Once the model is loaded, the system will begin analyzing each frame of the video to detect license plates. When a plate is found, the system highlights it with a detection box, making it easy to identify. This step ensures that only the relevant details are captured, filtering out unnecessary background information. With the plates successfully detected, the video is now ready for the next stage.

Step 4: Extracting text from number plates

After detecting a number plate, the next step is text recognition. The system first crops the plate from the video frame, removing any distractions for a clear view. This helps focus on the details, improving accuracy even in challenging conditions like low light or motion blur.

Once the plate is isolated, GPT-4o Mini analyzes the image, extracts the numbers and letters, and converts them into readable text. The recognized text is then added back to the video, labeling each detected plate in real-time.

With these steps complete, the ANPR system is fully functional and ready to recognize license plates with ease. 

Step 5: Saving the processed video

The final step saves the processed video and cleans up temporary files, ensuring everything runs smoothly. 

Each processed frame, with detected plates and recognized text, is written to the final output video. Once all frames are processed, the system closes the video file it was reading from, freeing up memory and system resources. It also finalizes and saves the output video, making it ready for playback or further analysis.

Fig 5. Using YOLO11 and GPT-4o Mini for ANPR.

Deploying an ANPR system

After building and testing an ANPR solution, the next step is deploying it in a real-world environment. Most Vision AI models depend on high-performance computing, but Ultralytics YOLO11 is optimized for Edge AI. It can run efficiently on small devices without requiring cloud processing or a constant internet connection, making it a great choice for locations with limited resources.

For example, a gated community can deploy YOLO11 on an edge device to identify vehicles as they enter, eliminating the need for large servers. Everything is processed on-site in real time, ensuring smooth access, reduced congestion, and enhanced security.

Fig 6. Detecting license plates with YOLO11.

Meanwhile, in areas with stable internet connectivity, cloud-based ANPR can handle multiple cameras simultaneously. For instance, at a shopping mall, it can track vehicles across different entrances and store plate numbers in a central system, making it easier to monitor parking, improve security, and manage vehicle flow remotely.

The road ahead for ANPR

Setting up an automatic number plate recognition (ANPR) system is simple with Ultralytics YOLO11. It accurately detects number plates and can be custom-trained to adapt to different environments and requirements.

ANPR systems enhance security, streamline parking management, and improve traffic monitoring. By automating number plate recognition, they reduce errors, speed up identification, and make vehicle tracking more efficient across various applications.

Join our community and visit our GitHub repository to see AI in action. Explore our licensing options and discover more about Vision AI in manufacturing and AI in self-driving cars on our solutions pages.

Facebook logoTwitter logoLinkedIn logoCopy-link symbol

Read more in this category

Let’s build the future
of AI together!

Begin your journey with the future of machine learning