Abstract:YOLOv8 algorithm has been widely used in various target detection due to its high inference speed and excellent detection performance. However, when faced with small target detection and complex background interference in ship images, it faces many problems, such as missed detection, false detection and soon. In this paper, a RAMW-YOLOv8 target detection algorithm based on multi-scale features is proposed. By adding a convolution operation and a residual structure into the C2f module, and introducing the coordinate attention mechanism, a C3Res_CA module is constructed to enhance the ability of fine feature extracting and background noise suppression in complex background images; by integrating the multi-scale feature into the SPPF module, and introducing the average pooling layer and adaptive pooling operator to construct the SPPF_AuxPool module, which enhances the ability to mine different feature types. To solve the problem that small targets are dense and easy to interfere in ship images, a small target detection layer MicroDetect is added to enhance the detection ability for small size targets through multi-scale feature fusion and refined feature extraction strategy; to reduce the impact of low-quality samples on the accuracy of the algorithm, the WIoU loss function is introduced to increase the convergence speed, robustness and stability in complex scenarios. Experiments on the public dataset HRSID show that the RAMW-YOLOv8 algorithm improves the accuracy, recall and average precision of two different indexes by 1%, 3.6%, 3.1% and 3.2%, respectively, compared with the original algorithm, and its detection effect is obviously better than other classical algorithms.