EULPR

State-of-the-art European License Plate Recognition

What is EULPR?

EULPR is a computer-vision model architecture purpose-built for detecting, reading, and recognizing European license plates. It is optimized for speed and accuracy across diverse EU plate formats.

Key Features

Use Cases

EULPR is designed to be used in a variety of applications, including:

Install Required Packages

pip install ultralytics easyocr opencv-python pillow torch torchvision huggingface_hub

Usage Example

import cv2
import numpy as np
from ultralytics import YOLO
import easyocr
from PIL import Image
from huggingface_hub import hf_hub_download
import warnings

# Suppress warnings
warnings.filterwarnings('ignore')

# Download models from HuggingFace
print("Downloading model from HuggingFace...")
model_path = hf_hub_download(repo_id="0xnu/european-license-plate-recognition", filename="model.onnx")
config_path = hf_hub_download(repo_id="0xnu/european-license-plate-recognition", filename="config.json")

# Load models with explicit task specification
yolo_model = YOLO(model_path, task='detect')
ocr_reader = easyocr.Reader(['en', 'de', 'fr', 'es', 'it', 'nl'], gpu=False, verbose=False)

# Process image
def recognize_license_plate(image_path):
   # Load image
   image = cv2.imread(image_path)
   image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
   
   # Detect license plates
   results = yolo_model(image_rgb, conf=0.5, verbose=False)
   
   plates = []
   for result in results:
       boxes = result.boxes
       if boxes is not None:
           for box in boxes:
               # Get coordinates
               x1, y1, x2, y2 = box.xyxy[0].cpu().numpy()
               
               # Crop plate
               plate_crop = image_rgb[int(y1):int(y2), int(x1):int(x2)]
               
               # Extract text
               ocr_results = ocr_reader.readtext(plate_crop)
               if ocr_results:
                   text = ocr_results[0][1]
                   confidence = float(ocr_results[0][2])  # Convert to native Python float
                   plates.append({'text': text, 'confidence': confidence})
   
   return plates

# Usage Example
results = recognize_license_plate('sample_car_with_license.jpeg')
print(results)
        

Find EULPR Datasets

Discover curated EU license-plate datasets on Hugging Faceโ€”ready for immediate training or fine-tuning.

EULPR Datasets

Contact

Custom implementation and support are available. Contact me at f@finbarrs.eu for more information.