- Project Overview
- Architecture
- Installation & Setup
- Configuration
- Usage Guide
- Building & Deployment
- Key Features
- API Reference
- Services Integration
- Troubleshooting
- License
- Contributors
- Acknowledgments
The Smart Intersection Traffic Monitoring System is an advanced AI-powered desktop application built with PySide6 and OpenVINO for comprehensive traffic monitoring, violation detection, and smart intersection analytics. The system features a modern tabbed interface with real-time analytics, VLM (Vision-Language Model) insights, and enterprise-grade IoT integration capabilities.
- Real-time Object Detection: YOLO11 (n/x) models with OpenVINO optimization for vehicles, pedestrians, and traffic lights
- Advanced Violation Detection: Red light violations, crosswalk violations, wrong way violation
- Multi-Device Support: CPU, GPU, and AUTO device selection with Intel Arc GPU optimization
- Vision-Language Model (VLM): OpenVINO GenAI integration for scene understanding and natural language analysis
- Modern UI Interface: Tabbed interface with Analytics, Violations, Export, and VLM Insights tabs
- IoT Integration: MQTT + InfluxDB + Grafana for data streaming and visualization
- Multi-Source Input: Webcam, RTSP streams, video files, and drag-and-drop support
- Performance Monitoring: Real-time FPS, latency, CPU/GPU utilization tracking with overlay display
- Enhanced Tracking: ByteTrack, DeepSORT algorithms with enhanced object tracking capabilities
- Data Export: CSV/JSON export with comprehensive analytics and reporting
- Frontend: PySide6 (Qt6) - Modern desktop GUI framework with advanced widgets
- AI/ML Engine: OpenVINO 2025.2+ - Intel's AI inference optimization toolkit
- Computer Vision: OpenCV 4.11+ - Image and video processing
- Object Detection: YOLO11 (Ultralytics) - State-of-the-art detection models (yolo11n, yolo11x)
- Object Tracking: ByteTrack, DeepSORT - Multi-object tracking algorithms with enhanced features
- VLM Integration: OpenVINO GenAI - Vision-Language Model pipeline for scene understanding
- Time-Series DB: InfluxDB - Real-time metrics storage and analytics
- Message Broker: MQTT (Mosquitto) - IoT data streaming and communication
- Visualization: Grafana - Real-time dashboards, alerts, and analytics
- Data Export: Pandas, CSV/JSON - Comprehensive analytics and reporting
- Performance Metrics: Custom performance overlay with real-time monitoring
- OS: Windows 10+, macOS 10.14+, or Ubuntu 18.04+
- Python: 3.8 - 3.11 (recommended: 3.11)
- Memory: Minimum 8GB RAM (16GB recommended for VLM)
- GPU: Intel Arc
- Storage: 5GB free space for models and dependencies
- Intel: Intel Arc GPU, or Intel integrated graphics
# Navigate to the application directory
cd apps/traffic_monitor/app
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# or
.venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt# Navigate to services directory
cd services
# Start backend services using Docker
docker-compose -f docker/docker-compose.yml up -d
# Or use provided scripts
cd scripts
./start_services.bat # Windows
./start_services.sh # Linux/macOS
# Service endpoints:
# - MQTT: localhost:1883
# - InfluxDB: localhost:8086
# - Grafana: localhost:3000# Navigate to VLM backend
cd vlm_backend
# Download VLM models
python model_downloader.py
# Start VLM service
python app.py
# VLM service will be available at localhost:5000# Navigate back to app directory
cd ..
# Standard mode
python main.py
# Enhanced mode with additional features
python run_app.py
# Debug mode (shows detailed logging)
python main.py --debugport 1883
allow_anonymous true
persistence true
persistence_location /data/
log_dest file /data/mosquitto.log
reporting-disabled: false
bind-address: 127.0.0.1:8088
[http]
enabled: true
bind-address: ":8086"# Optional: Override default paths
export OPENVINO_MODEL_PATH="/path/to/models"
export VLM_MODEL_PATH="/path/to/vlm/models"
export INFLUXDB_URL="http://localhost:8086"
export MQTT_BROKER="localhost:1883"
# Optional: Device preferences
export OPENVINO_DEVICE="GPU"
export OPENVINO_PRECISION="FP16"
# VLM Service configuration
export VLM_SERVICE_URL="http://localhost:5000"
export VLM_MODEL_NAME="phi-3-vision-128k-instruct"The application automatically detects available OpenVINO devices:
- CPU: Always available, good for compatibility
- GPU: Intel Arc, or any other.
- AUTO: OpenVINO automatically selects optimal device
- yolo11n: Fast inference, lower accuracy (recommended for real-time)
- yolo11x: High accuracy, slower inference (recommended for precision)
The application features a modern tabbed interface with the following tabs:
- Real-time video processing and object detection
- Configurable device selection (CPU/GPU/AUTO)
- Model selection (yolo11n/yolo11x)
- Performance overlay with FPS and resource usage
- Interactive detection settings
- Real-time traffic analytics and statistics
- Vehicle count and classification metrics
- Traffic flow analysis and patterns
- Historical data visualization
- Performance graphs and charts
- Real-time violation detection and alerts
- Red light violation monitoring
- Crosswalk safety violations
- Wrong Way Violation
- Data export functionality (CSV/JSON)
- Analytics report generation
- Detection data with timestamps
- Performance metrics export
- Violation reports with evidence
- Vision-Language Model analysis
- Natural language scene descriptions
- Interactive querying of traffic scenes
- AI-generated incident reports
- Scene understanding capabilities
- Launch Application: Run
python main.pyorpython run_app.py - Select Input Source:
- Webcam: Select camera index (0, 1, 2...)
- RTSP Stream: Enter stream URL (e.g.,
rtsp://camera.ip/stream) - Video File: Drag & drop or browse for video files
- Configure Detection:
- Choose device (CPU/GPU/AUTO)
- Select model (yolo11n for speed, yolo11x for accuracy)
- Adjust confidence and IoU thresholds
- Enable/disable OCR and tracking features
- Monitor Violations:
- Configure violation types in settings
- Set grace periods and tolerances
- Monitor real-time alerts and notifications
- Real-time Metrics: View live statistics on vehicle counts, types, and speeds
- Violation Monitoring: Track violations with timestamps and evidence
- Performance Analysis: Monitor system performance and resource usage
- Data Export: Export detection data, analytics, and violation reports
- Trend Analysis: Analyze traffic patterns over time
- Scene Analysis: Get natural language descriptions of traffic scenes
- Interactive Queries: Ask questions about current traffic situations
- Incident Reports: Generate detailed AI-powered incident reports
- Safety Insights: Receive AI-generated safety recommendations
- Multi-Camera Setup: Configure multiple camera feeds for intersection monitoring
- Cross-Camera Tracking: Track objects across multiple camera views
- ROI Analytics: Define regions of interest for specific analysis
- 3D Scene Understanding: Analyze traffic in three-dimensional space
The application includes PyInstaller specifications for building executables:
# Build using PyInstaller
pyinstaller main.spec
# Or build debug version
pyinstaller main.spec --debug
# Output will be in dist/ directory# Build and run containerized services
cd services/docker
docker-compose up --build -d
# Individual service deployment
docker-compose up -d mqtt influxdb grafana
# Service endpoints:
# - Grafana: http://localhost:3000 (admin/admin)
# - InfluxDB: http://localhost:8086
# - MQTT: localhost:1883# Build VLM backend container
cd vlm_backend
docker build -t traffic-vlm-backend .
# Run VLM service
docker run -p 5000:5000 traffic-vlm-backend# Windows service scripts
cd services/scripts
start_services.bat # Start all services
stop_services.bat # Stop all services
# Linux/macOS service scripts
./start_services.sh # Start all services
./stop_services.sh # Stop all services
# Individual service management
supervisord -c supervisord.conf # Start with supervisor- YOLO11 Models: Latest Ultralytics models (yolo11n, yolo11x) optimized for traffic scenarios
- OpenVINO Acceleration: Intel hardware optimization for maximum performance
- Multi-Class Detection: Vehicles, pedestrians, cyclists, traffic lights, and license plates
- Real-time Tracking: ByteTrack and DeepSORT algorithms for persistent object tracking
- OCR Integration: License plate recognition and text detection
- Red Light Violations: Traffic light state detection with configurable grace periods
- Crosswalk Monitoring: Pedestrian safety with violation line detection
- Scene Understanding: Natural language descriptions of traffic scenes
- Incident Analysis: AI-generated reports for violations and anomalies
- Interactive Queries: Ask questions about traffic situations in natural language
- Automated Reporting: Generate detailed incident reports with AI insights
- Safety Recommendations: AI-powered safety analysis and recommendations
- Tabbed Interface: Organized tabs for different functionality areas
- Live Detection: Real-time video processing with overlay information
- Analytics Dashboard: Comprehensive traffic analytics and visualizations
- Violation Monitoring: Real-time violation alerts and historical data
- Data Export: Flexible export options for analytics and reports
- Performance Overlay: Real-time performance metrics display
- MQTT Streaming: Real-time data streaming for traffic management systems
- InfluxDB Storage: Scalable time-series data storage and analytics
- Grafana Dashboards: Professional monitoring, alerting, and visualization
- REST API: VLM backend provides RESTful API for scene analysis
- Docker Support: Containerized deployment for production environments
- Multi-Device Support: Automatic selection of optimal processing device (CPU/GPU/AUTO)
- Model Optimization: OpenVINO model optimization for different hardware
- Asynchronous Processing: Non-blocking UI with threaded video processing
- Memory Management: Efficient handling of video streams and model inference
- Configurable Performance: Adjustable settings for optimal performance vs accuracy trade-offs
The VLM (Vision-Language Model) backend provides RESTful API endpoints for scene analysis:
http://localhost:5000
# Using Docker
docker run -d --name mosquitto -p 1883:1883 eclipse-mosquitto
# Using services scripts
cd services/scripts
./start_services.sh# MQTT Publisher configuration
MQTT_CONFIG = {
"host": "localhost",
"port": 1883,
"keepalive": 60,
"topics": {
"detection": "traffic/detection/objects",
"violations": "traffic/violations/",
"analytics": "traffic/analytics/metrics"
}
}-- Detection measurements
detection,camera=cam1,object_type=car confidence=0.85,x=100,y=150,width=80,height=120
-- Violation measurements
violation,type=red_light,camera=cam1 severity=high,timestamp=1641024000
-- Analytics measurements
analytics,camera=cam1 vehicle_count=15,avg_speed=45.2,flow_rate=120The application includes pre-configured Grafana dashboards:
- Traffic Overview: Vehicle counts, flow rates, and violation summaries
- Performance Monitoring: System performance metrics and resource usage
- Violation Analysis: Detailed violation tracking and trends
- Camera Status: Individual camera health and performance metrics
# Dashboards are automatically provisioned from services/grafana/dashboards/
# Manual import available at: http://localhost:3000/dashboard/import# Clear model cache
rm -rf openvino_models/.cache
# Manually download YOLO11 models
python -c "from ultralytics import YOLO; YOLO('yolo11n.pt')"
python -c "from ultralytics import YOLO; YOLO('yolo11x.pt')"
# Check model paths in config.json# Check available devices
python -c "import openvino as ov; print(ov.Core().available_devices)"
# Update Intel GPU drivers
# For Intel Arc: https://www.intel.com/content/www/us/en/support/articles/000005520/
# Reset OpenVINO cache
rm -rf ~/.cache/openvino# Check VLM service status
curl http://localhost:5000/health
# Restart VLM service
cd vlm_backend
python app.py
# Check VLM model availability
python model_downloader.py --list-
Low FPS:
- Switch to yolo11n model for faster inference
- Reduce video resolution in display settings
- Use GPU device if available
- Reduce confidence threshold
-
High Memory Usage:
- Reduce
max_history_framesin config.json - Disable tracking if not needed
- Use smaller model (yolo11n vs yolo11x)
- Reduce
-
GPU Issues:
- Update GPU drivers
- Check CUDA/OpenCL installation
- Verify OpenVINO GPU support
# Enable detailed logging
python main.py --debug
# Enable performance profiling
python run_app.py --profile
# Check system requirements
python -c "
import sys
print(f'Python: {sys.version}')
import PySide6
print(f'PySide6: {PySide6.__version__}')
import openvino as ov
print(f'OpenVINO: {ov.__version__}')
print(f'Available devices: {ov.Core().available_devices}')
"This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Lead Developer: Jatin Sachdeva
- Mentors: Hassnaa Moustafa, Zhuo Wu, Vibhu Bithar
- Intel OpenVINO Team for AI acceleration framework
- Intel OpenVINO: AI inference optimization and acceleration framework
- Ultralytics YOLO11: State-of-the-art object detection models
- Qt/PySide6: Cross-platform GUI framework for modern desktop applications
- OpenCV: Comprehensive computer vision library
- PyTorch: Machine learning framework for model operations
- Transformers: Hugging Face transformers for VLM integration
- InfluxDB: Time-series database for real-time metrics storage
- Grafana: Professional monitoring and visualization platform
- MQTT (Mosquitto): Lightweight messaging protocol for IoT integration
- Pandas: Data analysis and manipulation library
- GSoC (Google Summer of Code): Supporting open source development
- Intel Corporation: Hardware optimization and AI acceleration
- Open Source Community: Collaborative development and innovation
Built with ❤️ for intelligent traffic management and smart city applications.






