As affected by limited information and the complex background, the accuracy of small-target water-floating garbage detection is low. To increase the detection accuracy, in this research, a small-target detection method based on APM-YOLOv7 (the improved YOLOv7 with ACanny PConv-ELAN and MGA attention) is proposed. Firstly, the adaptive algorithm ACanny (adaptive Canny) for river channel outline extraction is proposed to extract the river channel information from the complex background, mitigating interference of the complex background and more accurately extracting the features of small-target water-floating garbage. Secondly, the lightweight partial convolution (PConv) is introduced, and the partial convolution-efficient layer aggregation network module (PConv-ELAN) is designed in the YOLOv7 network to improve the feature extraction capability of the model from morphologically variable water-floating garbage. Finally, after analyzing the limitations of the YOLOv7 network in small-target detection, a multi-scale gated attention for adaptive weight allocation (MGA) is put forward, which highlights features of small-target garbage and decreases missed detection probability. The experimental results showed that compared with the benchmark YOLOv7, the detection accuracy in the form of the mean Average Precision (mAP) of APM-YOLOv7 was improved by 7.02%, that of mmAP (mAP0.5:0.95) was improved by 3.91%, and Recall was improved by 11.82%, all of which meet the requirements of high-precision and real-time water-floating garbage detection and provide reliable reference for the intelligent management of water-floating garbage.