In order to solve the problem of less target characteristics and poor performance of conventional target detection algorithm for underwater small target detection by Sonar, a continuous frame recognition modification based on? YOLOv5 is proposed. The algorithm through a lightweight channel and space attention module to extract sonar continuous frame information which improved the ability of YOLOv5. The lake experimental results based on the forward-looking sonar time series dataset show that the accuracy of the algorithm is improved by 13.7% and the reasoning time is basically unchanged. The improved algorithm is expected to be applied to the autonomous detection of underwater small targets.