Due to the complex underwater environment, underwater biological occlusion and small objects are more common, resulting in lower accuracy and poor robustness of object detection algorithms, so an underwater robust object detection method based on improved YOLOv5s is proposed in this paper. First, GridMask data enhancement method is used to solve the problem of insufficient detection accuracy of YOLOv5s when obstacles block the target. Second, the NMS (Non-Maximum Suppression) in YOLOv5s is changed to the DIoU NMS algorithm for improving the detection accuracy of the overlapped objects. Finally, the structure of PAN+FPN in YOLOv5s is improved to RepGFPN to optimize the ability of the original algorithm to detect small objects. Compared with other object detection algorithms, the results show that the proposed method improves the robustness of underwater object detection.