How otienta/project_computer_vision works
Project type and purpose
• This is a Python-based, single-container (monolithic) “full-stack” application with an interactive web UI (Streamlit) on the front end and a video processing/detection/tracking pipeline on the back end.
File structure
• Top-level files:
– app.py: Streamlit UI and orchestration of the processing pipeline
– detector.py: wraps YOLOv8 inference for object detection
– track.py: implements multi-object tracking logic and writes tracking_log.csv
– audio.py: audio-based emergency signal detection
– evaluator.py: computes metrics or comparison against ground truth
– fine_tune.py: script to fine-tune YOLOv8 on custom classes
– generate_report.py: builds PDF reports (via reportlab) and aggregates CSV logs
– utils.py: shared helper functions (video I/O, heatmap generation, etc.)
– requirements.txt / packages.txt: dependencies (Streamlit, OpenCV, ultralytics, numpy, pandas, reportlab, scipy)
• Directories:
– sample_video/: test inputs & ground-truth CSV
– output/: processed videos, heatmaps, PDF reports, CSV logs
• Models: yolov8n.pt, yolov8s.pt, yolov8n_finetuned.pt
• Logs: detection_system.log, test_tracking.csv
README for additional insights
• Confirms technology stack (Streamlit, OpenCV, YOLOv8, reportlab, pandas).
• Describes features (real-time detection/tracking, emergency mode, heatmaps, PDF/CSV output).
• Usage flow: streamlit run app.py → upload/select video → choose classes/mode → view/download.
Main components & interactions
a. Frontend (Streamlit UI)
– app.py
– Accepts user inputs: video file, object classes, emergency mode toggle
– Displays live video frames with detection/tracking overlay, heatmap preview, download buttons
b. Video Processing Pipeline
– Video Reader (OpenCV)
– Detector (YOLOv8 model in detector.py)
– Tracker (track.py)
– Audio Detector (audio.py)—optional branch when emergency mode enabled
– Evaluator (evaluator.py)—optional, for ground-truth comparison
– Heatmap Generator (utils.py)
c. Report & Logging Subsystem
– CSV Logger (track.py writes tracking_log.csv)
– PDF Report Generator (generate_report.py using reportlab & pandas)
d. Storage Outputs
– Video outputs (.mp4) with overlays in output/
– Heatmap images or embedded in PDF
– Report PDFs in output/
– CSV logs in output/
– detection_system.log for system-level logs
e. External Services/Resources
– Pretrained YOLOv8 weights (yolov8n.pt, etc.)
– Python packages (Streamlit, ultralytics, OpenCV)
Architectural patterns & design principles
• Monolithic, modular Python application—each feature in its own module
• Pipeline pattern for video processing (reader → detector → tracker → post-processors)
• Model abstraction: detector.py encapsulates all YOLO inference details
• Separation of concerns: UI vs. core processing vs. reporting vs. logging
• Dependency injection via function parameters / utils module for shared code