Deep learning (DL) is widely used in ship detection, but there are still some problems in the effective classification, such as inaccurate object feature extraction and inconspicuous feature information in deep layers. To address these problems, we propose a YOLOv7-residual convolutional block attention module (YOLOv7-RCBAM) by combining the convolutional attention mechanism and residual connections to the YOLOv7. First, to accelerate the training speed, the parameters in the backbone network of the pretrained model are frozen by using transfer learning, and the model is fine-tuned for training. Second, to enhance the information relevance of channel dimensional features, an attention mechanism with residual connectivity is adopted. Finally, a feature fusion attention mechanism is introduced to improve the effective feature extraction. The effectiveness of the proposed method is fully validated on the SeaShips dataset. The results show that the YOLOv7-RCBAM model achieves better performance with a 97.59% in
mAP
and effectively extracts object feature in deep layers. Meanwhile, the YOLOv7-RCBAM model can accurately locate ship in complex environments with darkness and noise with the
mAP
reaching 96.13% to achieve effective ship classification detection.