Surface defects in bearings not only affect the appearance but also impact the service life and performance. Therefore, it is imperative for bearing manufacturers to conduct quality inspections before bearings leave the factory. However, traditional visual inspection methods exhibit shortcomings such as high omission rates, insufficient feature fusion and oversized models when dealing with multiple target defects in bearings. To address these challenges, this paper proposes a surface defect detection method for bearings based on an improved Yolov8 algorithm (G-Yolov8). Firstly, a C3Ghost convolutional module based on the Ghost module is constructed in YOLOv8 to simplify model computational costs. Secondly, a Global Attention Mechanism (GAM) module is designed at the end of the backbone network to increase sensitivity to implicit small target area features and optimize feature extraction efficiency.Subsequently, a deep deformable convolution feature pyramid network (TDSFPN) is constructed by introducing the deformable convolutional networks version 2 (DCNv2) and the lightweight Content-Aware Reassembly of Features upsampling operator (CARAFE) to reduce sampling information loss and improve the fusion of multi-scale target defects. Finally, different attention mechanisms are embedded in the detection network to construct a Multi-Attention Detection Head (MADH) to replace the decoupled head, refining classification and localization tasks, reducing feature confusion, and improving the model's detection accuracy. Experimental results demonstrate that the improved algorithm achieves a 3.5% increase in mean average precision on a self-made small-scale train bearing surface defect dataset, with a 17.3% reduction in model size. This improvement not only enhances accuracy but also addresses the requirement for lightweight deployment in subsequent stages.