How xactai/eli-alpr works
Project type and purpose
• This is an embedded, real-time computer-vision pipeline written in C++ for the NVIDIA Jetson Nano.
• Its purpose is Automatic License Plate Recognition (ALPR) by cascading three YOLO/Darknet models: vehicle detection, license-plate detection, and optical character recognition (OCR).
• Input can be images, video files, USB/MIPI cameras, RTSP/HLS streams; output is recognized plate text (CLI, JSON over HTTP) plus optional MJPEG stream of annotated frames.
File‐structure highlights
• Top-level:
• CMakeLists.txt / YOLO_ALPR.cbp – build scripts
• config.json – runtime settings (input source, model paths, thresholds, output ports/folders)
• models/ – three sets of Darknet network files (.cfg, .weights, .names)
• / & src/ – six modules:
– RTSPcam – video capture & ROI cropping
– Regression – heuristic post-processing (sorting letters, deduplication)
– Tjson – JSON serialization
– http_stream – HTTP server for JSON output (port 8070)
– MJPG_sender – HTTP MJPEG server for annotated video (port 8090)
– Numbers – numeric/string helper utilities
• src/main.cpp – orchestrates module initialization, model loading, processing loop.
Key architectural patterns
• Pipeline pattern: linear, stage-by-stage processing of frames (capture → detect → crop → detect → crop → OCR → post-process → output).
• Modular design: each stage is encapsulated in its own module/class with a clear interface.
• Configuration-driven: behavior is toggled via config.json (input source selection, thresholds, folder outputs, flags for CLI vs render).
Main components and interactions (to show
a. Configuration Loader
• Reads config.json at startup → supplies parameters to all modules.
b. Video Input Module (RTSPcam)
• Opens the selected VIDEO_INPUT (image, folder, video, usbcam, CSI, CCTV, HLS).
• Applies global Region-of-Interest (RoI) crop.
• Emits raw frames to the Processing Pipeline.
c. Processing Pipeline – three sequential YOLO/Darknet stages (all GPU/CUDA accelerated):
→ crop each vehicle region
→ crop each plate region
3. OCR Model → runs character detection/recognition → outputs alphanumeric string
d. Heuristic Module (Regression)
– Sorts OCR detections by position, removes duplicates.
e. Output Modules
1. Tjson + http_stream → serialize plate data to JSON → serve on HTTP port 8070
3. CLI Logger → optionally print text to terminal
4. (Optional) File Writers → save debug images/JSONs to disk if folder paths ≠ “none”