scieee AI-readable full text Open interactive document viewer

Real-Time License Plate Recognition using YOLOv9 and Embedded Systems

DJERBI, rachid; Benmoussa, Kahina; Gherbi, Fatima

Abstract

This research develops an optimized deep learning-based License Plate Recognition (LPR) system, comparing YOLOv8 and YOLOv9 with integrated OCR for improved text extraction. The YOLOv9-OCR combination outperforms YOLOv8 in detection accuracy and efficiency, especially in challenging conditions. The implementation phase involves deploying the trained model on a Raspberry Pi, creating an autonomous, embedded LPR system. Results and performance analysis show that YOLOv9, when combined with OCR, outperforms YOLOv8 in terms of detection accuracy and efficiency, particularly in challenging conditions such as low lighting and occlusions.

Full text

Real-Time License Plate Recognition using YOLOv9 and Embedded Systems Rachid Djerbi1, Kahina Benmoussa1, and Fatima Gherbi1 1Department of Computer Science, Faculty of Sciences, University M’Hamed Bougara of Boumerdes, [email protected],[email protected],[email protected] Abstract This research develops an optimized deep learning-based License Plate Recognition (LPR) system, comparing YOLOv8 and YOLOv9 with integrated OCR for improved text extraction. The YOLOv9-OCR combination outperforms YOLOv8 in detection accuracy and efficiency, especially in challenging conditions. The implementation phase involves deploying the trained model on a Raspberry Pi, creating an autonomous, embedded LPR system. Results and performance analysis show that YOLOv9, when combined with OCR, outperforms YOLOv8 in terms of detection accuracy and efficiency, particularly in challenging conditions such as low lighting and occlusions.. KEYWORDS Deep learning, CNN, LPR, YOLOv8, YOLOv9, OCR, Raspberry Pi, object detection. 1 Introduction Deep learning, a branch of artificial intelligence and big data, has experienced unprecedented growth and development in recent years [1][2]. This rapid advancement has opened new possibilities to solving complex real-world problems, including the challenging task of automatic license plate recognition in public institutions [3][4][5]. Automatic License Plate Recognition (LPR) is crucial for intelligent transportation [6][7] and surveillance systems [8][9]. This study leverages deep learning to enhance LPR, focusing on YOLOv9 [10][11] for license plate detection and OCR [16] for textual information extraction [12][13], implemented on a Raspberry Pi [14][15]. 2 Literature Review Deep learning, particularly CNNs[17][18], has revolutionized image processing. YOLO algorithms [19] have gained prominence in object detection [20][21][22]. LPR systems benefit from deep learning-based approaches, outperforming traditional methods. OCR is crucial for character extraction from detected plates. Embedded systems like Raspberry Pi are viable platforms for AI applications. 3 Architecture of Convolutional Neural Network The architecture of any CNN includes convolution layers (CONV), pooling layers (POOL), and fully connected layers (FC). The convolution layer detects specific features, the pooling layer reduces the size of feature maps, and the fully connected layer classifies the input image. 164 4 Our general operating steps of LPR Our general operating steps include data loading, training phase, model initialization, model training, model tuning and model saving. 5 Methodology Our research methodology focuses on developing an efficient and accurate License Plate Recognition system using YOLOv9, integrated with OCR. This includes model selection, data preparation, training processes, and system implementation. 5.1 Model Selection and Architecture YOLOv9 was selected for its superior performance in real-time object detection tasks. It incorporates advanced optimizations for fast and precise recognition. 5.2 YOLOv9 Hyperparameters and Activation Functions We carefully tuned several hyperparameters to optimize the model’s performance: •Batch size: Number of images processed before updating internal model parameters. •Epochs: Number of complete passes over the entire dataset. •Img size: Dimension to which all images are resized before being fed into the model. •Patience: Number of epochs to wait without improvement before stopping training. •Cache: Setting to enable caching of dataset images for improved training speed. •Save period: Frequency for saving model checkpoints (in epochs). •Optimizer: We chose AdamW, a variation of the Adam optimizer with weight decay [23]. •Activation function: We primarily used Leaky ReLU for activation functions to address the ”dying ReLU” problem and ensure better model robustness when detecting license plates [24]. 5.3 Data Preprocessing and Augmentation The Roboflow platform [25] was utilized for data preprocessing, including data collection, duplicate removal, normalization, and encoding. Data augmentation techniques were employed to enhance the model’s robustness. 5.4 Model Training and Optimization The YOLOv9 model was trained using the prepared dataset and initialized with pre-trained weights. Hyperparameters were fine-tuned, and the learning rate was adjusted. 165 5.5 Performance Monitoring and Evaluation Weights & Biases (W&B) was integrated for real-time experiment tracking and data visualization. Key metrics included Mean Average Precision (mAP), Precision, Recall, and F1-Score. 5.6 Text Recognition Process OCR converts images of text into machine-readable text, relying on advanced algorithms. The OCR process includes grayscale conversion, character segmentation, and verification against the Algerian license plate format (see Figure 1). Figure 1: Algerian license plate 6 Implementation steps The implementation steps involve experimental setup, dataset preparation, model training, and performance evaluation. 6.1 Experimental Setup Tesla T4 GPU was used for training, with deployment on a Raspberry Pi 5 (8 GB RAM). The software environment was built around Python 3.10.12 and TensorFlow 2.17.0 PyTorch 2.4.1+cu121. 6.2 Dataset Preparation The dataset comprised 24,242 images of vehicle license plates from Roboflow, with 87% for training, 8% for validation, and 5% for testing. 6.3 Model Training The YOLOv9 model was initialized with weights pre-trained on the COCO dataset, trained for 20 epochs with a batch size of 16, using the AdamW optimizer. 6.4 Performance Evaluation The YOLOv9-based LPR system achieved a mean Average Precision (mAP50) of 0.98 and a mean Average Precision (mAP50-95) of 0.70. 166 Figure 2: our prototype 6.5 Raspberry Pi Implementation The Raspberry Pi 5 (8 GB RAM) was configured with specific overclocking settings to balance performance and system stability. 6.6 OCR Integration and Performance The OCR system achieved an accuracy of 97% in recognizing alphanumeric characters, with postprocessing to improve accuracy. 6.7 Implementation Tools and Hardware This section details the implementation process of our License Plate Recognition (LPR) system using the YOLOv9 model. We will cover each implementation step, from preparing the development environment to training and evaluating the model. Our discussion will encompass technology choices, hyperparameter configurations, and the tools and libraries utilized in this project. Our implementation relied on two key hardware components (see Figure2). 1Raspberry Pi: We deployed our LPR system using Raspberry Pi 4 and 5 models. The Raspberry Pi, known for its versatility and affordability, provides an ideal platform for embedded AI applications. 2Camera: We employed a 5MP camera designed for Raspberry Pi. This camera module, capable of 2592x1944 pixel static images and 1080p@30fps video recording, connects directly to the Raspberry Pi’s CSI connector, ensuring high-speed data transfer for real-time image processing 2. 6.8 Training Models YOLOv8 and YOLOv9 were trained on the LPRCVP dataset, containing 24,242 images. Specific settings were used for each model. 167 7 Results and Performance Analysis 7.1 YOLOv8 Results YOLOv8 achieved high accuracy in object detection: •Precision: 0.97643 •Recall: 0.9568 •mAP@50: 0.9803 •mAP@50-95: 0.6971 •F1 Score: 0.9655 These metrics indicate high accuracy in detecting and classifying objects, with a strong balance between precision and recall, as demonstrated by the high F1 Score. The mAP values, particularly mAP50, show YOLOv8’s strong capability to detect objects precisely, even under varying Intersection over Union (IoU) thresholds (see Figure 3). Figure 3: Performance curves of the YOLOv8 model during training and validation. 7.1.1 Training and Validation Graphs The training and validation graphs indicated improvements in object localization and classification. 7.2 YOLOv9 Results YOLOv9 also demonstrated high accuracy: •Precision: 0.96821 •Recall: 0.9285 •mAP@50: 0.96649 •mAP@50-95: 0.62807 •F1 Score: 0.97 168 Figure 4: Performance curves of the YOLOv9 model during training and validation. These metrics indicate high accuracy in detecting and classifying objects, with a strong balance between precision and recall, as demonstrated by the high F1 Score. The mAP values, particularly mAP50, show YOLOv9’s strong capability to detect objects precisely, even under varying Intersection over Union (IoU) thresholds (see Figure 4). 7.2.1 Training and Validation Graphs The training and validation graphs indicated improvements in object localization and classification. 7.3 Comparative Analysis of YOLOv9 and YOLOv8 After conducting both experiments with YOLOv9 and YOLOv8 on the same dataset, we reset them with identical hyperparameters to ensure a fair comparison. The results of this comparison, summarized in Table 1, highlight the superior performance of YOLOv9 across all evaluated metrics. Metric YOLOv9 YOLOv8 Precision 0.984 0.976 Recall 0.955 0.956 mAP50 0.985 0.980 mAP50-95 0.696 0.967 F1 Score 0.970 0.9655 Table 1: Performance Comparison between YOLOv9 and YOLOv8 7.4 Detailed Performance Analysis YOLOv9 demonstrates slight advantages in precision and F1 Score, while YOLOv8 excels in mAP50-95. 8 Practical Application with Raspberry Pi The trained YOLOv9 model was successfully applied to detect license plates in various real-world scenarios. 169 8.1 Raspberry Pi, why? 8.1.1 Importance of Embedded Implementation for LPR Systems Embedded systems are crucial for efficient processing and real-time capabilities. 8.1.2 Advantages of Using Raspberry Pi for AI Deployment The Raspberry Pi offers real-time processing, cost-effectiveness, portability, and flexibility. 8.1.3 Objectives of the Raspberry Pi Implementation The objectives include real-time processing, cost-effectiveness, portability, and flexibility. 8.2 Hardware Setup Hardware specifications for Raspberry Pi 4 and 5, camera module 5MP Rev1.3, and additional components. 8.3 Software Environment Raspbian (Raspberry Pi OS) was installed and configured. 8.3.1 Required Libraries and Frameworks OpenCV, TensorFlow Lite, and NumPy were used. 8.4 Model Optimization for Raspberry Pi TensorFlow Lite conversion was performed for efficient execution. 8.5 Physical Implementation Process System architecture overview, image capture and preprocessing, model inference, post-processing, and result visualization. 8.6 Use Case Demonstrations Performance in diverse scenarios such as night (Figure 5) detection, extreme angles, severe weather conditions and multiple vehicle detection (Figure 6). 170 Figure 5: Our model in the night. Figure 6: Extreme angles, severe weather conditions and multiple vehicle detection. 171 9 Conclusion Our hybrid YOLOv9 and OCR model significantly improves license plate detection compared to YOLOv8. It demonstrates high accuracy and reliability across varied testing conditions. Key metrics like mAP and F1-score confirm its optimization for real-world applications. This enhanced performance makes it suitable for diverse and challenging scenarios The Raspberry Pi deployment proves the feasibility of embedded AI for real-time LPR. The system operates efficiently across different environments, maintaining consistent detection. This confirms its potential in smart surveillance and automated toll systems. Its practicality is showcased through effective performance. Thanks to advanced deep learning, our system has advanced LPR technology. Increased accuracy and speed enhance security, traffic monitoring, and smart city projects. Its adaptability allows for deeper integration with IoT systems, paving the way for broader and more versatile applications. Areas for potential improvement include handling extreme angles and severe weather conditions. Future work includes integration with traffic management systems and multi-country license plate recognition. References [1] Nath, D., Ankit, Neog, D. R., & Gautam, S. S. (2024). Application of machine learning and deep learning in finite element analysis: a comprehensive review. Archives of computational methods in engineering, 31(5), 2945-2984. [2] Zhenpeng, Y. (2024). Application of Artificial Intelligence in Computer Network Technology in the Age of Big Data [J]. Journal of Artificial Intelligence Practice, 7(1). [3] Chang, S. L., Chen, L. S., Chung, Y. C., & Chen, S. W. (2004). Automatic license plate recognition. IEEE transactions on intelligent transportation systems, 5(1), 42-53. [4] Joshi, D., & Mohd, N. (2023, May). Techniques used in automatic number plate recognition. In 2023 4th International Conference for Emerging Technology (INCET) (pp. 1-6). IEEE. [5] Calitz, A., & Hill, M. (2020). Automated license plate recognition using existing university infrastructure and different camera angles. The African Journal of Information Systems, 12(2), 4. [6] Khalil, R. A., Safelnasr, Z., Yemane, N., Kedir, M., Shafiqurrahman, A., & Saeed, N. (2024). Advanced learning technologies for intelligent transportation systems: Prospects and challenges. IEEE Open Journal of Vehicular Technology. [7] Nagarajan, S. M., Devarajan, G. G., Bashir, A. K., & Al-Otaibi, Y. D. (2024). Adversarial deep learning based Dampster–Shafer data fusion model for intelligent transportation system. Information Fusion, 102, 102050. [8] Saleh, A., Zulkifley, M. A., Harun, H. H., Gaudreault, F., Davison, I., & Spraggon, M. (2024). Forest fire surveillance systems: A review of deep learning methods. Heliyon, 10(1). [9] Alotaibi, S. R., Mengash, H. A., Maray, M., Alotaibi, F. A., Alkharashi, A., Alzahrani, A. A.,... & Alnfiai, M. M. (2025). Integrating Explainable Artificial Intelligence with Advanced Deep Learning Model for Crowd Density Estimation in Real-world Surveillance Systems. IEEE Access. [10] Sun, Z., & Mariano, V. Y. (2022). SiT-YOLOv9: An Efficient Algorithm for Learning Behavior Detection in the Home Environment. Journal of Computational and Cognitive Engineering. [11] Dolhpolov, S., Honcharenko, T., Hots, V., Kruk, P., & Porokhovnichenko, I. (2023). YOLOv8, YOLOv9, and YOLOv10: A Study in Automated Vehicle Damage Detection. 172