To solve the problem of stall warning for axial compressors, this paper proposes a stall warning algorithm based on the sparrow search algorithm, which optimizes the deep belief network. The deep belief network is trained by using deep learning to extract the FFT spectrum of compressor stall experiment data directly as the feature vector. To improve the accuracy of DBN classification, parameters of hidden layer nodes n and initial weights w of DBN were optimized by SSA algorithm, and stall warning algorithm model of SSA-DBN axial-flow compressor was established. The experimental results of the algorithms show that the stall data at each speed is at least 0.1~0.3s in advance for early warning. This method is 0.075~0.281s ahead of the various models from the past to the present, and noise is superimposed on the experimental data to verify the Robustness of the way, better surge warning margin performance, and engineering practicability.