In response to the problem of complex visual feature categories and sparse datasets for related refined categories in traffic accidents, this article has created a traffic accident target detection dataset, the AccOD dataset, which is divided into five categories. This dataset can serve as a benchmark for training and evaluating traffic accident target detection algorithms. Aiming at the real-time, accuracy, and intelligence issues of traffic accident detection, an improved traffic accident target detection network based on YOLOv8 is proposed. This network replaces a more efficient backbone network structure and improves the downsampling module that integrates different scale features in the head network, reducing the number of model parameters and computational complexity while improving the detection accuracy of the model. The C2f module is improved to balance various contextual information, further enhancing the detection ability of the model. The experiment showed that the improved model achieved a 4.75% improvement in mAP0.5 and 4.58% improvement in mAP0.5:0.95 on the AccOD dataset compared to YOLOv8n, and a 2.14% improvement in mAP0.5 and 6.23% improvement in mAP0.5:0.95 on the open source ACD dataset. This algorithm improves the detection accuracy of traffic accidents and maintains the lightweight of the model, providing an effective method for intelligent traffic accident detection.