Abstract Road crack detection is crucial for road maintenance and traffic safety. To address the low efficiency and limited generalization capability of traditional crack detection methods, this research proposes an improved model dubbed EVA-YOLOv8 (Efficient ViT Attention-YOLOv8) based on the YOLOv8n framework. This model integrates MobileViT Block and an Efficient Multi-scale Attention (EMA) mechanism, while employing the more efficient GhostConv to provide lightweight optimization for the network. Comparisons and ablation experiments were conducted on road crack datasets, and the attention mechanism of the model on crack features was analyzed using Grad CAM + + heatmap. Results indicate: (1) The EVA-YOLOv8 model achieved values of 0.897 (mAP@0.5), 0.706 (mAP@0.5:0.95), 0.907 (Precision), 0.881 (Recall), and 0.894 (F1-score), exhibiting good generalization ability across multiple categories, different scales, and low-contrast scenarios. (2) Compared with the original YOLOv8, the improved model demonstrates enhanced performance: mAP@0.5 and Recall are increased by 6.6% and 5.3%, respectively, while the parameters are reduced by 16.3%. (3) Grad-CAM + + heatmaps indicate that the model not only achieves high response values in the main region of the target but also performs well in target boundary localization and background suppression. This research may provide a reference for related fields. Data availability Data are available from the corresponding author upon reasonable request. References Tian, Z., Shao, X. & Bai, Y. Graph-MambaRoadDet: A Symmetry-Aware Dynamic Graph Framework for Road Damage Detection. Symmetry 17, 1654 (2025). Ma, L. & Chen, M. Road damage detection based on improved YOLO algorithm. Sci. Rep. 15, 28506 (2025). Wang, J. et al. Road defect detection based on improved YOLOv8s model. Sci. Rep. 14, 16758 (2024). Xing, Y. et al. EMG-YOLO: road crack detection algorithm for edge computing devices. Front. Neurorobotics. 18, 181423738–181423738 (2024). Cano-Ortiz, S. et al. Leveraging a deep learning generative model to enhance recognition of minor