Skip to content

Latest commit

 

History

History
192 lines (162 loc) · 9.66 KB

File metadata and controls

192 lines (162 loc) · 9.66 KB

🤗 Hugging Face - Here

📚 Product & Resources - Here

🛟 Help Center - Here

💼 KYC Verification Demo - Here

🙋‍♀️ Docker Hub - Here

sudo docker pull kbyai/license-plate-recognition:latest
sudo docker run -v ./license.txt:/home/openvino/kby-ai-alpr/license.txt -p 8081:8080 -p 9001:9000 kbyai/license-plate-recognition:latest

Automatic-License-Plate-Recognition

Overview

This repository demonstrates ANPR/ALPR(Automatic Number/License Plate Recognition) SDK with unmatched accuracy and precision by applying SOTA(State-of-the-art) deep learning techniques.
KBY-AI's LPR solutions utilizes artificial intelligence and machine learning to greatly surpass legacy solutions. Now, in real-time, users can receive a vehicle's plate number through API.

We can customize the SDK to align with customer's specific requirements.

The ALPR system consists of the following steps:

  • Vehicle image capture
  • Preprocessing
  • Vehicle detection
  • Number plate extraction
  • Charater segmentation
  • Optical Character Recognition(OCR)

The ALPR system works in these strides, the initial step is the location of the vehicle and capturing a vehicle image of front or back perspective of the vehicle, the second step is the localization of Number Plate and then extraction of vehicle Number Plate is an image. The final stride uses image segmentation strategy, for the segmentation a few techniques neural network, mathematical morphology, color analysis and histogram analysis. Segmentation is for individual character recognition. Optical Character Recognition (OCR) is one of the strategies to perceive the every character with the assistance of database stored for separate alphanumeric character.

◾License Plate Recognition SDK Product List

No. Repository SDK Details Status
➡️ LPR - Linux License Plate Recognition Linux SDK Available
2 LPR - Docker License Plate Recognition Docker Image Available
3 LPR - Flutter License Plate Recognition Flutter SDK Available
4 LPR - Android License Plate Recognition Android SDK Developing
5 LPR - iOS License Plate Recognition iOS SDK Developing

To get more products, please visit products here:

Try the API

Online Demo

To try KBY-AI ALPR online, please visit here

Please select tab 'ALPR/ANPRfor thisSDK` image

Postman

The API can be evaluated through Postman tool. Here are the endpoints for testing:

  • Test with an image file: Send a POST request to http://89.116.159.229:8085/alpr.
  • Test with a base64-encoded image: Send a POST request to http://89.116.159.229:8085/alpr_base64. image

SDK License

This project demonstrates KBY-AI's Palmprint Recognition Server SDK, which requires a license per machine.

  • The code below shows how to use the license:
    machineCode = getMachineCode()
    print("\nmachineCode: ", machineCode.decode('utf-8'))
    try:
    with open(licensePath, 'r') as file:
    license = file.read().strip()
    except IOError as exc:
    print("failed to open license.txt: ", exc.errno)
    print("\nlicense: ", license)
    ret = setActivation(license.encode('utf-8'))
  • To request the license, please provide us with the machine code obtained from the getMachineCode function.

Please contact us:

🧙Email: [email protected]
🧙Telegram: @kbyai
🧙WhatsApp: +19092802609
🧙Skype: live:.cid.66e2522354b1049b
🧙Facebook: https://www.facebook.com/KBYAI

How to run

1. System Requirements

  • CPU: 2 cores or more (Recommended: 2 cores)
  • RAM: 4 GB or more (Recommended: 8 GB)
  • HDD: 4 GB or more (Recommended: 8 GB)
  • OS: Ubuntu 20.04 or later
  • Dependency: OpenVINO™ Runtime (Version: 2022.3)

2. Setup and Test

  • Clone the project:

    git clone https://github.com/kby-ai/Automatic-License-Plate-Recognition-Docker.git
    cd Automatic-License-Plate-Recognition-Docker
  • Build the Docker image:

    sudo docker build --pull --rm -f Dockerfile -t kby-ai-alpr:latest .
  • Run the Docker container:

    sudo docker run -v ./license.txt:/home/openvino/kby-ai-alpr/license.txt -p 8081:8080 -p 9001:9000 kby-ai-alpr
  • Send us the machine code and then we will give you a license key to make the SDK activate.

    After that, update the license.txt file by overwriting the license key that you received. Then, run the Docker container again.

    image

    image

  • Here are the endpoints to test the API through Postman:

    Test with an image file: Send a POST request to http://{xx.xx.xx.xx}:8081/alpr.

    Test with a base64-encoded image: Send a POST request to http://{xx.xx.xx.xx}:8081/alpr_base64.

3. Execute the Gradio demo

  • Setup Gradio Ensure that the necessary dependencies are installed.
    Gradio requires Python 3.7 or above.
    Install Gradio using pip by running the following command:
    pip install -r requirements.txt
  • Run the demo with the following command:
    cd gradio
    python demo.py
  • SDK can be tested on the following URL: http://127.0.0.1:9000

About SDK

1. Initializing the SDK

  • Import SDK python script
    from alprsdk import initSDK, getLicensePlate, getMachineCode, freeLicenseResults, setActivation
  • Obtain the machine code to activate and request a license
    machineCode = getMachineCode()
    print("\nmachineCode: ", machineCode.decode('utf-8'))
  • Activate the SDK using the license key
    ret = setActivation(license.encode('utf-8'))
    print("\nactivation: ", ret)
  • Initializing SDK
    ret = initSDK()
    Once ret value is zero, SDK can get work started

2. APIs

  • Getting License Number & Coordinate

    The SDK provides a single API for getting license plate number and its coordinate(x, y, width, height).
    The function can be used as follows:

    recog_array = (c_int * 1024)()  # Assuming a maximum of 256 rectangles
    license_plate_ptr = POINTER(c_char_p)()
    cnt = getLicensePlate(img_byte, len(img_byte), byref(license_plate_ptr), recog_array)
    • recog_array: coordinate(x, y, width, height).
    • img_byte: image data in binary format.
    • license_plate_ptr: pointer to variable with license plate number.
  • Analyzing the result from SDK Result values from SDK inference can be analyzed as follows.

    license_plate = [license_plate_ptr[i].decode('utf-8') for i in range(cnt)]
    rectangles = [
    (recog_array[i * 4], recog_array[i * 4 + 1], recog_array[i * 4 + 2], recog_array[i * 4 + 3])
    for i in range(cnt)]
    
    freeLicenseResults(license_plate_ptr, cnt)
    
    print("number: ", cnt, rectangles, license_plate)
    • cnt: the number of detected license plate.
    • rectangles: list of coordinate.
    • license plate: list of license number.
  • Free Memory

    freeLicenseResults(license_plate_ptr, cnt)

Performance Video

You can visit our YouTube video for ANPR/ALPR model's performance here to see how well our demo app works.

ANPR/ALPR Demo

Application of ALPR

Automatic license-plate recognition (ALPR) is a technology that uses OCR(optical character recognition) on images to read vehicle registration plates. It can use existing closed-circuit television, road-rule enforcement cameras, or cameras specifically designed for the task. ALPR can be used by police forces around the world for law enforcement purposes, including to check if a vehicle is registered or licensed. It is also used for electronic toll collection on pay-per-use roads and as a method of cataloguing the movements of traffic, for example by highways agencies.
ALPR has many uses including:

  • Recovering stolen cars
  • Identifying drivers with an open warrant for arrest
  • Catching speeders by comparing the average time it takes to get from stationary camera A to stationary camera B
  • Determining what cars do and do not belong in a parking garage
  • Expediting parking by eliminating the need for human confirmation of parking passes