Autonomous driving is an important branch of artificial intelligence, and real-time and accurate object detection is key to ensuring the safe and stable operation of autonomous vehicles. To this end, this paper proposes a fast and accurate object detector for autonomous driving based on improved YOLOv5. First, the YOLOv5 algorithm is improved by using structural re-parameterization (Rep), enhancing the accuracy and speed of the model through training-inference decoupling. Additionally, the neural architecture search method is introduced to cut redundant branches in the multi-branch re-parameterization module during the training phase, which ameliorates the training efficiency and accuracy. Finally, a small object detection layer is added to the network and the coordinate attention mechanism is added to all detection layers to improve the recognition rate of the model for small vehicles and pedestrians. The experimental results show that the detection accuracy of the proposed method on the KITTI dataset reaches 96.1%, and the FPS reaches 202, which is superior to many current mainstream algorithms and effectively improves the accuracy and real-time performance of unmanned driving object detection.