Substation acoustic fault diagnosis method based on LSTM-BHPSO
By introducing particle swarm optimization and black hole algorithm into the LSTM network, the initial parameters are optimized, solving the parameter tuning and overfitting problems of the LSTM network in substation acoustic fault diagnosis, improving the training efficiency and accuracy of the model, and expanding the application scope.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANCHANG INST OF TECH
- Filing Date
- 2023-06-12
- Publication Date
- 2026-05-26
Smart Images

Figure CN116705065B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power detection equipment technology, specifically relating to a substation acoustic fault diagnosis method based on LSTM-BHPSO. Background Technology
[0002] LSTM networks are a type of deep neural network commonly used for modeling sequence data. While LSTMs offer advantages such as handling long sequences and capturing long-term dependencies, they also have drawbacks, including: Difficult parameter tuning: LSTMs involve multiple gating units that require tuning, necessitating significant time and effort to optimize their parameters. Prone to overfitting: LSTM models are prone to overfitting on the training set, requiring regularization techniques to mitigate this risk. High training data requirements: The performance of LSTM models largely depends on the quality and quantity of training data; insufficient datasets negatively impact generalization ability. Difficult hyperparameter selection: LSTMs involve selecting multiple hyperparameters, including the number of units, layers, and learning rate. The choice of these parameters significantly affects the final result, but there is no quantitative method for their selection.
[0003] PSO-LSTM is a method for training LSTM networks based on the Particle Swarm Optimization algorithm. While it can shorten the training time of LSTM networks, it still has some drawbacks: It is prone to overfitting: Like LSTM, PSO-LSTM is also prone to overfitting during training, thus requiring appropriate regularization methods to avoid this. Limitations: Although the PSO algorithm is widely used for training neural networks, it is not perfect and may still get trapped in local optima. Summary of the Invention
[0004] This study proposes an LSTM-BHPSO-based method for substation acoustic signature fault detection. The method primarily involves MFCC feature extraction from audio signals and learning using LSTM network feature data. It finds optimal initial parameters by fusing the intelligent algorithm PSO and the black hole algorithm, adaptively adjusting the network layer structure to escape local optimization, reduce training loss, and improve accuracy. This improved method incorporates both PSO and black hole algorithms into the LSTM algorithm for initial parameter optimization. It can improve the performance of the LSTM model by optimizing different objective functions and can also provide more hyperparameters (such as learning rate and batch size) to optimize the training process. In summary, this fusion algorithm is called LSTM-BHPSO. It can improve the performance of the LSTM model to a certain extent and enhance its application in processing sequence data.
[0005] This invention is achieved through the following technical solution: a substation acoustic fault diagnosis method based on LSTM-BHPSO, the steps of which are as follows:
[0006] Step S1: Collect the acoustic signature signal of the substation and use MFCC to extract features to obtain a feature dataset. Divide the feature dataset into a training set and a test set.
[0007] Step S2: Construct a substation acoustic fault diagnosis model based on LSTM network;
[0008] Step S3: The number of feature points extracted by MFCC, the number of batch samples, the number of network layers, and the number of hidden layers and fully connected layers are used as the positions of particles. The BHPSO algorithm is used to iteratively optimize the initial parameters and input the optimal initial parameters into the substation acoustic fault diagnosis model based on LSTM network.
[0009] Step S4: Train the substation acoustic fingerprint fault diagnosis model based on the LSTM network using the training set, and verify it using the test set. Use the trained substation acoustic fingerprint fault diagnosis model based on the LSTM network to perform substation acoustic fingerprint fault diagnosis.
[0010] Step S31. Set the number of feature points extracted by MFCC to mf, the number of batch samples to parameter bs, the number of network layers to nw, and the number of hidden layers and fully connected layers to nf; combine these four parameters to form the particle position pop and use the PSO algorithm for iterative optimization.
[0011] Step S32. Set the number of particles, set the inertia weight of the particle swarm, set the learning factor lr0 and social learning factor lr1 for each particle; initialize the position of the particle swarm.
[0012] Step S33. Set the number of particle swarm iterations, input the particle positions into the function for calculating fitness, and start the iteration;
[0013] Step S34. Update the particle's position and velocity during the iteration process;
[0014] Step S35. Then, the updated position is substituted into the fitness function and recalculated to obtain the fitness of each particle;
[0015] Step S36. Black Hole Search: During the particle swarm search, the particle may get stuck in a local optimum. Check if the global optimum fitness has not changed after three iterations. If it hasn't changed after three iterations, reassign the particle velocities within the vicinity of the global optimum particle's position. This vicinity is the black hole's radius *r*. The distance between a particle and the optimal particle is calculated using the formula *pwd*. i =(gbp-pop) i ) 2Let i = 1, 2, 3...N, where i represents each particle, N is the number of particles, gbp is the position of the optimal particle, and pop... i It represents the current position of each particle, pwd i It is the distance between the particle and the optimal particle;
[0016] Step S37. Black hole attraction: If r > pwd i Then the position of the optimal particle, gbp, will affect the position of the particle currently within r, i.e., the formula is: pop i (t+1)=pop i (t)+rand×(gbp-pop i (t);
[0017] Step S38. Inertia Weight Adjustment: If the optimal fitness remains unchanged across three iterations, adjust the inertia weight w. i (t+1)=w i (t)*0.9, where w i (t) represents the inertial weight of the i-th particle, w i (t+1) represents the inertia weight of the i-th particle in the next iteration. With the weight adjustment, the search step is reduced to find the optimal point.
[0018] Step S39. After the iteration is completed, the position of the obtained optimal particle is used as the optimal initial parameter of the substation acoustic fault diagnosis model based on LSTM network.
[0019] Further optimization shows that the number of feature points extracted by MFCC, mf, has an activity range of 10–60 and a speed of 5–15; the number of batch processing samples, bs, has an activity range of 16–128 and a speed of 10–25; the number of network layers, nw, has an activity range of 1–5 and a speed range of 1–3; and the number of hidden layers and fully connected layers, nf, has an activity range of 64–256.
[0020] Further optimization yields the following velocity update formula for each particle's position in each dimension: v i,j (t+1)=w*v i,j (t)+lr0*rand()*(pbp i,j (t)-pop i,j (t))+lr1*rand()*(gbp j -pop i,j (t)), where i = 1, 2, ..., N, N is the total number of particles, j = 1, 2, ..., M, M is the dimension of each particle, v i,j (t) represents the current velocity of each particle at each position, pbp i,j (t) is the best position in the current particle's historical position, gbp jIt is the historical optimal position of the particle swarm; then it is determined whether the velocity range is within the set range, and if it is outside the range, the boundary value is taken.
[0021] Further optimization involves updating the particle positions, using the formula pop. i,j (t+1)=0.5*v i,j (t+1)+0.5*pop i,j (t), where i = 1, 2, ..., N, N is the total number of particles, j = 1, 2, ..., M, M is the dimension of each particle, pop i,j (t) is the position of the i-th particle in the j-th dimension. Then, it is determined whether the position range is within the set range. If it is outside the range, the boundary value is taken.
[0022] Further optimization involves using the feature data extracted by MFCC and the corresponding labels as input during training, calculating the gradient using forward and backward propagation, and updating the parameters of the substation acoustic fault diagnosis model based on the LSTM network using the gradient from backward propagation.
[0023] Further optimization is achieved during testing: the trained substation acoustic fault diagnosis model based on LSTM network is used to classify the feature data of the test set, calculate the accuracy, precision, recall and F1 score of the substation acoustic fault diagnosis model based on LSTM network, and judge the applicability and effectiveness of the substation acoustic fault diagnosis model based on LSTM network.
[0024] Further optimization, the specific process of step S1 is as follows:
[0025] Step S11: Perform high-pass filtering on the substation acoustic signal to enhance the intensity of the high-frequency component.
[0026] Step S12: Divide the substation acoustic signal into many small segments, each segment typically containing 20-40ms of substation acoustic signal.
[0027] Step S13: Window the substation acoustic signature signal of each frame to eliminate boundary effects and reduce frequency domain leakage.
[0028] Step S14: Perform a Fast Fourier Transform (FFT) on the windowed substation acoustic signature signal to convert the time-domain signal into a frequency-domain signal. Perform an N-point FFT on each frame of the windowed signal to calculate the spectrum, also known as a Short-Time Fourier Transform (STFT).
[0029] Step S15: Convert the Fourier transform result into a Mel frequency spectrum to better simulate the human ear's perception of different frequencies of sound.
[0030] Step S16: Perform Discrete Cosine Transform (DCT) on the Mel frequency spectrum to convert it into frequency domain coefficients, which can transform high-dimensional dense eigenvectors into low-dimensional dense eigenvectors.
[0031] Step S17: Remove the energy normalization coefficients from the frequency domain coefficients to obtain the final MFCC feature vectors, forming the feature dataset.
[0032] The present invention also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a substation acoustic fault diagnosis method based on LSTM-BHPSO.
[0033] The present invention provides a computer-readable storage medium storing computer instructions thereon, which, when executed by a processor, implement the substation acoustic fault diagnosis method based on LSTM-BHPSO.
[0034] The LSTM-BHPSO algorithm used in this invention is a method for training Long Short-Term Memory networks using a hybrid search strategy. Compared with traditional LSTM models and simple PSO-LSTM, LSTM-BHPSO has the following advantages:
[0035] 1. Higher search efficiency: LSTM-BHPSO uses a hybrid search strategy, including particle swarm optimization (PSO) and black hole optimization (BH), which makes the model more efficient in search and faster in convergence. It can train the model faster and get better results in the same amount of time.
[0036] 2. More automated parameter settings: LSTM-BHPSO does not require manual setting of many parameters. These parameters are automatically adjusted, such as the number of particles, velocity, position, number of iterations, and some hyperparameters of the LSTM model, thereby reducing the complexity of manual parameter setting.
[0037] 3. Better performance against overfitting: LSTM-BHPSO uses regularization methods, including dropout regularization, during training, which can better combat overfitting and improve the model's generalization performance.
[0038] 4. Better global optimum search capability: LSTM-BHPSO has a better global optimum search capability. It can optimize local optima through the BH algorithm and optimize global optima through the PSO algorithm, thereby achieving better training results.
[0039] 5. Wider range of applications: LSTM-BHPSO can not only be used for processing sequence data, but also for optimizing other types of models, such as image processing, speech recognition, and text classification, which makes it have a wide range of applications across multiple fields. Attached Figure Description
[0040] Figure 1 This is the algorithm implementation flowchart.
[0041] Figure 2 This is the training graph of the RBF neural network.
[0042] Figure 3 This is a diagram showing the algorithm's performance. Detailed Implementation
[0043] The invention will now be further explained in detail with reference to the accompanying drawings.
[0044] Reference Figure 1 The substation acoustic fault diagnosis method based on LSTM-BHPSO has the following steps:
[0045] Step S1: Collect the acoustic signature signal from the substation and extract features using MFCC to obtain a feature dataset. The feature dataset needs to be prepared and processed according to actual usage requirements, including obtaining classification labels. The feature dataset is divided into a training set and a test set in a 3:1 ratio.
[0046] Step S2: Construct a substation acoustic fault diagnosis model based on LSTM network;
[0047] Step S3: Using the number of feature points extracted by MFCC, the number of batch samples, the number of network layers, and the number of hidden and fully connected layers as the particle positions, the BHPSO algorithm is used to iteratively optimize the initial parameters. These optimal initial parameters are then input into the substation acoustic signature fault diagnosis model based on the LSTM network, referring to... Figure 2 ;
[0048] Step S31. The number of feature points extracted by MFCC is a parameter that needs to be optimized. The number of LSTM network layers, the number of hidden layers, and the number of fully connected layers can be adjusted. During data processing, the batch size also has a certain impact on the selection of data, so it can also be adjusted to a suitable position. Based on this, a total of four parameters are selected to continuously optimize and find a suitable position. Set the number of feature points extracted by MFCC to mf, set the batch size to bs, the number of network layers to nw, and the number of hidden layers and fully connected layers to nf; combine these four parameters to form the particle position pop and use the PSO algorithm (Particle Swarm Optimization) for iterative optimization.
[0049] Step S32. Set the number of particles to 10, and the inertia weight w of the particle swarm to 1; the learning factor lr0 and the social learning factor lr1 of the individual particles are 0.49445 and 1.49445, respectively; initialize the particle swarm positions, with upper and lower limits for each dimension of each position. Named tuples are used here to define the position range and velocity range for each dimension. The number of feature points mf extracted by MFCC has an activity range of 10 to 60, with a velocity range of 5 to 15; the number of batch samples bs has an activity range of 16 to 128, with a velocity range of 10 to 25; the number of network layers nw has an activity range of 1 to 5, with a velocity range of 1 to 3; and the number of hidden layers and fully connected layers nf has an activity range of 64 to 256.
[0050] Step S33. Set the particle swarm iteration count to 20, pop the particle positions and input them into the fitness calculation function to start the iteration. The fitness calculation function is the forward propagation and loss calculation process of the LSTM network. Use this loss as the fitness. The position data are some key parameters in LSTM, so the fitness in different dimensions can be calculated during the iteration process.
[0051] Step S34. During the iteration process, the position and velocity of the particles are updated. This process uses the ideas of particle swarm optimization and black hole algorithm to optimize the process, speed up convergence, and find the global optimal position.
[0052] Velocity update: The velocity update formula for each dimension of each particle's position is v. i,j (t+1)=w*v i,j (t)+lr0*rand()*(pbp i,j (t)-pop i,j (t))+lr1*rand()*(gbp j -pop i,j (t)), where i = 1, 2, ..., N, N is the total number of particles, j = 1, 2, ..., M, M is the dimension of each particle, v i,j (t) represents the current velocity of each particle at each position, pbp i,j (t) is the best position in the current particle's historical position, gbp j It is the historical optimal position of the particle swarm; then it is determined whether the velocity range is within the set range, and if it is outside the range, the boundary value is taken.
[0053] Position Update: Next is the particle position update. The formula for position update is pop. i,j (t+1)=0.5*v i,j (t+1)+0.5*pop i,j(t), where i = 1, 2, ..., N, N is the total number of particles, j = 1, 2, ..., M, M is the dimension of each particle, pop i,j (t) represents the position of the i-th particle in dimension j. Then, it is determined whether the position range is within the set range; if it is outside the range, the boundary value is taken.
[0054] Step S35. Then, substitute the updated position into the fitness function and recalculate to obtain the fitness pbf of each particle. i , where i = 1, 2, ... N, and N is the number of particles in the swarm.
[0055] Step S36. Black Hole Search: During the particle swarm search, the particle may get stuck in a local optimum. Check if the global optimum fitness has not changed after three iterations. If it hasn't changed after three iterations, reassign the particle velocities within the vicinity of the global optimum particle's position. This vicinity is the black hole's radius *r*. The distance between a particle and the optimal particle is calculated using the formula *pwd*. i =(gbp-pop) i ) 2 Let i = 1, 2, 3...N, where i represents each particle, N is the number of particles, gbp is the position of the optimal particle, and pop... i It represents the current position of each particle, pwd i It is the distance between the particle and the optimal particle.
[0056] Step S37. Black Hole Attraction: The black hole in the BH algorithm has the same attraction as a natural black hole; within the search radius, all celestial bodies are attracted to it. If r > pwd i Then the position of the optimal particle, gbp, will affect the position of the particle currently within r, i.e., the formula is: pop i (t+1)=pop i (t)+rand×(gbp-pop i (t), i = 1, 2, 3... N, where i represents each particle, pop i (t) represents the current position of the particle, and gbp represents the current global optimum. The purpose of this is to apply the idea of the black hole algorithm to gradually narrow the search space, break away from the current historical optimum, and find the global optimum.
[0057] Step S38. Inertia Weight Adjustment: If the optimal fitness remains unchanged across three iterations, adjust the inertia weight w. i (t+1)=w i (t)*0.9, where w i (t) represents the inertial weight of the i-th particle, w i(t+1) represents the inertia weight of the i-th particle in the next iteration. By adjusting the weight, the search step can be reduced to find the optimal point.
[0058] Step S39. After iteration, the position of the obtained optimal particle is used as the optimal initial parameter of the substation acoustic fingerprint fault diagnosis model based on the LSTM network. This parameter is then substituted into the LSTM network for model training and testing. With the addition of PSO and black hole algorithms for initial parameter optimization, the network's training loss reduction process is faster, allowing for quicker convergence. During loss iteration, it converges to a better position than a simple LSTM network. In subsequent training, we only need to save one optimal model as the acoustic fingerprint detection model. After obtaining the optimal initial parameters, these parameters are input into the LSTM network for 300 iterations. Comparing this to a traditional LSTM network iterated 300 times, the loss reduction effect is as follows: Figure 3 .
[0059] Step S4: Train the substation acoustic fingerprint fault diagnosis model based on the LSTM network using the training set, and verify it using the test set. Use the trained substation acoustic fingerprint fault diagnosis model based on the LSTM network to perform substation acoustic fingerprint fault diagnosis.
[0060] Training: The feature data extracted by MFCC and the corresponding labels are used as input. The gradient is calculated using forward propagation and backward propagation. The gradient of backward propagation is used to update the parameters of the substation acoustic fault diagnosis model based on LSTM network.
[0061] Testing: Using the trained LSTM-based substation acoustic fault diagnosis model, the feature data of the test set are classified, and the accuracy, precision, recall, and F1 score of the LSTM-based substation acoustic fault diagnosis model are calculated to determine its applicability and effectiveness.
[0062] MFCC is a widely used feature extraction method for audio signal analysis and processing. MFCC extracts features by performing a Discrete Fourier Transform (DFT) on the substation acoustic signature signal and converting the result into Mel-frequency cepstral coefficients.
[0063] Step S11: Perform high-pass filtering on the substation acoustic signal to enhance the intensity of the high-frequency component.
[0064] Step S12: Divide the substation acoustic signal into many small segments, each segment typically containing 20-40ms of substation acoustic signal.
[0065] Step S13: Window the substation acoustic signature signal of each frame to eliminate boundary effects and reduce frequency domain leakage.
[0066] Step S14: Perform a Fast Fourier Transform (FFT) on the windowed substation acoustic signature signal to convert the time-domain signal into a frequency-domain signal. Perform an N-point FFT on each frame of the windowed signal to calculate the spectrum, also known as a Short-Time Fourier Transform (STFT).
[0067] Step S15: Convert the Fourier transform result into a Mel frequency spectrum to better simulate the human ear's perception of different frequencies of sound.
[0068] Step S16: Perform Discrete Cosine Transform (DCT) on the Mel frequency spectrum to convert it into frequency domain coefficients, which can transform high-dimensional dense eigenvectors into low-dimensional dense eigenvectors.
[0069] Step S17: Remove the energy normalization coefficients from the frequency domain coefficients to obtain the final MFCC feature vectors, forming the feature dataset.
[0070] After MFCC feature extraction, the resulting MFCC feature vector has the following characteristics: MFCC feature vectors are a set of compressed representations, achieving a high compression ratio by retaining fewer coefficients, making them suitable for audio data storage and transmission. During Mel filtering, high-frequency and low-frequency "redundant information" is filtered out, making the resulting MFCC feature vectors more concise. Audio information is mainly concentrated on the lower-frequency MFCC feature vectors: the extracted MFCC feature vectors effectively describe the audio. Therefore, in machine learning and digital signal processing, MFCC feature vectors are often used as input. MFCC technology considers the human ear's perception mechanism of audio; therefore, through MFCC extraction, important acoustic features such as pitch, volume, rhythm, and timbre are preserved, making them suitable for voiceprint recognition applications.
[0071] The specific implementation of the PSO optimization process has already been introduced in the theoretical section. Here, the concrete implementation involves using these four initial parameters as the position coordinates of the particle swarm, that is, optimizing to the most suitable position in a four-dimensional vector space. In this process, the standard for judging the fitness of the position is the iteration loss rate. In the pso.py program, the LSTM deep learning network is also called, the number of iterations is set, and the loss after the iteration is used as the fitness of the particle. Then, the particle with the best fitness is found and designated as the optimal particle. Other particles will change their velocity, that is, the direction and step of the next step, according to the position of the optimal particle and some initial weight parameters set in PSO. After updating the velocity and position of each particle, the fitness is calculated, and then the previous operation is repeated. This iterative process is the particle swarm optimization process. This process incorporates the concept of the black hole algorithm. During particle swarm optimization, particle parameters are constantly updated. After calculating fitness, the particle may get stuck in a local optimum, making it difficult to find a more suitable position. Therefore, the principle of the black hole algorithm is used. When the particle swarm's fitness is insufficient to escape the current optimal position within a certain time, the parameters of the particle at the current optimal position are chosen as the global optimal parameters. A certain black hole radius is set, and the search is performed on surrounding particles within this set radius, centered on the current particle. The optimal velocity parameters are directly assigned to the particles within the radius. Based on the principle of the black hole algorithm, the process attempts to escape local optima and then recalculates the fitness to update the particle parameters.
[0072] During network training, regularization is used. The Dropout method randomly removes some neurons from the LSTM network to reduce redundant information in the model, thereby avoiding overfitting. First, a Dropout layer is added to the LSTM network, and the probability of randomly removing neurons is set to a small value, 0.5. Then, during the training of the LSTM model, the Dropout layer randomly masks some neurons in each iteration, thereby reducing the training parameters and mitigating the risk of overfitting.
[0073] After clarifying the core design idea of the algorithm, this model is built. Based on the audio signal after MFCC feature extraction, the LSTM-BHPSO network can be used to achieve the audio classification task.
[0074] LSTM (Long Short-Term Memory) is a special type of RNN network that can efficiently process time-series data and avoids the vanishing gradient problem in traditional RNNs. An LSTM network consists of recurrent units and three gates: an input gate, an output gate, and a forget gate. The basic architecture of an LSTM network is as follows:
[0075] 1. Input Gate: The input gate is a sigmoid neuron that controls which information in the input stream should be retained and which should be forgotten. The input gate is based on the input X from the previous time step. t and the output h of the previous time step t-1 The result is a value in the range of 0 to 1.
[0076] 2. Forget Gate: The forget gate is also a sigmoid neuron that controls which information from the previous time step should be forgotten and which should be retained. The forget gate is based on the previous input X. t and the output h of the previous time step t-1 The result is a value in the range of 0 to 1.
[0077] 3. Cell State: The cell state is where information is transmitted. It maintains the long-term memory in the time series and determines the flow of information about the current state. The cell state is controlled by the input gate and the forget gate, and it calculates the cell state value at the current time step based on the output of the input gate and the cell state at the previous time step.
[0078] 4. Output Gate: The output gate is also a sigmoid neuron, which determines which information from the unit state needs to be output. The output gate is based on the input X from the previous time step. t and the output h of the previous time step t-1 The result is a value in the range of 0 to 1.
[0079] 5. Final Output: The final output is h t The final output is influenced by both the cell state and the output gates. The final output will then carry the information to the next time step.
[0080] In general, LSTM is a powerful network that can model time series data by manipulating the interactions between neurons. Its architecture enables the recording of past information and the analysis of relationships between different pieces of information.
[0081] PSO (Particle Swarm Optimization) is an evolutionary optimization algorithm that simulates the motion behavior of particles in space and the behavior of swarm intelligence.
[0082] The core idea of the PSO algorithm is to find the global optimum within the search space based on the current position and velocity of each particle. Its basic process is as follows:
[0083] 1. Initialization: Define information such as the number of particles, velocity, position, and fitness, and randomly initialize the position and velocity of each particle.
[0084] 2. Calculate fitness: Calculate the fitness function for each particle to obtain the fitness value at the current position.
[0085] 3. Update speed: Based on the particle's position and velocity, update the particle's velocity, which includes an inertia factor, the individual optimal velocity, and the global optimal velocity.
[0086] 4. Update position: Update the particle's position based on its updated velocity, i.e., move it to the new position.
[0087] 5. Selecting the global best: When each particle updates its velocity and position, it needs to consider both the historical best position that the particle itself can observe and the global best position that the entire particle swarm can observe.
[0088] 6. Termination condition determination: When a certain convergence criterion is reached or the number of iterations reaches the preset upper limit, the iteration ends and the optimal solution is output.
[0089] The PSO algorithm has advantages such as fast convergence speed, ease of implementation, and applicability to high-dimensional optimization problems, and is widely used in fields such as function optimization, neural network training, image processing, and signal processing.
[0090] The Black Hole Algorithm is an optimization algorithm that utilizes the physical phenomenon of interstellar black holes absorbing surrounding mass in ultraviolet astronomy. Based on the concepts of swarm intelligence and natural evolution, the Black Hole Algorithm updates particle positions by simulating the mass absorption behavior of a black hole in order to find the optimal solution.
[0091] The basic process of the black hole algorithm is as follows:
[0092] 1. Initialization: Define the number of particles, initial particle positions and velocities, objective function, and other parameters.
[0093] 2. Determine fitness: Calculate the fitness function for each particle to obtain the fitness value at the current position, and determine whether the optimal solution has been reached.
[0094] 3. Search: Update the position and velocity of each particle and calculate the fitness value for that position.
[0095] 4. Collision detection: Collision detection is performed between every two particles. If the distance is less than a certain threshold, the smaller particle is deleted, the mass table is updated, and a new particle is randomly generated.
[0096] 5. Update the black hole: Based on the change in mass, update the position of the black hole, and surrounding particles will move towards the black hole.
[0097] 6. Convergence determination: When a certain convergence criterion is reached or the number of iterations reaches the preset upper limit, the iteration ends and the optimal solution is output.
[0098] The black hole algorithm can be applied to single-objective optimization problems, multi-objective optimization problems, and combinatorial optimization problems. It has good optimization results in solving nonlinear problems and highly complex optimization problems.
[0099] The Black Hole Optimization Algorithm (PSO) is a heuristic optimization algorithm. The PSO algorithm is based on a model of bird flock foraging behavior. Each solution can be regarded as an individual bird. Each individual bird will adjust its position according to the difference between its current position and the global optimal position, thereby realizing the process of searching for the global optimal solution in the solution space.
[0100] In its further development, the PSO algorithm has received explosive attention, leading more researchers to try to improve it. One such improvement is the introduction of a concept similar to a "black hole," which generates a virtual center of mass during the search process, causing all bird individuals within the "black hole's" gravitational pull to move closer to its location.
[0101] Based on this idea, the black hole search algorithm was introduced and developed. Its core idea is to use the principle of universal gravitation of black holes to treat the solution of the optimization problem as objects and particles. By using the gravitational interaction between particles and the local optimum control law, the solution near the inferior solution can be driven to escape the local optimum trap and eventually gather at the global optimum position.
[0102] In summary, the BHPSO algorithm is an improvement and extension of the PSO algorithm. By introducing the concept of black holes, it increases the algorithm's search efficiency and global optimization capabilities.
[0103] This embodiment also provides an electronic device, including: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement a substation acoustic fault diagnosis method based on LSTM-BHPSO.
[0104] This embodiment provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the substation acoustic fault diagnosis method based on LSTM-BHPSO.
[0105] The above-described invention merely illustrates implementation methods of the present invention and should not be construed as limiting the scope of the invention patent, nor as imposing any form of limitation on the structure of the embodiments of the present invention. It should be noted that those skilled in the art can make various changes and improvements without departing from the concept of the embodiments of the present invention, and these all fall within the protection scope of the embodiments of the present invention.
Claims
1. A substation acoustic fault diagnosis method based on LSTM-BHPSO, characterized in that, The steps are as follows: Step S1: Collect the acoustic signature signal of the substation and use MFCC to extract features to obtain a feature dataset. Divide the feature dataset into a training set and a test set. Step S2: Construct a substation acoustic fault diagnosis model based on LSTM network; Step S3: The number of feature points extracted by MFCC, the number of batch samples, the number of network layers, and the number of hidden layers and fully connected layers are used as the positions of particles. The BHPSO algorithm is used to iteratively optimize the initial parameters and input the optimal initial parameters into the substation acoustic fault diagnosis model based on LSTM network. Step S4: Train the substation acoustic fingerprint fault diagnosis model based on the LSTM network using the training set, and verify it using the test set. Use the trained substation acoustic fingerprint fault diagnosis model based on the LSTM network to perform substation acoustic fingerprint fault diagnosis. The specific process of step S3 is as follows: Step S31. Set the number of feature points extracted by MFCC to mf, the number of batch samples to parameter bs, the number of network layers to nw, and the number of hidden layers and fully connected layers to nf; combine these four parameters to form the particle position pop and use the PSO algorithm for iterative optimization. Step S32. Set the number of particles, set the inertia weight of the particle swarm, set the learning factor lr0 and social learning factor lr1 for each particle; initialize the particle swarm position. Step S33. Set the number of particle swarm iterations, input the particle positions into the function for calculating fitness, and start the iteration; Step S34. Update the particle's position and velocity during the iteration process; Step S35. Then, the updated position is substituted into the fitness function and recalculated to obtain the fitness of each particle; Step S36. Black Hole Search: During the particle swarm search, determine whether the global optimal fitness has not changed after three iterations. If it has not changed after three iterations, reassign the particle velocities within the vicinity of the global optimal particle's position. This vicinity is the radius *r* of the black hole. The formula for the distance between a particle and the optimal particle is... Let i = 1, 2, 3...N, where i represents each particle, N is the number of particles, gbp is the position of the optimal particle, and pop... i It represents the current position of each particle, pwd i It is the distance between the particle and the optimal particle; Step S37. Black hole attraction: If r > pwd i The position of the optimal particle, gbp, will affect the position of the particle currently within r, as shown in the formula: ; Step S38. Inertia Weight Adjustment: If the optimal fitness remains unchanged across three iterations, adjust the inertia weight w. i (t+1) = w i (t)*0.9, where w i (t) represents the inertial weight of the i-th particle, w i (t+1) represents the inertia weight of the i-th particle in the next iteration. With the weight adjustment, the search step is reduced to find the optimal point. Step S39. After the iteration is completed, the position of the obtained optimal particle is used as the optimal initial parameter of the substation acoustic fault diagnosis model based on LSTM network.
2. The substation acoustic fault diagnosis method based on LSTM-BHPSO according to claim 1, characterized in that, The number of feature points extracted by MFCC, mf, has an activity range of 10~60, with a speed of 5~15; the number of batch samples, bs, has an activity range of 16~128, with a speed of 10~25; the number of network layers, nw, has an activity range of 1~5, with a speed range of 1~3; and the number of hidden layers and fully connected layers, nf, has an activity range of 64~256.
3. The substation acoustic fault diagnosis method based on LSTM-BHPSO according to claim 1, characterized in that, The velocity update formula for each dimension of each particle's position is v. i,j (t+1)=w*v i,j (t)+lr0*rand()*(pbp i,j (t)-pop i,j (t))+lr1*rand()*(gbp j -pop i,j (t)), where i = 1, 2, ..., N, N is the total number of particles, j = 1, 2, ..., M, M is the dimension of each particle, v i,j (t) represents the current velocity of each particle at each position, pbp i,j (t) is the best position in the current particle's historical position, gbp j It is the historical optimal position of the particle swarm; then it is determined whether the velocity range is within the set range, and if it is outside the range, the boundary value is taken.
4. The substation acoustic fault diagnosis method based on LSTM-BHPSO according to claim 1, characterized in that, The formula for position update is pop. i,j (t+1)=0.5*v i,j (t+1)+0.5*pop i,j (t), where i = 1, 2, ..., N, N is the total number of particles, j = 1, 2, ..., M, M is the dimension of each particle, pop i,j (t) is the position of the i-th particle in dimension j; then it is determined whether the position range is within the set range, and if it is outside the range, the boundary value is taken.
5. The substation acoustic fault diagnosis method based on LSTM-BHPSO according to claim 1, characterized in that, In step S4, during training, the feature data extracted by MFCC and the corresponding labels are used as input, the gradient is calculated using forward propagation and backward propagation, and the parameters of the substation acoustic fault diagnosis model based on LSTM network are updated using the gradient of backward propagation.
6. The substation acoustic fault diagnosis method based on LSTM-BHPSO according to claim 1, characterized in that, In step S4, during testing: the trained substation acoustic fault diagnosis model based on LSTM network is used to classify the feature data of the test set, calculate the accuracy, precision, recall and F1 score of the substation acoustic fault diagnosis model based on LSTM network, and judge the applicability and effectiveness of the substation acoustic fault diagnosis model based on LSTM network.
7. The substation acoustic fault diagnosis method based on LSTM-BHPSO according to claim 1, characterized in that, The specific process of step S1 is as follows: Step S11: Perform high-pass filtering on the substation acoustic signal to enhance the intensity of the high-frequency components; Step S12: Divide the substation acoustic signature signal into multiple segments, each segment containing 20-40ms of substation acoustic signature signal; Step S13: Perform windowing processing on the substation acoustic signature signal of each frame; Step S14: Perform a Fast Fourier Transform (FFT) on the windowed substation acoustic signature signal to convert the time-domain signal into a frequency-domain signal; perform an N-point FFT on each frame of the windowed signal to calculate the spectrum, also known as a Short Time Fourier Transform (SFT). Step S15: Convert the Fourier transform result into a Mel frequency spectrum; Step S16: Perform a discrete cosine transform on the Mel frequency spectrum to convert it into frequency domain coefficients; Step S17: Remove the energy normalization coefficients from the frequency domain coefficients to obtain the final MFCC feature vectors, forming the feature dataset.
8. An electronic device, comprising: One or more processors; A memory for storing one or more programs; characterized in that, when the one or more programs are executed by the one or more processors, the one or more processors implement the substation acoustic fault diagnosis method based on LSTM-BHPSO as described in claim 1.
9. A computer-readable storage medium storing computer instructions thereon, characterized in that, When the computer instructions are executed by the processor, they implement the substation acoustic fault diagnosis method based on LSTM-BHPSO as described in claim 1.