As a key tool to maintain urban cleanliness and improve the road environment, road cleaning vehicles play an important role in improving the quality of life of residents. However, the traditional road cleaning vehicle requires the driver to monitor the situation of road garbage at all times and manually operate the cleaning process, resulting in an increase in the driver 's work intensity. To solve this problem, this paper proposes a road garbage recognition algorithm based on improved YOLOv5, which aims to reduce labor consumption and improve the efficiency of road cleaning. Firstly, the lightweight network MobileNet-V3 is used to replace the backbone feature extraction network of the YOLOv5 model. The number of parameters and computational complexity of the model are greatly reduced by replacing the standard convolution with the deep separable convolution, which enabled the model to have faster reasoning speed while maintaining higher accuracy. Secondly, the attention mechanism in MobileNet-V3 is improved, and a more efficient coordinate attention module is embedded to enhance the model 's attention to key features and further improve the accuracy of garbage recognition. Thirdly, in order to better improve the detection effect of garbage recognition, the K-means clustering algorithm is used to adjust and re-cluster the anchor box of the original model, so that the generated anchor box is closer to the ground truth box.Finally, we conducted experiments on the self-made road garbage dataset to verify the effectiveness of the improved algorithm. The garbage recognition accuracy rate reached 94.1%, and compared with the original YOLOv5 model, the number of model parameters was reduced by 47.1%, and the detection speed was increased by 35%. Therefore, the improved algorithm achieves the balance between detection accuracy and speed, which lays a foundation for future deployment and testing in actual road cleaning vehicles.