Traffic Signs Recognition, Vehicle Plate and Person Blurring System

1. Introduction

This project implements a comprehensive computer vision system for real-time traffic sign recognition while ensuring privacy protection through automatic blurring of vehicle plates and individuals. Designed for autonomous vehicle applications, the system employs multiple YOLO models to detect traffic signs, identify vehicles, and maintain privacy in video surveillance scenarios.

The project addresses the growing need for intelligent transportation systems that balance functionality with privacy protection. By combining traffic sign recognition with GDPR-compliant privacy features, the system provides a complete solution for autonomous vehicles and smart city applications. The implementation demonstrates practical applications of multi-model computer vision pipelines for real-world traffic monitoring scenarios.

Core Features:

2. Methodology / Approach

The system employs a sophisticated multi-model architecture using three specialized YOLOv11 models, each optimized for specific detection tasks. This modular approach ensures high accuracy across all functions while maintaining real-time performance.

2.1 System Architecture

The traffic monitoring pipeline consists of multiple processing stages:

  1. Traffic Sign Detection: Custom-trained YOLOv11l model recognizes 24 urban traffic signs
  2. Vehicle Detection: Pre-trained YOLOv11l identifies cars, motorcycles, buses, and trucks
  3. Vehicle Plate Detection: Specialized model trained on Turkish plates for privacy masking
  4. Person Detection: YOLO-based person identification for GDPR compliance
  5. Privacy Protection: Gaussian blur application to sensitive regions
  6. Annotation & Recording: Visual overlays and video output generation

2.2 Implementation Strategy

The implementation leverages Ultralytics YOLOv11 framework for all detection tasks. Each model operates independently but sequentially in the pipeline, allowing for modular updates and improvements. The traffic sign model uses high confidence thresholds (0.8) to ensure safety-critical accuracy, while vehicle plate and person detection use moderate thresholds (0.55) for comprehensive privacy protection.

Processing Flow:

Video Frame โ†’ Traffic Sign Detection โ†’ Vehicle Detection โ†’ Plate Detection โ†’ Person Detection โ†’ Blur Application โ†’ Annotation โ†’ Output

Detection confidence thresholds are carefully tuned:

2.3 Privacy Protection Strategy

The system implements a two-stage privacy protection mechanism:

Stage 1 - Person Detection:

Stage 2 - Vehicle Plate Detection:

This approach ensures privacy compliance while maintaining traffic sign visibility for analysis.

3. Mathematical Framework

3.1 YOLO Detection Algorithm

YOLOv11 processes images through a single neural network, dividing the input into an \(S \times S\) grid. For each grid cell, the model predicts bounding boxes and class probabilities:

Bounding Box Prediction:

$$\mathbf{B} = [x, y, w, h, c]$$

where:

Class Prediction:

$$P(C_i|\text{Object}) = \text{softmax}(\mathbf{z}_i)$$

where \(\mathbf{z}_i\) are the logits for class \(i\).

Final Detection Score:

$$\text{Score}_{i,j} = P(\text{Object}) \times P(C_j|\text{Object})$$

Detections with \(\text{Score}_{i,j} < \tau\) (threshold) are filtered out:

3.2 Non-Maximum Suppression (NMS)

To eliminate duplicate detections, NMS is applied based on Intersection over Union (IoU):

IoU Calculation:

$$\text{IoU}(B_1, B_2) = \frac{\text{Area}(B_1 \cap B_2)}{\text{Area}(B_1 \cup B_2)}$$

NMS Algorithm:

  1. Sort detections by confidence score (descending)
  2. Select highest confidence detection \(B_{\max}\)
  3. Remove all \(B_i\) where \(\text{IoU}(B_i, B_{\max}) > \tau_{\text{NMS}}\) (typically 0.45)
  4. Repeat until no detections remain

3.3 Gaussian Blur Operation

Privacy protection is achieved through Gaussian blur, a convolution operation with a Gaussian kernel:

2D Gaussian Function:

$$G(x, y) = \frac{1}{2\pi\sigma^2} e^{-\frac{x^2 + y^2}{2\sigma^2}}$$

where \(\sigma\) is the standard deviation controlling blur strength.

Convolution Operation:

$$I'(x, y) = \sum_{i=-k}^{k} \sum_{j=-k}^{k} I(x+i, y+j) \cdot G(i, j)$$

where:

Person Blur Parameters:

Vehicle Plate Blur Parameters:

3.4 Loss Functions (Model Training)

The YOLOv11 models were trained using a composite loss function:

Total Loss:

$$\mathcal{L}_{\text{total}} = \lambda_{\text{box}} \mathcal{L}_{\text{box}} + \lambda_{\text{cls}} \mathcal{L}_{\text{cls}} + \lambda_{\text{obj}} \mathcal{L}_{\text{obj}}$$

Box Regression Loss (CIoU):

$$\mathcal{L}_{\text{box}} = 1 - \text{CIoU} + \frac{\rho^2(\mathbf{b}, \mathbf{b}^{gt})}{c^2} + \alpha v$$

where:

Classification Loss (Binary Cross-Entropy):

$$\mathcal{L}_{\text{cls}} = -\sum_{i=1}^{C} \left[ y_i \log(\hat{p}_i) + (1-y_i)\log(1-\hat{p}_i) \right]$$

where:

Objectness Loss:

$$\mathcal{L}_{\text{obj}} = -\sum_{i=1}^{N} \left[ \mathbb{1}_i^{\text{obj}} \log(\hat{c}_i) + (1-\mathbb{1}_i^{\text{obj}})\log(1-\hat{c}_i) \right]$$

where:

3.5 Performance Metrics

Precision: Accuracy of positive predictions

$$\text{Precision} = \frac{TP}{TP + FP}$$

Recall: Ability to find all positive instances

$$\text{Recall} = \frac{TP}{TP + FN}$$

F1 Score: Harmonic mean of precision and recall

$$F_1 = 2 \times \frac{\text{Precision} \times \text{Recall}}{\text{Precision} + \text{Recall}}$$

Mean Average Precision (mAP):

$$\text{mAP} = \frac{1}{C} \sum_{i=1}^{C} \text{AP}_i$$

where \(\text{AP}_i\) is the Average Precision for class \(i\), calculated as the area under the Precision-Recall curve.

3.6 Coordinate Transformations

Bounding Box Center Calculation:

$$x_{\text{center}} = \frac{x_1 + x_2}{2}, \quad y_{\text{center}} = \frac{y_1 + y_2}{2}$$

where \((x_1, y_1)\) and \((x_2, y_2)\) are the top-left and bottom-right corners.

Text Centering (Traffic Sign Labels):

$$x_{\text{text}} = x_1 + \frac{(x_2 - x_1) - w_{\text{text}}}{2}$$

$$y_{\text{text}} = y_1 - 10$$

where \(w_{\text{text}}\) is the width of the label text.

4. Requirements

opencv-python>=4.5.0
numpy>=1.21.0
ultralytics>=8.0.0

5. Installation & Configuration

5.1 Environment Setup

# Clone the repository
git clone https://github.com/kemalkilicaslan/Traffic-Signs-Recognition-Vehicle-Plate-and-Person-Blurring-System.git
cd Traffic-Signs-Recognition-Vehicle-Plate-and-Person-Blurring-System

# Install required packages
pip install -r requirements.txt

5.2 Project Structure

Traffic-Signs-Recognition-Vehicle-Plate-and-Person-Blurring-System/
โ”œโ”€โ”€ Traffic-Signs-Recognition-Vehicle-Plate-and-Person-Blurring-System.py
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ LICENSE

5.3 Required Models

Download and place these model files in the project directory:

6. Usage / How to Run

6.1 Basic Execution

python Traffic-Signs-Recognition-Vehicle-Plate-and-Person-Blurring-System.py

6.2 Configuration

Update the video filename in the script:

video = 'Traffic.mp4'  # Change to your video file

6.3 Adjusting Detection Thresholds

Modify confidence thresholds based on your requirements:

# In the script, modify these parameters:

# Traffic sign detection (high precision for safety)
traffic_signs_results = traffic_signs_detection_model(frame, conf=0.8)

# Person detection (comprehensive privacy)
yolov11_results = YOLO_model(frame, conf=0.55)

# Vehicle plate detection (within vehicle regions)
plate_results_in_vehicle = vehicle_plate_detection_model(vehicle_region, conf=0.55)

6.4 Customizing Blur Strength

Adjust Gaussian blur parameters for different privacy requirements:

# Person blurring (moderate anonymization)
blurred_person = cv2.GaussianBlur(person_region, (99, 99), 30)

# Vehicle plate blurring (extreme unreadability)
blurred_plate = cv2.GaussianBlur(plate_region, (255, 255), 30)

# Custom blur settings:
# - Kernel size must be odd numbers (e.g., 51, 99, 151, 255)
# - Larger kernels = stronger blur
# - Sigma (last parameter) controls blur spread

6.5 Output

The processed video is saved as:

Traffic-Signs-Recognition-Vehicle-Plate-and-Person-Blurring.mp4

7. Application / Results

7.1 Input Video

7.2 Output Video

7.3 Model Performance

7.3.1 Vehicle Plate Detection Model

Training Configuration:

Performance Metrics:

Metric Value
Precision 95.2%
Recall 92.8%
F1 Score 0.940
mAP@0.5 96.1%
mAP@0.5:0.95 78.4%
Vehicle Plates Model Performance

Training Results Analysis:

The training curves show:

7.3.2 Traffic Signs Recognition Model

Training Configuration:

Performance Metrics:

Metric Value
Precision 93.7%
Recall 89.4%
F1 Score 0.915
mAP@0.5 94.8%
mAP@0.5:0.95 81.2%
Traffic Signs Model Performance

Training Results Analysis:

The training curves demonstrate:

7.4 Detection Examples

Traffic Sign Recognition:

Privacy Protection:

7.5 System Performance

Component Processing Time (ms/frame) Accuracy
Traffic Sign Detection 15-20 ms 94.8% mAP
Vehicle Detection 12-18 ms ~95% (COCO)
Plate Detection 8-12 ms 96.1% mAP
Person Detection 10-15 ms ~90% (COCO)
Blur Application 5-10 ms 100% coverage
Total Pipeline 50-75 ms ~13-20 FPS

8. Traffic Sign Classes

The system recognizes 24 traffic signs organized by category:

8.1 Speed Limits (7 classes)

8.2 Traffic Control (6 classes)

8.3 Turn Restrictions (3 classes)

8.4 Parking & Stopping (3 classes)

8.5 Special Zones (5 classes)

9. How It Works (Pipeline Overview)

9.1 Multi-Model Detection Flow

                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚  Input Frame  โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ–ผ
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚               TRAFFIC SIGN DETECTION (Stage 1)          โ”‚
  โ”‚  Model: Traffic-Signs-Recognition.pt (Confidence: 0.8)  โ”‚
  โ”‚  Output: 24-class classification with bounding boxes    โ”‚
  โ”‚  Action: Draw centered labels with white background     โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ–ผ
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚            VEHICLE & PERSON DETECTION (Stage 2)   โ”‚
     โ”‚  Model: yolo11l.pt (Confidence: 0.55)             โ”‚
     โ”‚  Classes: Person, Car, Motorcycle, Bus, Truck     โ”‚
     โ”‚  Output: Bounding boxes for contextual detection  โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              PRIVACY PROTECTION (Stage 3)                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ PERSON BLURRING                                       โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Full-body region extraction                         โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Gaussian blur: kernel (99ร—99), sigma=30             โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Replace original region with blurred version        โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ VEHICLE PLATE BLURRING                                โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Crop vehicle region from frame                      โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Detect plates within vehicle region (conf: 0.55)    โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Gaussian blur: kernel (255ร—255), sigma=30           โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Replace plate region with extreme blur              โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ–ผ
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚                  VISUALIZATION & OUTPUT           โ”‚
     โ”‚  โ€ข Display annotated frame with cv2.imshow()      โ”‚
     โ”‚  โ€ข Write frame to output video file               โ”‚
     โ”‚  โ€ข Check for 'q' key press to exit                โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚ Output Frame  โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

9.2 Processing Sequence Diagram

Frame N
   โ”‚
   โ”œโ”€โ”€โ–บ [Traffic Sign Detection] โ”€โ”€โ–บ 24 classes @ 80% confidence
   โ”‚                                   โ”‚
   โ”‚                                   โ””โ”€โ”€โ–บ Label overlay (centered, white bg)
   โ”‚
   โ”œโ”€โ”€โ–บ [YOLO Detection] โ”€โ”€โ–บ Person, Car, Motorcycle, Bus, Truck
   โ”‚                          โ”‚
   โ”‚                          โ”œโ”€โ”€โ–บ [Person] โ”€โ”€โ–บ Extract region โ”€โ”€โ–บ Blur (99ร—99) โ”€โ”€โ–บ Replace
   โ”‚                          โ”‚
   โ”‚                          โ””โ”€โ”€โ–บ [Vehicle] โ”€โ”€โ–บ Crop region โ”€โ”€โ–บ [Plate Detection @ 55%]
   โ”‚                                                                  โ”‚
   โ”‚                                                                  โ””โ”€โ”€โ–บ Blur (255ร—255) โ”€โ”€โ–บ Replace
   โ”‚
   โ””โ”€โ”€โ–บ [Output Writer] โ”€โ”€โ–บ Save frame

Frame N+1
   ...

9.3 Detailed Algorithm

FOR each video frame:
    # Stage 1: Traffic Sign Recognition
    traffic_signs = traffic_signs_model.detect(frame, conf=0.8)
    FOR each sign in traffic_signs:
        draw_bounding_box(frame, sign.box)
        label = f"{sign.class_name} {sign.confidence:.2f}"
        draw_centered_label(frame, sign.box, label)

    # Stage 2: Vehicle & Person Detection
    detections = yolo11l_model.detect(frame, conf=0.55)

    FOR each detection in detections:
        IF detection.class == 'person':
            # Privacy: Blur entire person
            person_region = extract_region(frame, detection.box)
            blurred_person = gaussian_blur(person_region, kernel=99, sigma=30)
            replace_region(frame, detection.box, blurred_person)

        ELIF detection.class IN ['car', 'motorcycle', 'bus', 'truck']:
            # Contextual plate detection
            vehicle_region = extract_region(frame, detection.box)
            plates = plate_model.detect(vehicle_region, conf=0.55)

            FOR each plate in plates:
                # Adjust coordinates to original frame
                plate_box_global = adjust_to_frame_coordinates(plate.box, detection.box)

                # Privacy: Blur plate beyond recognition
                plate_region = extract_region(frame, plate_box_global)
                blurred_plate = gaussian_blur(plate_region, kernel=255, sigma=30)
                replace_region(frame, plate_box_global, blurred_plate)

    # Stage 3: Output
    display(frame)
    write_to_video(frame)

    IF key_pressed == 'q':
        BREAK

10. Tech Stack

10.1 Core Technologies

10.2 Dependencies

Library Version Purpose
opencv-python 4.5+ Video processing, frame manipulation, blur operations
ultralytics 8.0+ YOLO model inference and detection
numpy 1.21+ Array operations and coordinate calculations

10.3 Model Architecture

10.3.1 YOLOv11l Base Architecture

Backbone:

Neck:

Head:

Model Statistics:

10.3.2 Custom Model Specifications

Traffic Signs Recognition Model:

Vehicle Plate Detection Model:

General Object Detection Model:

11. Privacy & Compliance

11.1 GDPR Compliance Features

The system implements multiple privacy protection measures:

Personal Data Protection:

Data Minimization:

Privacy by Design:

11.2 Regulatory Considerations

GDPR Article 25 Compliance:

12. License

This project is open source and available under the Apache License 2.0.

13. References

  1. Ultralytics YOLOv11 Documentation.
  2. European Union. (2016). General Data Protection Regulation (GDPR). Official Journal of the European Union.
  3. OpenCV Image Filtering Documentation.

Acknowledgments

Special thanks to the Ultralytics team for developing and maintaining the YOLOv11 framework. This project benefits from the OpenCV community's excellent computer vision tools. The custom models were trained using publicly available traffic sign and vehicle plate datasets for educational and research purposes. Privacy protection features are designed with GDPR compliance principles in mind.


Note: Ensure you have proper permissions and comply with privacy regulations when using vehicle plate detection and person recognition technology. This system is designed with GDPR compliance in mind and includes automated privacy protections. This project is intended for educational and research purposes in autonomous vehicle development and privacy-compliant surveillance systems. Always verify compliance with local data protection laws before deploying in production environments.