In recent years, target detection algorithms based on machine vision have been a hotspot in computer vision research. The You Only Look Once (YOLO) algorithm, as an excellent target detection algorithm, has played an important role in improving detection speed and accuracy with the improvement of the network architecture in its development process. This paper introduces the concept of integrated learning to the YOLOv5 network architecture, incorporating deformable convolution and attention mechanisms. It also chooses the focal EIOU loss function to replace the GIOU loss function, thereby addressing the issue of localization loss, prioritizing abnormally detected targets, and enhancing the detection efficiency of these abnormal targets. Finally, we examine the practical value of the improved YOLOv5 algorithm by testing its performance and applying it to real-world anomaly detection. The results show that the improved YOLOv5 model outperforms the original YOLOv5 model in terms of performance and practical application advantages. In terms of performance, the classification accuracy of sea_person and earth_person in the improved YOLOv5 model is 37% and 26%, respectively, which is a significant performance gain overall. In actual application tests, the proposed method is more accurate than the traditional method. The accuracy is significantly higher.