To address the challenge of real-time monitoring of personnel for drowning prevention in places where the situation is complex and comprehensive supervision is not feasible,a YOLOv5-Dy-GBCA model with a unified attention mechanism and dynamic heads is proposed.Firstly,the study introduced a dy-namic detection head(DyHead)in front of the head of YOLOv5 so as to enhance the spatial position,scale,and detection capability of the head in perceiving targets.Secondly,the C3 module in Backbone is replaced with a GhostBottleneck Coordinate Attention feature extraction module(GBCA),which is composed of Ghost-Bottleneck structure and Coordinate Attention(CA),which effectively improved the problem of insufficient in-put semantic information and insufficient feature information extraction due to mutual occlusion of water per-sonnel and small volume of human body emerging on the water surface;Then,the weighted Bi-directional Fea-ture Pyramid Network(BiFPN)is introduced to improve the feature fusion ability of different scales of the model;Finally,the Focal-EIoU loss function is used to reduce the impact of sample imbalance on detection re-sults.The experimental results show that the YOLOv5-Dy-GBCA model maintains the detection speed of the o-riginal model while the mean average accuracy(mAP)reaches91.50%,which is better than traditional algo-rithms and other mainstream algorithms in terms of detection performance.