Non-member Zhigang Zhen, Non-member Jingkai Cui, Non-member Yajing Wang a , Non-member The conventional artificial neural network (ANN) model is an effective way to detect harmonic signals. However, the solution of the model cannot converge when the initial value of the excitation function (IVEF) is not suitable, causing a large error in harmonic detection, especially in the case of power system noise. We improve the back propagation (BP) neural network (BNN) model by using an adjustable excitation function and the basic inertial algorithm in this paper. Based on this model and combined with the glowworm swarm optimization (GSO) algorithm, a harmonic/inter-harmonic detection method is proposed. The network first uses an improved GSO algorithm with an adaptive step to optimize the IVEF of BNN. Then, BNN is trained at this initial value, so that amplitude, phase, and frequency of harmonics/inter-harmonics can be obtained. The simulation data analyses show that that the method has good stability, convergence, strong anti-noise ability, and ultrahigh detection accuracy. It can accurately separate the integer and non-integer harmonics. Compared with the traditional ANN algorithm and Hanning-FFT, the detection accuracy of this algorithm can be improved by 2-4 orders of magnitude.