Skip to main content

FastALPR

Actions status Actions status Ruff Pylint Checked with mypy ONNX Model Hugging Face Spaces Documentation Status Python Version GitHub version License

ALPR Demo Animation

FastALPR is a high-performance, customizable Automatic License Plate Recognition (ALPR) system. We offer fast and efficient ONNX models by default, but you can easily swap in your own models if needed.

For Optical Character Recognition (OCR), we use fast-plate-ocr by default, and for license plate detection, we use open-image-models. However, you can integrate any OCR or detection model of your choice.

📋 Table of Contents

✨ Features

  • High Accuracy: Uses advanced models for precise license plate detection and OCR.
  • Customizable: Easily switch out detection and OCR models.
  • Easy to Use: Quick setup with a simple API.
  • Out-of-the-Box Models: Includes ready-to-use detection and OCR models
  • Fast Performance: Optimized with ONNX Runtime for speed.

📦 Installation

pip install fast-alpr[onnx-gpu]

By default, no ONNX runtime is installed. To run inference, you must install at least one ONNX backend using an appropriate extra.

Platform/Use Case Install Command Notes
CPU (default) pip install fast-alpr[onnx] Cross-platform
NVIDIA GPU (CUDA) pip install fast-alpr[onnx-gpu] Linux/Windows
Intel (OpenVINO) pip install fast-alpr[onnx-openvino] Best on Intel CPUs
Windows (DirectML) pip install fast-alpr[onnx-directml] For DirectML support
Qualcomm (QNN) pip install fast-alpr[onnx-qnn] Qualcomm chipsets

🚀 Quick Start

[!TIP] Try fast-alpr in Hugging Spaces.

Here's how to get started with FastALPR:

from fast_alpr import ALPR

# You can also initialize the ALPR with custom plate detection and OCR models.
alpr = ALPR(
    detector_model="yolo-v9-t-384-license-plate-end2end",
    ocr_model="cct-xs-v2-global-model",
)

# The "assets/test_image.png" can be found in repo root dir
alpr_results = alpr.predict("assets/test_image.png")
print(alpr_results)

Output:

ALPR Result

You can also draw the predictions directly on the image:

import cv2

from fast_alpr import ALPR

# Initialize the ALPR
alpr = ALPR(
    detector_model="yolo-v9-t-384-license-plate-end2end",
    ocr_model="cct-xs-v2-global-model",
)

# Load the image
image_path = "assets/test_image.png"
frame = cv2.imread(image_path)

# Draw predictions on the image and get the ALPR results
drawn = alpr.draw_predictions(frame)
annotated_frame = drawn.image
results = drawn.results

Annotated frame:

ALPR Draw Predictions

🛠️ Customization and Flexibility

FastALPR is designed to be flexible. You can customize the detector and OCR models according to your requirements. You can very easily integrate with Tesseract OCR to leverage its capabilities:

import re
from statistics import mean

import numpy as np
import pytesseract

from fast_alpr.alpr import ALPR, BaseOCR, OcrResult


class PytesseractOCR(BaseOCR):
    def __init__(self) -> None:
        """
        Init PytesseractOCR.
        """

    def predict(self, cropped_plate: np.ndarray) -> OcrResult | None:
        if cropped_plate is None:
            return None
        # You can change 'eng' to the appropriate language code as needed
        data = pytesseract.image_to_data(
            cropped_plate,
            lang="eng",
            config="--oem 3 --psm 6",
            output_type=pytesseract.Output.DICT,
        )
        plate_text = " ".join(data["text"]).strip()
        plate_text = re.sub(r"[^A-Za-z0-9]", "", plate_text)
        avg_confidence = mean(conf for conf in data["conf"] if conf > 0) / 100.0
        return OcrResult(text=plate_text, confidence=avg_confidence)


alpr = ALPR(detector_model="yolo-v9-t-384-license-plate-end2end", ocr=PytesseractOCR())

alpr_results = alpr.predict("assets/test_image.png")
print(alpr_results)

[!TIP] See the docs for more examples!

📖 Documentation

Comprehensive documentation is available here, including detailed API references and additional examples.

🤝 Contributing

Contributions to the repo are greatly appreciated. Whether it's bug fixes, feature enhancements, or new models, your contributions are warmly welcomed.

To start contributing or to begin development, you can follow these steps:

  1. Clone repo
    git clone https://github.com/ankandrew/fast-alpr.git
    
  2. Install all dependencies (make sure you have uv installed):
    make install
    
  3. To ensure your changes pass linting and tests before submitting a PR:
    make checks
    

🙏 Acknowledgements

📫 Contact

For questions or suggestions, feel free to open an issue.

Metadata

Release files for fast-alpr 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fast-alpr 0.4.0
File Size Uploaded
fast_alpr-0.4.0.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for fast-alpr 0.4.0
File Interpreter ABI Platform
fast_alpr-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / fast_alpr-0.4.0.tar.gz

Download URL fast_alpr-0.4.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
02e3011598c5c83c260e215f7bec8cae9f67a1e9b903db1079a14bdb15d4eb0d
BLAKE2b-256 checksum
How to use checksums
53545adde5e01028218db494084e932cd8fae391170b8da70f98ae36709721eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.

Transparency log

Release files / fast_alpr-0.4.0-py3-none-any.whl

Download URL fast_alpr-0.4.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3e835c60fcebe1445ccdd3128da958968866b0df2bfe3960357b78251296499
BLAKE2b-256 checksum
How to use checksums
3bf262454cec77ea25c01e3634a5ba645251eb3de821f9d29de72d9b62f4ccbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page