Abstract
Fastanpr is an open-source AI & Machine Learning project. A fast automatic number-plate recognition (ANPR) library. A fast automatic number-plate recognition (ANPR) library. This package employs YOLOv8, a lightweight model, for detection, and Paddle OCR, a lightweight optical character recognition (OCR) library, for recognizing text in detected number plates. It is built using Python, YOLO. The complete source code is publicly available on GitHub under the GNU Affero General Public License v3.0, making it a useful reference for students building an AI & Machine Learning mini project or final-year project.
1. Introduction
A fast automatic number-plate recognition (ANPR) library. This package employs YOLOv8, a lightweight model, for detection, and Paddle OCR, a lightweight optical character recognition (OCR) library, for recognizing text in detected number plates.
2. Objective
A fast automatic number-plate recognition (ANPR) library
This project demonstrates how Python, YOLO can be applied to a real-world AI & Machine Learning problem.
4. Technology Stack
5. System Requirements
General requirements for this technology stack — check the README for exact versions.
- Python 3.8 or later
- pip / virtualenv for dependencies
- VS Code, PyCharm or Jupyter Notebook
- Git (to clone the repository)
6. Installation & Setup
git clone https://github.com/arvindrajan92/fastanpr.git
cd fastanprpip install fastanprimport cv2
from fastanpr import FastANPR
# Create an instance of FastANPR
fast_anpr = FastANPR()
# Load images (images should be of type numpy ndarray)
files = [...]
images = [cv2.cvtColor(cv2.imread(file), cv2.COLOR_BGR2RGB) for file in files]
# Run ANPR on the images
number_plates = await fast_anpr.run(images)
# Print out results
for file, plates in zip(files, number_plates):
print(file)
for plate in plates:
print("Plate Attributes:")
print("Detection bounding box:", plate.det_box)
print("Detection confidence:", plate.det_conf)
print("Recognition text:", plate.rec_text)
print("Recognition polygon:", plate.rec_poly)
print("Recognition confidence:", plate.rec_conf)
print()
print()import base64
import requests
# Step 1: Read the image file
image_path = 'tests/images/image001.jpg'
with open(image_path, 'rb') as image_file:
image_data = image_file.read()
# Step 2: Convert the image to a base64 encoded string
base64_image_str = base64.b64encode(image_data).decode('utf-8')
# Prepare the data for the POST request (assuming the API expects JSON)
data = {'image': base64_image_str}
# Step 3: Send a POST request
response = requests.post(url='http://127.0.0.1:8000/recognise', json=data)
# Check the response
if response.status_code == 200:
# 'number_plates': [
# {
# 'det_box': [682, 414, 779, 455],
# 'det_conf': 0.29964497685432434,
# 'rec_poly': [[688, 420], [775, 420], [775, 451], [688, 451]],
# 'rec_text': 'BVH826',
# 'rec_conf': 0.940690815448761
# }
# ]
print(response.json())
else:
print(f"Request failed with status code {response.status_code}.")Full setup instructions are in the project README.
7. Future Enhancements
Suggested extensions you can add to make this your own project.
- Deploy the model as a web app with Streamlit, Flask or FastAPI
- Compare against an additional model and report the metric difference
- Add explainability (SHAP / Grad-CAM)
8. Viva / Review Questions
Common questions examiners ask for projects in this domain.
- What dataset does the project use and how was it pre-processed?
- Which algorithm / model architecture is used and why was it chosen over alternatives?
- How are training and testing data split, and how is overfitting avoided?
- Which evaluation metrics (accuracy, precision, recall, F1) are reported and what do they mean here?
- How would you deploy this model for real users?
9. Source Code & License
This project is developed by arvindrajan92 and published on GitHub under the GNU Affero General Public License v3.0. Please follow the license terms and credit the original author when you use or modify this code.
Want to build this as your internship project?
Work on an AI & Machine Learning project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.
Apply for AI & Machine Learning Internship