Skip to main content

A fast automatic number-plate recognition (ANPR) library

Project description

FastANPR logo

Build Status Build Status Build Status Build Status Build Status Build Status GitHub release (latest by date) Python Versions License: AGPL-3.0 GitHub stars

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. Example outputs

Installation

You can install the package using pip:

pip install fastanpr

Requirements

  • Windows:
    • Python >=3.8, <3.11
  • Ubuntu, macOS, Raspbian:
    • Python >=3.8, <3.12

Usage

import 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()

Class: FastANPR

Methods

run(images: List[np.ndarray] -> List[List[NumberPlate]]

Runs ANPR on a list of images and return a list of detected number plates.

  • Parameters:

    • images (List[np.ndarray]): A list of images represented as numpy ndarray.
  • Returns:

    • List[List[NumberPlate]]: A list of detected number plates for every image.

Class: NumberPlate

Attributes

  • det_box (List[int]): Bounding box coordinates of detected number plate.
  • det_conf (float): Confidence score of number plate detection.
  • rec_text (str): Recognized plate number.
  • rec_poly (List[List[int]]): Polygon coordinates of detected texts.
  • rec_conf (float): Confidence score of recognition.

Licence

This project incorporates the YOLOv8 model from Ultralytics, which is licensed under the AGPL-3.0 license. As such, this project is also distributed under the GNU Affero General Public License v3.0 (AGPL-3.0) to comply with the licensing requirements.

For more details on the YOLOv8 model and its license, please visit the Ultralytics GitHub repository.

Contributing

We warmly welcome contributions from the community! If you're interested in contributing to this project, please start by reading our CONTRIBUTING.md guide.

Whether you're looking to submit a bug report, propose a new feature, or contribute code, we're excited to see what you have to offer. Please don't hesitate to reach out by opening an issue or submitting a pull request.

Thank you for considering contributing to our project. Your support helps us make the software better for everyone.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastanpr-0.1.11.tar.gz (5.7 MB view details)

Uploaded Source

Built Distribution

fastanpr-0.1.11-py3-none-any.whl (5.7 MB view details)

Uploaded Python 3

File details

Details for the file fastanpr-0.1.11.tar.gz.

File metadata

  • Download URL: fastanpr-0.1.11.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for fastanpr-0.1.11.tar.gz
Algorithm Hash digest
SHA256 10582d2c1fb016cb393c8df72aa04d31afafb2faf4c44c465786c1e6e5a51ac9
MD5 afcb552dda22f437bfa3efd41ddb3853
BLAKE2b-256 3391901947af351a5b3dc2653a0a6f3e75f6c6d89ca29cdc37a1a8ee887ff6ce

See more details on using hashes here.

File details

Details for the file fastanpr-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: fastanpr-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for fastanpr-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 e6df2ef21586c3ac2eb6e2c272cc668313314cbb5adaa5e75727019d5039ce11
MD5 74750a30c818bc9ad258080564afc523
BLAKE2b-256 790c218a56f68e80c6b1c39ac306f997c19f6e08fc0020540a97fa7224c1315d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page