How mr-aicoder/automatic-number-plate-detection-system works
Project Type and Purpose
• Type: A real-time computer-vision pipeline implemented in Python.
File Structure
Top level files:
• main.py (entry point for detection & tracking)
• add_missing_data.py (post-processing/interpolation)
• util.py (OCR, formatting, CSV export helpers)
• yolov8n.pt & license_plate_detector.pt (pretrained YOLOv8 models)
• requirements.txt (dependencies)
Patterns:
– A linear pipeline: Model loading → frame processing → detection → OCR → storage → visualization
– Separation of concerns across scripts (main vs. utils vs. post-processing vs. visualization)
Extract Insights from README.md
• Core steps: model loading, video reading, vehicle detection+tracking (SORT), plate detection, OCR (EasyOCR), result storage (CSV), missing-data interpolation, visualization.
• Dependencies: Ultralytics YOLOv8, SORT (external repo), EasyOCR, OpenCV, pandas/csv.
Main System Components
A. Input Module
– Video Reader (OpenCV VideoCapture)
B. Detection & Tracking
– Vehicle Detector (YOLOv8 pretrained yolov8n.pt)
– SORT Tracker (external module)
C. Plate Detection
– License Plate Detector (YOLOv8 license_plate_detector.pt)
D. OCR & Formatting
– OCR Engine (EasyOCR in util.py)
– Plate Text Formatter (util.py helpers)
E. Data Storage
– CSV Logger (pandas or csv writer in util.py)
F. Post-Processing
– Data Interpolator (add_missing_data.py)
G. Visualization
Component Interactions
1. Video Source → Video Reader
5. Plate crops → OCR → text
6. Combine (frame#, vehicleID, coords, text) → CSV Logger
7. Once base CSV is written → add_missing_data.py interpolates gaps → new CSV
Architectural Patterns & Design Principles
• Pipeline / staged processing: Each script is a stage.
• Modularity & separation of concerns: detection, tracking, OCR, storage, visualization are decoupled.
• Reusability: util.py functions are shared; models loaded once.
• Batch vs. streaming: main.py handles streaming frames in real time.
Putting It All Together
[Video Source]
↓
[Video Reader]
↓
[YOLOv8 Vehicle Detector] ──→ [SORT Tracker]
↓ │
[License Plate Detector] ↓
↓ [util.py → CSV Logger]
[EasyOCR Engine] ↓
↓ [add_missing_data.py]
[Data Formatter] ↓
[CSV File] ─────────────────────→ [Output Video]