Multi beam forward looking sonar plays an important role in underwater detection. However, due to the complex underwater environment, unclear features, and susceptibility to noise interference, most forward looking sonar systems have poor recognition performance. The research on MFLS for underwater target detection faces some challenges. Therefore, this study proposes innovative improvements to the YOLOv5 algorithm to address the above issues. On the basis of maintaining the original YOLOv5 architecture, this improved model introduces transfer learning technology to overcome the limitation of scarce sonar image data. At the same time, by incorporating the concept of coordinate convolution, the improved model can extract features with rich positional information, significantly enhancing the model’s detection ability for small underwater targets. Furthermore, in order to solve the problem of feature extraction in forward looking sonar images, this study integrates attention mechanisms. This mechanism expands the receptive field of the model and optimizes the feature learning process by highlighting key details while suppressing irrelevant information. These improvements not only enhance the recognition accuracy of the model for sonar images, but also enhance its applicability and generalization performance in different underwater environments. In response to the common problem of uneven training sample quality in forward looking sonar imaging technology, this study made a key improvement to the classic YOLOv5 algorithm. By adjusting the bounding box loss function of YOLOv5, the model’s over sensitivity to low-quality samples was reduced, thereby reducing the punishment on these samples. After a series of comparative experiments, the newly proposed CCW-YOLOv5 algorithm has achieved detection accuracy in object detection mAP@0.5 Reached 85.3%, and the fastest inference speed tested on the local machine was 54 FPS, showing significant improvement and performance improvement compared to existing advanced algorithms.