# Innovative Approaches to Traffic Anomaly Detection and Classification Using AI
## 2 Algorithms and Methods
### Convolutional Neural Networks (CNNs)
However, challenges such as establishing lane-specific rules and addressing the limitations of unsupervised learning were noted. Expanding on real-time traffic anomaly detection, this study [27] introduced a system that combines deep learning and decision trees to identify events such as accidents and stopped vehicles in CCTV footage. Unlike previous approaches, this method integrates adaptive preprocessing to handle diverse video conditions effectively. The system operates in two stages:  
Figure 7: The candidate selection stage of the proposed method. The blue dots represent objects of interest, whereas the red dots represent misclassified objects. From [18]. Vehicle detection: YOLOv5 [28] identifies vehicles within video frames. * Anomaly analysis: The system estimates the scene background by computing the median of randomly selected frames. A road mask delimits vehicular traffic zones, and a decision tree evaluates anomalies based on detection factors such as object size, detection probability, and overlap with the road mask. This process pinpoints the start and end points of anomalies. Using the NVIDIA AI CITY CHALLENGE 2021 [29] dataset, the system achieved an F1 score of 0.8571 and an S4 score of 0.5686, demonstrating its effectiveness under varying conditions. To address challenges like occlusion, poor video quality, and lighting variability, preprocessing techniques--including classification by road type, weather, and time of day--were applied, enhancing background estimation accuracy. Building on the versatility of computer vision frameworks, in [30], the authors proposed a system for extracting traffic information during mass events. Using YOLOv5 for vehicle detection and the Deep-SORT algorithm for tracking, the framework projects vehicle information--including ID, location, and timestamps--onto a scaled orthogonal map via homographic transformation. The framework was evaluated using videos from both regular days and mass events at Texas A&M University, achieving a count error of 3.09% and an RSS of 5.07. Factors affecting performance, such as input size, lighting conditions, camera angles, and pixel size, were analyzed and optimized. Beyond vehicle counting, the system tracks turning patterns at intersections using a matrix that records vehicle movements between edges. Although the accuracy for this task ranged from 43% to 72%, the results aligned with observed traffic trends. Positioned as a cost-effective alternative to traditional monitoring systems like traffic sensors and GPS, the framework offers adaptability to varying lighting conditions and compatibility with common surveillance cameras. Additionally, it utilizes open-source software and commodity hardware, significantly reducing implementation costs. The system is also easily generalizable, allowing users to configure survey areas and integrate new cameras by selecting four reference points. Another CNN-based system for automatic traffic accident detection in surveillance videos has been presented in [31]. The methodology centers on training a CNN using the Vehicle Accident Image Dataset (VAID), comprising 1360 accident images collected under diverse environmental conditions and resolutions. Data augmentation techniques were employed to enhance the model's generalization capability. The system was tested on 30 videos featuring both accident and normal traffic scenes. To mitigate label flickering during inference, a moving average prediction algorithm was implemented, smoothing classifications by averaging predictions over the last 128 frames. Experimental results demonstrated an 80% accuracy rate in detecting accidents. However, challenges were observed in handling low-resolution videos, distant accidents, foggy conditions, and light reflections. Comparisons showed that integrating the moving average prediction algorithm significantly improved accuracy compared to using the CNN alone.