In recent years, visual intelligence-assisted driving technology has been widely applied and promoted, but with it comes challenges to its safety, such as poor recognition performance of algorithms for slender objects like wires, ground seams, tree branches, etc. To address this pain point, this paper proposes a slender object detection model based on YOLOv8. Firstly, the D-C2f module is employed in the backbone feature extraction network. This deformable convolution module enables the network to better fit the unique shapes of slender objects. Secondly, the integration of the Biformer attention mechanism and the dysample upsampling network enhances the focus on the target objects in high-resolution feature maps. Finally, an occlusion-aware attention module is adopted at the detection end to improve the model's ability to detect occlusion issues on the road surface. Through experiments conducted on a wire dataset, the model achieves a detection accuracy of 93.2%, a recall rate of 90.2%, and a mean Average Precision (mAP) of 94.0%. The model has 11,181,427 parameters. Compared to the original YOLOv8 model, these metrics represent improvements of 3.8%, 1%, and 2.3%, respectively. The results demonstrate the superior detection accuracy of the proposed algorithm for slender objects, making it a viable solution for related challenges in autonomous driving.