In order to solve the problems of difficult to extract sample features, easy to lose image details and difficult to identify small-size targets due to factors such as dark light, excessive noise and motion blur of underground unmanned electric locomotive, a multi-target detection model of underground electric locomotive based on DYCS-YOLOv8n was proposed. Firstly, based on the original YOLOv8n, CBAM module is introduced to improve the ability to extract key features through the dual attention mechanism of space and channel. Secondly, the dynamic up-sampling operator DySample is used to better preserve the edges and local details in the image and improve the accuracy of detection. Finally, a new small target detection layer is added to improve the detection performance of small targets by better extracting fine features. The results of ablation and comparison experiments show that the average detection accuracy (map) of DYCS-YOLOV8 on the self-made data set is 94.3%, which is 3.4% higher than that of the original model. The detection accuracy of small target is 89.2%, which is improved by 6.3%. At the same time, the comprehensive performance is better than other mainstream target detection models.