A dense pedestrian detection algorithm based on the improved YOLOv7 is proposed to address the issues of small target scale and occlusion in dense pedestrian detection scenarios. Firstly, the MobileNet attention module is introduced into the feature extraction network to reduce the model computation and enhance feature extraction capabilities. Secondly, the addition of the BepC3 module in the feature fusion network enhances the ability of pedestrian multi-scale feature fusion. Finally, WD-Loss is used as the localization loss function to improve the localization accuracy of the model detection. Trai-ning and validation were conducted on the Wider-Person crowded pedestrian detection dataset, and the experimental results showed that the improved algorithm model AP50 achieved an accuracy of 0.784, leading the original YOLOv7 algorithm by 0.031.