How heisumesh2006/traffic_light_detection works
This is a traffic-light detection assistant: camera frames are analyzed by a YOLO model, stabilized detection and distance feed an advisory response, and Flask exposes video and current status to a browser. Gemini-generated guidance is also spoken aloud. A separate utility converts traffic-light annotations to YOLO labels. Source excerpts show the principal calls; the camera endpoint and browser interactions are explicit in configuration/routes, while training and dataset consumption beyond the converter are not shown.
Main entry points: app.py Flask application · realtime_detect.py Detection and distance · main.py Detection stabilization · gemini_assistant.py Gemini response
Components 14
Vision pipeline
- YOLO weights
best.pt - Frame capture
realtime_detect.py - Detection and distance
realtime_detect.py
Guidance and speech
- Detection stabilization
main.py - Gemini response
gemini_assistant.py - Spoken guidance
gemini_assistant.py
Web interface
- Flask application
app.py - Web page
templates/index.html
Dataset preparation
- YOLO label converter
convert_json_to_yolo.py - Training annotations
train.json - YOLO data configuration
data.yaml
Other components
- Browser user
- IP camera
- Audio output
Connections 17
- Browser user → Flask application: requests page and feeds
app.py - Flask application → Web page: renders
app.py - Flask application → Frame capture: starts capture
app.py - Flask application → Detection and distance: starts detection
app.py - IP camera → Frame capture: sends frames
realtime_detect.py - Frame capture → Detection and distance: shares frames
realtime_detect.py - Detection and distance → YOLO weights: loads weights
realtime_detect.py - Flask application → Detection and distance: requests frame data
app.py - Flask application → Detection stabilization: requests guidance
app.py - Detection stabilization → Detection and distance: gets detection
main.py - Detection stabilization → Gemini response: requests advice
main.py - Gemini response → Spoken guidance: speaks reply
gemini_assistant.py - Spoken guidance → Audio output: outputs speech
gemini_assistant.py - Gemini response → Browser user: queries Gemini
gemini_assistant.py - Flask application → Browser user: streams video and status
app.py - YOLO label converter → Training annotations: reads annotations
convert_json_to_yolo.py - YOLO label converter → YOLO data configuration: maps light classes