Skip to content
Mathew edited this page Feb 20, 2024 · 1 revision

Project Structure

Overview

This document outlines the architecture and workflow of the Automatic License Plate Recognition (ALPR) system. The ALPR system is designed to detect and recognize vehicle license plates from video feeds in real-time. It leverages deep learning models for detection and recognition, integrating with a graphical user interface (GUI) for interaction and management.

Project Structure

Main Components

  • AI Models (ai/): Contains the image processing and machine learning models, including YOLOv5 models for plate and character recognition.
  • Configuration (config/): Houses configuration parameters and settings, such as paths to models and video sources.
  • Database (database/): Manages database operations, including entries for recognized plates and resident information.
  • GUI (gui/): Contains UI design files and icons, facilitating user interaction with the system.
  • Helpers (helper/): Provides utility functions for text processing, GUI elements creation, and other helper functions.
  • Models (models/): Stores the trained YOLOv5 models for license plate detection and character recognition.
  • Residents (residents/): Manages resident data, including viewing, editing, and adding new residents.

Main Files

  • home-yolo.py: The main entry point of the application. It initializes the GUI, connects signals and slots, and starts the video processing and recognition tasks.
  • img_model.py: Contains functions for image preprocessing, including sharpening, brightening, and resizing.
  • gui_maker.py: Provides functions to create and manage GUI elements dynamically.
  • text_decorators.py: Offers text processing utilities, such as conversion between English and Persian text, and cleaning and formatting plate numbers.

Application Workflow

Initialization

Upon launching the application through home-yolo.py, the system initializes the main window, setting up the GUI layout and connecting UI actions (e.g., button clicks) to their respective functions.

Video Processing

The application captures video frames from a predefined source, which can be a live camera feed or a video file. This process is handled by a separate thread (Worker1) to ensure the UI remains responsive.

Plate Detection

For each frame, the system utilizes a YOLOv5 model (modelPlate) to detect license plates. Detected plates are then cropped from the frame for further processing.

Character Recognition

Cropped plates are passed to another YOLOv5 model (modelCharX) designed to recognize characters on the plates. The system processes these characters to form the complete plate number.

Database Interaction

Recognized plate numbers are checked against a database to retrieve or update information about the vehicle or resident associated with the plate. This includes logging entry times, checking for resident status, and managing resident information.

GUI Updates

The GUI is updated in real-time to display recognized plates, along with other relevant information (e.g., resident status, entry logs). Users can interact with the GUI to manage residents, view entry logs, and adjust system settings.

Multithreading

The application employs Qt's threading (QThread) to handle video processing and GUI updates concurrently, ensuring smooth operation and responsive user interaction.

Technical Considerations

  • PySide6 and Qt: Used for the GUI, providing a cross-platform framework for the application interface.
  • Torch and YOLOv5: Utilized for deep learning tasks, including plate detection and character recognition.
  • SQLite: Acts as the database backend, managing data related to plates and residents.

Conclusion

This document provides a high-level overview of the ALPR system's architecture and workflow. By separating concerns into distinct components and leveraging modern frameworks and models, the system efficiently processes video feeds to recognize license plates and manage associated data, all while maintaining a user-friendly interface.