How refathasanabir/traffic-monitor works
Traffic-Monitor is a Streamlit application for vehicle detection and congestion prediction. Users upload an image for detection and counts, or a video for tracked vehicle counts, annotated-video download, and a Random Forest traffic prediction. A separate training script builds the Random Forest from the traffic dataset. The runtime is concentrated in app.py; the graph separates its main stages for clarity. Relationships are based on the shown app.py and train.py excerpts; other runtime wiring was not inspected.
Main entry points: app.py Streamlit interface · train.py Classifier training · traffic_rf_model.pkl Random Forest model · best.pt YOLO weights
Components 14
User interface
- Streamlit interface
app.py - Video download
app.py
Vehicle vision
- Image detection
app.py - Video processing
app.py - Vehicle tracking
app.py - Frame annotation
app.py - YOLO weights
model/best.pt
Traffic analysis
- Vehicle counting
app.py - Traffic prediction
app.py - Traffic chart
app.py - Random Forest model
model/traffic_rf_model.pkl
Model training
- Classifier training
train.py - Traffic dataset
dataset/traffic_data.csv
Other components
- Uploader
Connections 16
- Uploader → Streamlit interface: uploads media
app.py - Streamlit interface → Image detection: runs image
app.py - Streamlit interface → Video processing: processes video
app.py - Streamlit interface → YOLO weights: loads weights
app.py - Streamlit interface → Random Forest model: loads classifier
app.py - Image detection → Vehicle counting: counts detections
app.py - Image detection → Frame annotation: annotates detections
app.py - Video processing → Vehicle tracking: tracks frames
app.py - Video processing → Frame annotation: annotates frames
app.py - Video processing → Vehicle counting: counts frames
app.py - Video processing → Streamlit interface: returns counts
app.py - Streamlit interface → Traffic prediction: predicts traffic
app.py - Streamlit interface → Traffic chart: plots frame counts
app.py - Streamlit interface → Video download: offers output
app.py - Classifier training → Traffic dataset: reads data
train.py - Classifier training → Random Forest model: saves classifier
train.py