Skip to content

MareArts' ANPR solution offers fast and accurate vehicle identification with seamless system integration.

Notifications You must be signed in to change notification settings

MareArts/MareArts-ANPR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

49 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MareArts ANPR SDK

*Latest Version : 3.1.3

๐Ÿ‡ช๐Ÿ‡บ๐Ÿณ๏ธโ€๐ŸŒˆ ANPR EU and Plus

Auto Number Plate Recognition for European Union and Plus countries

๐Ÿฆ‹ Available Countries: (We are adding more countries.)

EU :
๐Ÿ‡ฆ๐Ÿ‡ฑ Albania ๐Ÿ‡ฆ๐Ÿ‡ฉ Andorra ๐Ÿ‡ฆ๐Ÿ‡น Austria ๐Ÿ‡ง๐Ÿ‡ช Belgium ๐Ÿ‡ง๐Ÿ‡ฆ Bosnia and Herzegovina 
๐Ÿ‡ง๐Ÿ‡ฌ Bulgaria ๐Ÿ‡ญ๐Ÿ‡ท Croatia ๐Ÿ‡จ๐Ÿ‡พ Cyprus ๐Ÿ‡จ๐Ÿ‡ฟ Czechia ๐Ÿ‡ฉ๐Ÿ‡ฐ Denmark ๐Ÿ‡ซ๐Ÿ‡ฎ Finland 
๐Ÿ‡ซ๐Ÿ‡ท France ๐Ÿ‡ฉ๐Ÿ‡ช Germany ๐Ÿ‡ฌ๐Ÿ‡ท Greece ๐Ÿ‡ญ๐Ÿ‡บ Hungary ๐Ÿ‡ฎ๐Ÿ‡ช Ireland ๐Ÿ‡ฎ๐Ÿ‡น Italy ๐Ÿ‡ฑ๐Ÿ‡ฎ Liechtenstein 
๐Ÿ‡ฑ๐Ÿ‡บ Luxembourg ๐Ÿ‡ฒ๐Ÿ‡น Malta ๐Ÿ‡ฒ๐Ÿ‡จ Monaco ๐Ÿ‡ฒ๐Ÿ‡ช Montenegro ๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands ๐Ÿ‡ฒ๐Ÿ‡ฐ North Macedonia 
๐Ÿ‡ณ๐Ÿ‡ด Norway ๐Ÿ‡ต๐Ÿ‡ฑ Poland ๐Ÿ‡ต๐Ÿ‡น Portugal ๐Ÿ‡ท๐Ÿ‡ด Romania ๐Ÿ‡ธ๐Ÿ‡ฒ San Marino ๐Ÿ‡ท๐Ÿ‡ธ Serbia 
๐Ÿ‡ธ๐Ÿ‡ฐ Slovakia ๐Ÿ‡ธ๐Ÿ‡ฎ Slovenia ๐Ÿ‡ช๐Ÿ‡ธ Spain ๐Ÿ‡ธ๐Ÿ‡ช Sweden ๐Ÿ‡จ๐Ÿ‡ญ Switzerland ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom 
Plus:
๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia

๐Ÿฆ‹ Recognisable Characters:

char_list = [
    "-", ".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
    "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "d", "i", 
    "m", "o", "ร–", "รœ", "ฤ†", "ฤŒ", "ฤ", "ล ", "ลฝ", "ะŸ"
]



๐Ÿ‡ฐ๐Ÿ‡ท ANPR Korea

ํ•œ๊ตญ ์ž๋™์ฐจ ๋ฒˆํ˜ธํŒ ์ธ์‹ ์†”๋ฃจ์…˜

์ธ์‹ ๊ฐ€๋Šฅ ๋ฌธ์ž:

char_list = [
    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 
    '๊ฐ€', '๊ฐ•', '๊ฑฐ', '๊ฒฝ', '๊ณ ', '๊ด‘', '๊ตฌ', '๊ธฐ',
    '๋‚˜', '๋‚จ', '๋„ˆ', '๋…ธ', '๋ˆ„',
    '๋‹ค', '๋Œ€', '๋”', '๋„', '๋™', '๋‘',
    '๋ผ', '๋Ÿฌ', '๋กœ', '๋ฃจ',
    '๋งˆ', '๋จธ', '๋ชจ', '๋ฌด', '๋ฌธ',
    '๋ฐ”', '๋ฐฐ', '๋ฒ„', '๋ณด', '๋ถ€', '๋ถ',
    '์‚ฌ', '์‚ฐ', '์„œ', '์„ธ', '์†Œ', '์ˆ˜',
    '์•„', '์–ด', '์˜ค', '์šฐ', '์šธ', '์›', '์œก', '์ธ',
    '์ž', '์ €', '์ „', '์ œ', '์กฐ', '์ข…', '์ฃผ',
    '์ฒœ', '์ถฉ',
    'ํ•˜', 'ํ—ˆ', 'ํ˜ธ'
]



๐Ÿช Universal

An integrated model for recognizing license plates from all the countries we support.



๐Ÿ”ฉ Installation

To install the MareArts ANPR package, use the following pip command:

pip install marearts-anpr

If you want to use CUDA version inference, please install the following additional packages:

pip install onnxruntime-gpu==1.18.1



๐Ÿชช License Key

For private keys, please visit MareArts ANPR Solution. For inquiries about private keys, contact us at hello@marearts.com.



๐Ÿค– Live Test

MareArts ๐ŸŽฌ Live



๐Ÿ“บ ANPR Result Videos

Check here to see the license plate recognition results in YouTube videos.



๐Ÿš‚ Model Version

ANPR Detector Model Version

Model Name File Size Precision Recall F1 Speed
middle 103mb legacy legacy - 0.23 sec
v10_small 29mb 0.9713 0.9669 - 0.0623 sec
v10_middle 61mb 0.9731 0.9617 - 0.1262 sec
v10_large 93mb 0.9735 0.9687 - 0.1764 sec
v11_samll 28mb 0.9510 0.9817 0.9584 0.0119 sec
v11_middle 58mb 0.9502 0.9817 0.9577 0.0149 sec
v11_large 93mb 0.9534 0.9858 0.9619 0.0176 sec
  • speed test is based on i7-9800X 3.8GHz
  • Use model name in detector code

ANPR OCR Model Version

Model File Size Accuracy Recall F1
eu ~100mb 0.9346 0.9346 0.9392
euplus ~100mb 0.9554 0.9554 0.9580
kr ~100mb 0.9824 0.9824 0.9873
univ ~100mb 0.9626 0.9626 0.9630
v11_eu ~100mb 0.9919 0.9919 0.9919
v11_euplus ~100mb 0.9853 0.9853 0.9853
v11_kr ~100mb 0.9967 0.9967 0.9967
v11_univ ~100mb 0.9953 0.9953 0.9953
  • Use model name in OCR code



๐Ÿ“ Using SDK

๐Ÿ”ฌ SDK Usage

Here's an example of how to use the updated SDK:

# pip install marearts-anpr
import cv2
from PIL import Image
from marearts_anpr import ma_anpr_detector
from marearts_anpr import ma_anpr_ocr
from marearts_anpr import marearts_anpr_from_pil
from marearts_anpr import marearts_anpr_from_image_file
from marearts_anpr import marearts_anpr_from_cv2

if __name__ == '__main__':
    
    #################################
    ## Initiate MareArts ANPR
    print("EU ANPR")
    user_name = "your_email"
    serial_key = "your_serial_key"
    detector_model_version = "middle" # Options: refer to detector model table
    ocr_model_version = "eu" # Options: refer to ocr model table

    # MareArts ANPR Detector Inference
    anpr_d = ma_anpr_detector(detector_model_version, user_name, serial_key, conf_thres=0.3, iou_thres=0.5)
    # MareArts ANPR OCR Inference
    anpr_r = ma_anpr_ocr(ocr_model_version, user_name, serial_key)
    #################################

    #################################
    # Routine Task 1 - Predict from File
    image_path = './sample_images/eu_test1.jpg'
    output = marearts_anpr_from_image_file(anpr_d, anpr_r, image_path)
    print(output)

    # Routine Task 2 - Predict from cv2
    img = cv2.imread(image_path)
    output = marearts_anpr_from_cv2(anpr_d, anpr_r, img)
    print(output)

    # Routine Task 3 - Predict from Pillow
    pil_img = Image.open(image_path)
    output = marearts_anpr_from_pil(anpr_d, anpr_r, pil_img)
    print(output)
    #################################


    #################################
    ## Initiate MareArts ANPR for Korea
    print("ANPR Korean")
    # user_name, serial_key are already defined
    # anpr_d is also already initiated before
    ocr_model_version = "kr"
    # MareArts ANPR OCR Inference
    anpr_r = ma_anpr_ocr(ocr_model_version, user_name, serial_key)

    #################################
    # Routine Task 1 - Predict from File
    image_path = './sample_images/kr_test2.jpg'
    output = marearts_anpr_from_image_file(anpr_d, anpr_r, image_path)
    print(output)

    # Routine Task 2 - Predict from cv2
    img = cv2.imread(image_path)
    output = marearts_anpr_from_cv2(anpr_d, anpr_r, img)
    print(output)

    # Routine Task 3 - Predict from Pillow
    pil_img = Image.open(image_path)
    output = marearts_anpr_from_pil(anpr_d, anpr_r, pil_img)
    print(output)
    #################################

Please refer to the advanced.py code in the ./example_code folder. This file demonstrates how to implement the ma_anpr_detector and ma_anpr_ocr separately.



๐Ÿ”ฌ Returns

The output from the ANPR will be similar to:

{
    'results': [
        {'ocr': 'SL593LM', 'ocr_conf': 99, 'ltrb': [819, 628, 1085, 694], 'ltrb_conf': 90}
        ], 
    'ltrb_proc_sec': 0.22,
    'ocr_proc_sec': 0.15
}
{
    'results': [
        {'ocr': '123๊ฐ€4568', 'ocr_conf': 99, 'ltrb': [181, 48, 789, 186], 'ltrb_conf': 83}, 
        {'ocr': '123๊ฐ€4568', 'ocr_conf': 99, 'ltrb': [154, 413, 774, 557], 'ltrb_conf': 82}, 
        {'ocr': '123๊ฐ€4568', 'ocr_conf': 99, 'ltrb': [154, 601, 763, 746], 'ltrb_conf': 80}, 
        {'ocr': '123๊ฐ€4568', 'ocr_conf': 99, 'ltrb': [156, 217, 773, 369], 'ltrb_conf': 80}
        ],
    'ltrb_proc_sec': 0.23,
    'ocr_proc_sec': 0.6
}
  • Results: Contains OCR text, probabilities, and detection coordinate(left, top, right, bottom).
  • Processing Speeds: Provided for license plate detection and OCR.



๐Ÿงช API for testing

This is for testing purposes

API key limits: 1000 requests per day.
User ID: marearts@public
X-API-Key: J4K9L2Wory34@G7T1Y8rt-PP83uSSvkV3Z6ioSTR!

API Call

To make an API call for ANPR, use the following command:
Content-Type : image/jpeg
x-api-key: api_key
user-id: user-id
detector_model_version: Specifies which version of the detector model to use. Refer to version table
ocr_model_version: Specifies which version of the OCR model to use. Refer to version table

#!bin/bash
curl -X POST https://we303v9ck8.execute-api.eu-west-1.amazonaws.com/Prod/marearts_anpr \
     -H "Content-Type: image/jpeg" \
     -H "x-api-key: api_key" \
     -H "user-id: user-id" \
     -H "detector_model_version: detector_version" \
     -H "ocr_model_version: ocr_version" \
     --data-binary "@./a.jpg"



โš“๏ธ Create MareArts ANPR API Docker

Please refer to ./API_docker_example folder.

API_docker_example
โ”‚
โ”œโ”€โ”€ api_call.sh           # Shell script to make API calls to the MareArts ANPR application.
โ”œโ”€โ”€ app.py                # Python script containing the MareArts ANPR application.
โ”œโ”€โ”€ build_image.sh        # Shell script to build the Docker image from the Dockerfile.
โ”œโ”€โ”€ Dockerfile            # Dockerfile containing instructions for building the Docker image.
โ”œโ”€โ”€ request.py            # Python script to send requests to the MareArts ANPR API server.
โ”œโ”€โ”€ requirements.txt      # Contains a list of Python packages that the app requires.
โ””โ”€โ”€ run_container.sh      # Shell script to run the Docker container from the built image.



๐Ÿ˜Ž More Detail

email : hello@marearts.com
home page : https://marearts.com
blog : http://study.marearts.com
subscription : https://study.marearts.com/p/anpr-lpr-solution.html
live test : http://live.marearts.com



๐Ÿ™‡๐Ÿปโ€โ™‚๏ธ Thank you!

About

MareArts' ANPR solution offers fast and accurate vehicle identification with seamless system integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published