Skip to content

Detects Swedish vehicles and displays the owner's name using YOLO and license plate recognition.

License

Notifications You must be signed in to change notification settings

Segergren/swedish-license-plate-alpr

Repository files navigation

License Plate Recognition and Vehicle Tracking System

This project is designed to detect vehicles, recognize license plates, and track vehicles using a combination of YOLO object detection and DeepSORT tracking. The system is capable of recognizing Swedish license plates and fetching relevant vehicle data from an external source.

Screenshot 2024-09-14

demo.mp4

Features

  • Vehicle Detection: Detects cars, motorcycles, buses, and trucks using the YOLOv8 model.
  • License Plate Recognition: Recognizes license plates using OCR and verifies Swedish license plates.
  • Vehicle Tracking: Tracks vehicles across frames using the DeepSORT tracking algorithm.
  • Data Fetching: Fetches vehicle-related data from a website based on the recognized license plate.

How it Works

  1. Vehicle Detection: The YOLO model detects vehicles in the video feed.
  2. Tracking: The detected vehicles are tracked with unique IDs.
  3. License Plate Detection: The system detects license plates within the vehicle bounding boxes.
  4. License Plate Recognition: OCR is used to recognize and validate the text on license plates.
  5. Data Fetching: If a valid license plate is found, vehicle information and owner is fetched from Biluppgifter.se and Ratsit.

Dependencies

  • ultralytics: For YOLO-based object detection.
  • cv2: OpenCV for video processing.
  • deep_sort_realtime: For vehicle tracking.
  • paddleocr: For license plate text recognition.
  • requests & BeautifulSoup: For scraping vehicle data from a website.

Running the Project

  1. Follow the steps bellow or use INSTALL.bat to install automatically.
  2. Install python (3.10.0 to 3.10.15)
  3. Download and install Cuda 11.7
  4. Install Torch
    Option 1 (GPU)
    pip3 install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/test/cu118
    Option 2 (CPU)
    pip3 install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/test/cpu
  5. (If you selected Option 1) Install paddlepaddle-gpu:
    python -m pip install paddlepaddle-gpu==2.6.1.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
  6. Install dependencies:
    pip install -r requirements.txt
  7. Run the main script to process a video file:
    python main.py

Files

  • main.py: Core logic for detecting, tracking, and recognizing vehicles and license plates.
  • utils.py: Helper functions for OCR, data fetching, and license plate validation.

License

This project is licensed under MPL 2.0.

Releases

No releases published

Packages

No packages published

Languages