To address the challenges posed by the diverse types of printed circuit board (PCB) components, the low detection accuracy for small components, and high model complexity, this paper proposes the GS-YOLOv8s algorithm. By introducing lightweight Ghost convolution, the computational costs are reduced. A dynamic lightweight C2f-GDC module is designed by incorporating the Ghost Module and DynamicConv into the C2f module of the Backbone, effectively minimizing redundant information within the model. In the Neck network, the SE module is integrated into the bottleneck layer of the C2f module, forming the C2f-SE module, which enhances the network's capability to extract features of small objects. Additionally, a multi-scale feature detection layer is incorporated, leveraging fine-grained information from shallow layers to substantially improve the detection accuracy of small components. Experimental validation conducted on a PCB component dataset demonstrates that GS-YOLOv8s achieves a detection accuracy of 95.6%, a recall rate of 94.6%, and an mAP@0.5 of 97.4%, outperforming YOLOv8s by 0.7%, 1.4%, and 0.5%, respectively. Notably, the model's parameter count is reduced by 30%. The results affirm that the proposed algorithm effectively enhances the detection capability for small objects in complex scenarios, while maintaining high detection accuracy and computational efficiency.