# ๐Ÿšฆ Qt Traffic Monitoring Application - Detailed File Contents Analysis ## ๐Ÿ“ Project Overview **Location**: `D:\Downloads\finale6\khatam\qt_app_pyside\` **Type**: PySide6-based Traffic Monitoring System with Real-time AI Violation Detection --- ## ๐Ÿš€ **Main Application Entry Points** ### **`main.py`** (52 lines) - **Purpose**: Primary application launcher - **Contents**: QApplication setup, splash screen integration, MainWindow loading - **Key Features**: Error handling for UI loading, fallback mechanisms - **Imports**: PySide6.QtWidgets, splash screen utilities ### **`launch.py`** (44 lines) - **Purpose**: Enhanced launcher using subprocess - **Contents**: Subprocess-based app launching to avoid encoding issues - **Key Features**: Path validation, error handling, cross-platform compatibility - **Functionality**: Checks main.py existence before launching ### **`run_app.py`** (115 lines) - **Purpose**: Environment preparation and path fixing - **Contents**: Import path verification, missing file creation, fallback handling - **Key Features**: Dynamic path fixing, **init**.py creation, enhanced_annotation_utils verification - **Debugging**: Comprehensive path and import checking ### **`enhanced_main_window.py`** (131 lines) - **Purpose**: Main window controller patch for enhanced video processing - **Contents**: EnhancedVideoController integration, import fallbacks - **Key Features**: Advanced controller switching, compatibility layer - **Architecture**: MVC pattern enhancement --- ## ๐Ÿ–ฅ๏ธ **User Interface Layer (`ui/` Directory)** ### **`main_window.py`** (641 lines) - **Purpose**: Primary application window framework - **Contents**: QMainWindow implementation, tab management, menu system - **Key Components**: LiveTab, AnalyticsTab, ViolationsTab, ExportTab, ConfigPanel - **Features**: Settings management, configuration loading, performance overlay integration ### **`live_tab.py`** - **Purpose**: Real-time video monitoring interface - **Contents**: Video stream display, control buttons, status indicators - **Features**: Multi-source support, real-time violation overlay ### **`fixed_live_tab.py`** - **Purpose**: Stabilized version of live video display - **Contents**: Bug fixes for video rendering, improved stability - **Improvements**: Memory leak fixes, thread safety ### **`enhanced_simple_live_display.py`** - **Purpose**: Optimized live video rendering component - **Contents**: Hardware-accelerated rendering, reduced latency display - **Features**: GPU acceleration, frame buffering ### **`simple_live_display.py`** - **Purpose**: Basic video display component - **Contents**: Standard OpenCV video rendering - **Usage**: Fallback display when enhanced features unavailable ### **`analytics_tab.py`** - **Purpose**: Violation analytics and reporting dashboard - **Contents**: Charts, graphs, violation statistics, trend analysis - **Features**: Real-time data visualization, export capabilities ### **`violations_tab.py`** - **Purpose**: Detailed violation management interface - **Contents**: Violation list, filtering, detailed view, evidence management - **Features**: Search, sort, export individual violations ### **`export_tab.py`** - **Purpose**: Data export and reporting functionality - **Contents**: Multiple export formats, report generation, scheduling - **Formats**: PDF, CSV, JSON, video clips ### **`config_panel.py`** - **Purpose**: System configuration interface - **Contents**: Camera settings, detection parameters, model selection - **Features**: Real-time parameter adjustment, configuration validation --- ## ๐ŸŽฎ **Controllers Layer (`controllers/` Directory)** ### **`enhanced_video_controller.py`** (687 lines) - **Purpose**: Advanced video processing with AI integration - **Contents**: Async inference, FPS tracking, OpenVINO integration - **Key Features**: - OpenVINOVehicleDetector integration - Traffic light color detection - Enhanced annotation utilities - Performance monitoring - Thread-safe processing ### **`video_controller.py`** & **`video_controller_new.py`** - **Purpose**: Standard and upgraded video stream management - **Contents**: Video capture, frame processing, detection pipeline - **Features**: Multiple video sources, recording capabilities ### **`analytics_controller.py`** - **Purpose**: Violation data analysis and reporting controller - **Contents**: Data aggregation, statistical analysis, trend calculation - **Features**: Real-time analytics, database integration ### **`model_manager.py`** - **Purpose**: AI model loading and management - **Contents**: Model initialization, switching, performance optimization - **Models Supported**: OpenVINO, ONNX, PyTorch models ### **`performance_overlay.py`** - **Purpose**: Real-time performance monitoring display - **Contents**: FPS counter, memory usage, CPU/GPU utilization - **Features**: Live system metrics, performance alerts ### **`red_light_violation_detector.py`** - **Purpose**: Specialized red light detection logic - **Contents**: Traffic light state detection, violation triggering - **Algorithm**: HSV color detection, temporal analysis --- ## ๐Ÿ› ๏ธ **Utility Modules (`utils/` Directory)** ### **`annotation_utils.py`** & **`enhanced_annotation_utils.py`** - **Purpose**: Video annotation and overlay functions - **Contents**: Bounding box drawing, text overlay, color coding - **Functions**: - `enhanced_draw_detections()` - `draw_performance_overlay()` - `enhanced_cv_to_qimage()` - `enhanced_cv_to_pixmap()` ### **`traffic_light_utils.py`** - **Purpose**: Traffic light state detection algorithms - **Contents**: HSV color space analysis, circle detection - **Functions**: - `detect_traffic_light_color()` - `draw_traffic_light_status()` ### **`crosswalk_utils.py`** - **Purpose**: Crosswalk area detection and analysis - **Contents**: Edge detection, template matching, polygon definition - **Features**: Dynamic crosswalk boundary detection ### **`embedder_openvino.py`** - **Purpose**: OpenVINO model embedder for inference acceleration - **Contents**: Model optimization, feature extraction - **Features**: Hardware acceleration, batch processing ### **`helpers.py`** - **Purpose**: Common utility functions - **Contents**: Configuration loading, file I/O, data conversion - **Functions**: `load_configuration()`, `save_configuration()`, `save_snapshot()` --- ## ๐Ÿค– **AI Models & Processing Files** ### **`mobilenetv2.bin`** & **`mobilenetv2.xml`** - **Purpose**: OpenVINO MobileNetV2 model files - **Contents**: Pre-trained weights and network architecture - **Usage**: Feature extraction, object classification ### **`mobilenetv2_embedder/`** (Directory) - **Purpose**: Feature extraction utilities for MobileNetV2 - **Contents**: Embedding generation, similarity calculation ### **`red_light_violation_pipeline.py`** - **Purpose**: Specialized red light detection pipeline - **Contents**: End-to-end red light violation detection - **Features**: Auto-learned stop lines, Kalman filtering --- ## โš™๏ธ **Configuration & Setup Files** ### **`config.json`** - **Purpose**: Main application configuration - **Contents**: Camera settings, detection thresholds, model paths - **Structure**: JSON format with nested configuration objects ### **`requirements.txt`** - **Purpose**: Python dependencies specification - **Contents**: Required packages with version numbers - **Packages**: PySide6, OpenCV, NumPy, OpenVINO, PyTorch --- ## ๐ŸŽจ **Resources (`resources/` Directory)** ### **`splash.png`** - **Purpose**: Application splash screen image - **Format**: PNG image file - **Usage**: Displayed during application startup ### **`style.qss`** - **Purpose**: Qt stylesheet for application theming - **Contents**: CSS-like styling rules for UI components - **Features**: Dark theme, custom colors, responsive design ### **`generate_resources.py`** - **Purpose**: Resource generation and compilation script - **Contents**: QRC file processing, resource compilation ### **`icons/`** & **`themes/`** (Directories) - **Purpose**: UI graphics and visual configurations - **Contents**: Application icons, theme files, visual assets --- ## ๐Ÿงช **Testing & Development Files** ### **`test_redlight_violation.py`** - **Purpose**: Red light detection testing and validation - **Contents**: Unit tests, integration tests, performance benchmarks - **Features**: Automated testing, result validation ### **`kernel.errors.txt`** - **Purpose**: Error logging and debugging information - **Contents**: Runtime errors, stack traces, debug output - **Usage**: Troubleshooting and development ### **`present.md`** - **Purpose**: Presentation documentation - **Contents**: Project overview, feature highlights, demo scripts ### **`update_controller.py`** - **Purpose**: Controller update and management utilities - **Contents**: Dynamic controller switching, version management --- ## ๐Ÿ“Š **Complete File Summary** - **Total Files**: 60+ across all directories - **Main Application**: 4 entry point files - **UI Components**: 11 interface files - **Controllers**: 8 processing files - **Utilities**: 7 helper modules - **AI Models**: 3 model files + embedder directory - **Violation Detection**: 20+ specialized detection files - **Configuration**: 4 config/setup files - **Resources**: 4 asset directories - **Testing**: 4 development/testing files **Total Code**: ~8,000+ lines of production-ready Python code with comprehensive AI integration, real-time processing, and modular architecture.