How thaitom/tdetectors works
Project Type and Purpose
• This is a domain-specific computer vision pipeline (not a typical web full-stack app).
• Purpose: ingest multi-camera video streams, run a cascade of CV models (vehicle & plate detection, plate OCR, vehicle re-identification, multi-object tracking), and expose results (video output, clusters) via scripts and an API.
File Structure
• Top-level entry points:
• main.py (root)
• src/main.py & src/Vehicle_and_License.py & src/tracking.py (alternative CLI wrappers)
• API layer: api/routes.py
• Configuration: config/global_config.example.yml
• Data ingestion / preparation: data/… (multiple datasets, camera lists, raw data scripts)
• Model definitions & training: models/MOT (BoT-SORT config),
models/ReID (triplet sampler, loss, scheduler, embeddings),
models/modelLicensePlate (YOLOv12 detection & OCR)
• Utilities: utils/ (crop & extract helpers)
• Demo assets: demo/ (images/videos)
Extract Key Architectural Insights from the README
• Pipeline stages are optimized with Intel OpenVINO
• YOLOv12 used for detection, CCT for OCR, multi-branch networks for Re-ID, BoT-SORT for tracking
• CLI usage and Python API both supported
Main Components & Their Interactions
a. External Inputs
• Traffic cameras (live RTSP or video files)
• Pre-collected datasets (Roboflow, MTMC, Vehicle-1M, etc.)
b. Data Ingestion & Pre-processing
• data/… scripts and utils/crop_and_extract.py prepare frames, normalize, annotate
• Configuration loader (config/global_config.yml) defines camera lists, model paths
c. Inference Pipeline
1. Vehicle & Plate Detection (YOLOv12 via OpenVINO)
2. License Plate Recognition (CCT model)
3. Feature Embedding (Re-ID network: triplet sampler, multi-branch learner)
4. Multi-Object Tracking (BoT-SORT algorithm)
d. API Server (api/routes.py)
• Exposes endpoints to submit video streams / frames and retrieve JSON results or annotated video
e. Output & Storage
• Annotated videos in demo/videos or output/
• Re-ID clusters via models/ReID/cluster_from_camera_hcm.py
• Logs & metrics via TensorBoard (models/ReID/tensorboard_log.py)
f. CLI & Demo (src/… wrappers, main.py for local testing)
Architectural Patterns & Design Principles
• Pipeline (staged): each stage is a clear module (Detection → OCR → Embedding → Tracking)
• Modularity/Separation of Concerns: separate folders for data, models, API, utilities
• Configuration-driven: YAML configs to swap cameras or model weights without code changes
• Optional Microservice Split: detection and re-ID/tracking can be extracted to independent services behind the API
Final Checklist
• [ ] All major components represented (Camera Inputs, Ingestion, Detection, OCR, Re-ID, Tracking, API, Storage)
• [ ] Configuration service or file store noted