How idogalil/people-counting-system works
Main Components
a. Input Sources
• IP Camera or Video File (external video feed)
b. Orchestration Layer
• main.py + FrameProcessor.py
• Coordinates reading frames, invoking detection, tracking, counting, and output.
c. Detection Module
• yolov3 package
• yolo_detection_model.py (loads the .h5 weights)
• decoder_layer.py, yolo_util.py (post-processing, anchor handling)
• model_data folder
• coco_anchors.txt, coco_classes.txt, downloaded YOLOv3-416.h5
d. Tracking Module
• tracker.py
• DCF-CSR / CSRT trackers encapsulated here
e. Counting Module
• counter.py
• Line-crossing logic, DI and MCDF parameters loaded from env.env
f. Utilities
• util/
• bounding_box.py (geometry)
• debugger.py (visual overlays)
• detection_roi.py (region-of-interest cropping)
• logger.py (structured logging)
• objects.py (track and detection data structures)
g. Output / Storage
• Annotated Video Stream (display, saved file, or streaming output)
• Logs / CSV or other counts output
• (Optionally) External Dashboard or Database
h. Configuration
• requirements.txt (dependency list)
• env.env (CUDA, GPU flags, DI, MCDF, other hyperparameters)
Relationships & Data Flow
1. Video Source → FrameProcessor
→ FrameProcessor pulls raw frames.
2. FrameProcessor → Detection Module (YOLOv3)
3. Detections → Tracking Module
→ tracker assigns persistent IDs across frames.
4. Tracks → Counting Module
→ logic checks ROI/virtual lines for “enter” vs “exit” events.
5. Counting Results → Logger & Output
→ annotated frame via Debugger + count updates logged to file or console.
6. Utilities invoked at each step for debugging, ROI filtering, and logging.
7. All modules read configuration from env.env and model_data.
Architectural Patterns & Principles
• Pipeline architecture: linear sequence (Input → Detect → Track → Count → Output)
• Separation of concerns: detection, tracking, counting, and utilities are in independent modules
• Modular design: easy to swap detector or tracker (noted in README)
• Config-driven parameters: DI, MCDF, paths set in env.env
Technologies & Frameworks
• Python 3.6.10
• TensorFlow / Keras (for YOLOv3 .h5 model)
• OpenCV (video I/O, CSRT tracker)
• CUDA 9.0 + GPU acceleration
• pip dependencies in requirements.txt