In order to solve the problem that the original Yolov8 model often misses and mistake in detecting whether workers wear safety helmets, this paper proposes a safety helmet target detection algorithm based on improved Yolov8N. The attention modules of CBAM, SimAM and SA are added to the backbone of the original model to enhance the ability of the network to extract effective features of the target. Moreover, the weighted bidirectional feature pyramid BiFPN is introduced to enhance feature fusion and improve the accuracy of target detection. Experimental data show that using the improved model in the homemade dataset, the mAP of detecting safety helmets increased by 1.3% and the recall increased by 4%.