A ship detection method based on deep convolutional neural network is proposed to solve the problem of high miss rate and high false alarm rate of small target ships in dense scenes.The YOLOv7 model is selected as the reference frame of the algorithm to improve the method.Firstly,we design an adaptive anchor boxes matching algorithm that reconfigures the K-means clustering algorithm using the CIoU distance metric to better match the size and scale distribution of objects in our ship dataset.Secondly,we add a fine-grained detection head for small-scale targets and redesign the network model structure using the shuffle attention(SA)mechanism.Lastly,we utilize a negative image enhancement technique to expand the data samples and obtain more training examples.Experimental results show that the algorithm achieves an accuracy and recall of 92.8%and 88.9%,respectively,for the inland waterway shipping ship detection task,representing an improvement of 10.9%and 23.6%,respectively.The mAP50 value also improves by 23.4%,reaching 92.6%,while the FPS index decreases by 11.4.Our model size is 47.1 MB,and the time required for a single image on the PC side is 32.26 ms,achieving efficient detection of small target ships.