Tin smelting anomaly detection method fusing improved optimization algorithm and diffusion model

By optimizing the hyperparameters of the diffusion model through data time alignment and improved particle swarm optimization algorithm, combined with dynamic threshold updates, the problems of multi-timescale feature integration and high false alarm rate in anomaly detection in tin smelting were solved, achieving efficient and real-time anomaly detection results.

CN121185362AActive Publication Date: 2025-12-23KUNMING UNIV OF SCI & TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511428280.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-30
Publication Date
2025-12-23
Estimated Expiration
2045-09-30

AI Technical Summary

Technical Problem

Existing methods for detecting anomalies in tin smelting are difficult to effectively integrate features across multiple time scales. Traditional data alignment methods lead to information distortion and high false alarm rates. Furthermore, diffusion models lack hyperparameter adaptive mechanisms when applied to metallurgical time-series data, making it impossible to dynamically adapt to process fluctuations.

Method used

A combination strategy of moving average filtering and cubic spline interpolation is adopted for data time alignment. The particle swarm optimization algorithm (IPSO) is improved to optimize the hyperparameters of the diffusion model. Anomaly detection is carried out by combining a dynamic threshold update mechanism. Through nonlinear inertial weights, hybrid mutation and learning factors, the noise scheduling factor is dynamically adjusted to achieve multi-scale data fusion and anomaly detection.

Benefits of technology

It improved data utilization and detection accuracy, reduced false alarm rate, met the real-time monitoring needs of tin smelting process, reduced false alarm rate to 0.5%, shortened training time, and increased throughput to 6 times that of traditional models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121185362A_ABST
    Figure CN121185362A_ABST
Patent Text Reader

Abstract

The invention discloses a tin smelting anomaly detection method fusing an improved optimization algorithm and a diffusion model, and belongs to the technical field of industrial process monitoring, and the method comprises the steps: executing a data space-time reference calibration operation on collected data to form a structured data dictionary, executing a multi-time scale data fusion operation, and constructing a smelting process data set; based on an improved particle swarm optimization algorithm, obtaining an optimal hyper-parameter set of the diffusion model; tin smelting anomaly detection operation is executed through the diffusion model of the optimal hyper-parameter; and based on the comprehensive anomaly score and the dynamic threshold value, the hyper-parameters are optimized again, a closed-loop optimization system is formed, and tin smelting anomaly detection is completed. According to the method, a sliding average filtering and cubic spline interpolation combined strategy is adopted, and the time alignment problem of second-level and hour-level data is solved; according to the improved particle swarm optimization, through three innovations of nonlinear inertia weight, mixed variation and learning factor self-adaption, the optimization speed of hyper-parameters of the diffusion model is increased, and the hit rate of a global optimal solution is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial process monitoring technology, specifically to a method for detecting anomalies in tin smelting that integrates an improved optimization algorithm and a diffusion model. Background Technology

[0002] With the development of intelligent non-ferrous metal smelting, anomaly detection technology has become a core link in ensuring production safety and process stability. Tin smelting, as a typical high-temperature, multiphase reaction process, involves the dynamic coupling of multi-source heterogeneous data such as molten pool temperature, gas composition, and raw material ratio, posing many challenges to anomaly detection. Existing methods mostly employ single-timescale monitoring, making it difficult to effectively integrate the multi-timescale characteristics of high-frequency sensors, process parameters, and laboratory data. Traditional data alignment methods are prone to information distortion and cannot capture the dynamic correlations of the smelting process. Smelting process data often exhibit nonlinear and non-Gaussian distribution characteristics, and traditional statistical methods rely on Gaussian assumptions, resulting in low sensitivity to sudden anomalies. Existing research is mostly based on fixed thresholds or alarms for single physical quantities, which cannot dynamically adapt to process fluctuations, leading to false alarm rates as high as 15%-20%. Deep learning methods such as the Denoising Diffusion Probability Model (DDPM) require manual adjustment of hyperparameters, but the parameter space is complex in smelting scenarios, and traditional grid search is time-consuming and prone to getting trapped in local optima. Existing anomaly scoring is mostly based on static thresholds, which cannot adapt to long-term operating condition drift such as raw material fluctuations and equipment aging. Studies have shown that the false alarm rate of static thresholds rises to over 25% after 72 hours of continuous production.

[0003] Currently, some technologies have attempted to incorporate intelligent algorithms for improvement, such as Particle Swarm Optimization (PSO) for spectrometer parameter tuning and infrared thermometry for molten pool monitoring. However, these technologies still suffer from slow convergence and premature convergence. While diffusion models perform well in image generation, their application in metallurgical time-series data is still in the exploratory stage, and they lack hyperparameter adaptive mechanisms tailored to smelting scenarios. Therefore, there is an urgent need for a high-precision anomaly detection method that integrates features from multiple data sources and possesses dynamic adaptability to solve the real-time monitoring challenges of complex smelting processes. Summary of the Invention

[0004] Technical problems to be solved:

[0005] To address the aforementioned problems, this invention provides a method for detecting anomalies in tin smelting that integrates an improved optimization algorithm and a diffusion model.

[0006] To achieve the above technology, the specific steps are as follows:

[0007] S1. Collect multi-source heterogeneous data during the tin smelting process, and perform data spatiotemporal reference calibration on the collected data to form a structured data dictionary;

[0008] Multi-source heterogeneous data includes: second-level data and hour-level data;

[0009] The method of acquiring data at the second level is as follows: data is acquired in real time through a high-frequency sensor at a preset sampling frequency, and the acquired second-level data is the dynamic operating condition parameter of the core smelting equipment.

[0010] The hourly data acquisition method is as follows: integrate offline test data, which means connecting to the laboratory information management system and importing material composition analysis results once an hour. The Sn content in crude tin is determined by X-ray fluorescence spectroscopy, and the data format is percentage.

[0011] The data spatiotemporal reference calibration operation is performed as follows: the acquisition terminals for second-level and hour-level data are connected to the NTP time server, and an equipment topology map is established in the DCS system. The sensor data is bound to the coordinates of the corresponding process unit, and equipment ID, physical unit, and range attribute information are added to each data point to form a structured data dictionary.

[0012] S2. Perform multi-timescale data fusion operations on the structured data dictionary to construct a smelting process dataset;

[0013] Multi-timescale data fusion operations include: second-level data moving average filtering, hour-level data cubic spline interpolation, and unified time index dataset construction.

[0014] The second-level data moving average filtering operation is performed as follows: A moving average filter is applied to the second-level data from the high-frequency sensor to suppress high-frequency noise interference and retain effective process characteristics. The expression is as follows:

[0015]

[0016] In the formula, This represents the output value after filtering. The window width is w=60, the step size=10, the window width of 60 seconds covers the melting reaction cycle, and the step size of 10 seconds balances the smoothness and real-time performance of the data, retaining effective process features while eliminating random noise. Indicates the current time point; The index representing the current time point, in seconds; This refers to the raw input data, which in this invention is second-level data from a high-frequency sensor;

[0017] The method for cubic spline interpolation of hourly data is as follows: Time alignment is performed on hourly process parameters using a cubic spline interpolation function. The cubic spline interpolation function satisfies the second derivative continuity condition, and its expression is as follows:

[0018]

[0019] In the formula, This represents the cubic spline interpolation function; Represents the original hourly timestamp; This represents the process parameter value corresponding to the timestamp, and after interpolation, outputs data with a time resolution in the second range. This represents the total number of hourly data points; j represents the index of the total number of hourly data points.

[0020] The unified time-indexed dataset construction method involves integrating multi-source data into a unified spatiotemporal benchmark to form a matrix-based dataset. Specifically, it uses second-level data timestamps as the benchmark and synchronizes and aligns the interpolated hour-level data to construct the smelting process dataset. , where n is the total number of time points and d is the multidimensional feature.

[0021] S3. Improved Particle Swarm Optimization (IPSO) algorithm, which takes the smelting process dataset as input to obtain the optimal set of hyperparameters for the diffusion model;

[0022] IPSO simultaneously optimizes model accuracy and computational efficiency, balancing detection performance with real-time requirements;

[0023] The smelting process dataset is encoded as a feature vector, which serves as the input dimension for IPSO. IPSO optimizes the noise scheduling factor. At that time, the search range is automatically adjusted according to the current process parameters, and the anomaly detection results are used as the fitness function correction term of IPSO; when anomaly scores occur, IPSO prioritizes optimizing the noise scheduling factor. To enhance noise suppression capabilities, a hierarchical optimization architecture is adopted, with the upper layer optimizing the IPSO global noise scheduling factor. With DDPM core hyperparameter set Updated every 24 hours; Lower-level fine-tuning: Based on real-time process data, noise scheduling factors are adjusted using local particle swarm optimization. Hourly fine-tuning was performed to match the noise injection rate with the smelting stage, including the hyperparameter set. middle, Represents the initial noise scheduling coefficient. Indicates the noise attenuation coefficient. Indicates the noise scheduling factor;

[0024] The improvement steps include:

[0025] S3.1, using the smelting process dataset As input, the positions and velocities of a preset number of particles are randomly initialized, and initial parameters and optimization objectives are set;

[0026] The initial parameters include: inertia weights, a first learning factor, and a second learning factor;

[0027] The optimization objective is the set of hyperparameters for the diffusion model (DDPM);

[0028] S3.2 Initialize the particle swarm, generate the current iteration number, and perform nonlinear inertia weight adjustment to improve the convergence speed;

[0029] The method for performing nonlinear inertia weight adjustment is as follows: design an inertia weight update mechanism with quadratic function decay to balance the algorithm's global exploration and local development capabilities;

[0030] The expression for the nonlinear inertia weight adjustment operation is as follows:

[0031]

[0032] In the formula, Indicates the initial inertia weight; Indicates the termination weight; Indicates the maximum number of iterations; Indicates the current iteration step;

[0033] S3.3 When a particle fails to update its optimal position within a preset number of iterations, a Cauchy-Gaussian hybrid mutation is used. By introducing a hybrid mutation perturbation mechanism, premature convergence of the particle swarm is avoided, and the historical optimal solution is obtained.

[0034] Cauchy mutations make long jumps in the solution space, avoiding getting trapped in local optima and improving global search efficiency;

[0035] Gaussian mutation is used to fine-tune the neighborhood of high-quality solutions, improving the accuracy of parameter optimization.

[0036] In this invention, when a particle fails to update its optimal position for K=5 consecutive iterations, with probability p m =0.2 performs a mutation operation, with the following expression:

[0037]

[0038] In the formula, Indicates the parameter value of the current particle; This represents the new parameter value after the mutation; Indicates the control Cauchy distribution The global disturbance intensity term, =0.1; Indicates a moderated Gaussian distribution Local fine-tuning items, =0.05;

[0039] The long-tailed nature of the Cauchy distribution helps to escape local optima, the fine-tuning ability of the Gaussian distribution improves convergence accuracy, and the Cauchy-Gaussian mixed mutation improves the search efficiency of the algorithm in the hyperparameter set of the diffusion model (DDPM).

[0040] S3.4. Using the current iteration number and the historical best solution of the particle swarm as input, perform an adaptive operation on the social learning factor to dynamically adjust the individual learning factor and the social learning factor, and optimize the particle swarm cooperation mode.

[0041] The expressions for dynamically adjusting individual learning factors and social learning factors are as follows:

[0042]

[0043]

[0044] In the formula, Represents an individual's learning factor; Represents social learning factors; let It decreases linearly from 2.5 to 0.5. It increases linearly from 0.5 to 2.5.

[0045] S4. Based on the diffusion model and the obtained optimal hyperparameter set of the diffusion model, and using the smelting process dataset as input, perform tin smelting anomaly detection operation;

[0046] The procedure for performing anomaly detection in tin smelting is as follows:

[0047] Using the smelting process dataset as input, forward diffusion and reverse denoising operations are performed to obtain the predicted data;

[0048] The forward diffusion process design includes: defining a progressive noise injection mechanism with a preset total diffusion time step to gradually perturb the original data into a Gaussian distribution; whereby forward diffusion includes multi-step diffusion and single-step diffusion;

[0049] The expression for multi-step diffusion is as follows:

[0050]

[0051] In the formula, This represents the raw data, which in this invention is the smelting process dataset; Indicates the total diffusion time steps. The index representing the total diffusion time steps. It is sampled from a uniform distribution in the range [1, T]; Indicates the first Noisy data of the step; Indicates the first Noisy data of the step;

[0052] The expression for single-step diffusion is as follows:

[0053]

[0054] In the formula, This represents the transfer distribution of a single-step diffusion; This represents the mean value after noise injection; Represents the noise variance; where, The noise scheduling coefficient is dynamically generated using a cosine adjustment strategy, and its expression is as follows:

[0055]

[0056] In the formula, This represents the truncation function; Represents the noise scheduling factor. ∈[0.8, 1.2], which is the scheduling factor for IPSO optimization, used to adjust the noise injection rate; This represents the loop variable in the summation formula, indicating that when calculating the normalized denominator, the loop iterates from step 1 to step 2. All diffusion steps in the total number of diffusion steps;

[0057] The reverse denoising process training includes: inputting noisy data into a pre-trained UNet network, learning the data distribution reconstruction, and using the DDIM algorithm to improve sampling efficiency. The loss function is designed as follows:

[0058]

[0059] In the formula, Represents random Gaussian noise. It is random noise; This represents the noise predicted by UNet; This represents the cumulative noise product factor. is the cumulative noise product factor, where Indicates the first The noise scheduling coefficient of the step is optimized by IPSO. Control, used to determine the noise injection rate;

[0060] In the inverse denoising process of DDPM, IPSO is used to generate the latent variable z. (m) The key feature dimensions that cause anomalies are located through particle swarm collaboration mechanism;

[0061] The expression for improving sampling efficiency using the DDIM algorithm is as follows:

[0062]

[0063] In the formula, express Single-step noise retention factor; express Single-step noise retention factor; The intensity of random disturbance is expressed by the following formula:

[0064]

[0065] In the formula, Denotes the coefficient of certainty. =0.5, balancing generation quality and speed, avoiding false alarms caused by excessive random perturbations.

[0066] S5. Calculate the comprehensive anomaly score and feed it back to the improved particle swarm optimization algorithm (IPSO) through a dynamic threshold update mechanism. Re-optimize the hyperparameters every preset time period to form a closed-loop optimization system and complete the anomaly detection in tin smelting.

[0067] The comprehensive anomaly score calculation includes: reconstruction probability calculation and latent space KL divergence calculation;

[0068] The reconstruction probability is calculated using real-time process data and the latent variable z. (m) Using Monte Carlo sampling as input, the negative log-likelihood of the input samples is calculated to obtain the reconstruction error score;

[0069] The expression for calculating the reconstruction probability is as follows:

[0070]

[0071] In the formula, Indicates the reconstruction error score; In this embodiment, the number of Monte Carlo samplings is indicated. ; This represents the probability of generation by the diffusion model (DDPM); This represents the input sample, which in this invention is the smelting process dataset at the current moment; Indicate latent variables;

[0072] The latent space KL divergence is calculated as follows: the posterior distribution output by the UNet network is used as input, and the KL divergence calculation formula is used to calculate the KL divergence score.

[0073] The expression for calculating the KL divergence in the latent space is as follows:

[0074]

[0075] In the formula, This represents the posterior distribution after UNet encoding; This represents the standard Gaussian prior. ; Represents the trace of a matrix; This represents the covariance of the posterior distribution; This represents the mean of the posterior distribution; This represents a multidimensional feature, d=15;

[0076] The comprehensive anomaly score is calculated by weighting and fusing the reconstruction error score and the KL divergence score to generate the comprehensive anomaly score.

[0077] The expression for calculating the anomaly score is as follows:

[0078]

[0079] In the formula, The weighting coefficients are determined through ROC curve analysis on the validation set; IPSO can also be used for real-time optimization. This allows for dynamic adjustment based on process conditions. For example, during the high-temperature stage, KL divergence weights are increased to capture potential distribution shifts. Anomaly scores are calculated for second-level and hour-level data respectively. IPSO optimizes the fusion weights at each time scale to improve sensitivity to sudden and gradual anomalies.

[0080] Noise scheduling parameters optimized by IPSO The sensitivity of each feature to anomaly scoring during the forward diffusion process is analyzed to achieve a physical explanation of the anomaly source.

[0081] The dynamic threshold update mechanism works as follows: the alarm threshold is updated every 24 hours based on the latest data. When the comprehensive calculated anomaly score exceeds the threshold, it is determined to be an anomaly, and the anomaly detection result is fed back to IPSO in real time to re-optimize hyperparameters. In this invention, X is collected. new For 1000 normal samples covering one production cycle, the formula for calculating the statistic is as follows:

[0082]

[0083]

[0084] In the formula, This represents the mean of the abnormalities among normal samples. This represents the number of normal samples; in this embodiment, N=1000. Index representing a normal sample; Indicates the first The comprehensive abnormality score of a normal sample;

[0085] The expression for the threshold is as follows:

[0086]

[0087] In the formula, This represents the threshold.

[0088] Beneficial effects of the present invention

[0089] To address core issues such as multi-scale data fusion, non-Gaussian anomaly detection, and dynamic threshold updating in tin smelting, this invention proposes a collaborative framework combining an improved particle swarm optimization algorithm and a denoised diffusion probability model. This framework overcomes the limitations of traditional methods and provides key technical support for the intelligentization of metallurgical processes.

[0090] This invention employs a combination strategy of moving average filtering and cubic spline interpolation to solve the time alignment problem of second-level and hour-level data. Compared with traditional downsampling methods, it improves feature retention rate and data utilization.

[0091] This invention improves the particle swarm optimization algorithm through three innovations: nonlinear inertial weighting, hybrid mutation, and adaptive learning factor. This improves the optimization speed of hyperparameters in the diffusion model and increases the global optimal solution hit rate. The DDPM model based on IPSO optimization shows a reduction in the distribution error of normal operating condition data.

[0092] Compared with the fixed threshold method, the present invention reduces the false alarm rate, accelerates sampling, compresses the reverse generation steps, and reduces the time consumed per sampling, thus meeting the real-time requirements of online monitoring of production lines. Attached Figure Description

[0093] Figure 1 This is a flowchart of the steps of the present invention;

[0094] Figure 2 This is a schematic diagram of the overall process of the present invention;

[0095] Figure 3 This invention is a data fusion of second-level and hour-level data;

[0096] Figure 4 This is a flowchart of the IPSO optimization process of the present invention;

[0097] Figure 5 This is a schematic diagram of the DDPM training process of the present invention. Detailed Implementation

[0098] The present invention will be further described in detail below with reference to specific embodiments.

[0099] This embodiment uses the top-blown furnace smelting process in an industrial setting as an example to conduct an experiment on anomaly detection in tin smelting.

[0100] like Figure 1 and Figure 5 As shown, a method for detecting anomalies in tin smelting that integrates an improved optimization algorithm and a diffusion model includes the following steps:

[0101] S1. Collect multi-source heterogeneous data during the tin smelting process, and perform data spatiotemporal reference calibration on the collected data to form a structured data dictionary;

[0102] Multi-source heterogeneous data includes: second-level data and hour-level data;

[0103] The method of second-level data acquisition is as follows: real-time acquisition is carried out through high-frequency sensors at a preset sampling frequency. The acquired second-level data are the dynamic operating parameters of the core smelting equipment, including: molten pool temperature, lance pressure and oxygen concentration.

[0104] In this embodiment, a high-precision industrial sensor network is deployed to continuously collect dynamic operating parameters of the core smelting equipment at a sampling frequency of 1Hz. Specifically, the molten pool temperature is measured using a K-type armored thermocouple (measurement range 0-1600℃), inserted into the reaction zone of the smelting furnace, to collect second-level fluctuation data of the temperature at a depth of 200mm below the molten metal surface. The spray gun pressure is recorded in real-time by using a piezoresistive pressure transmitter (range 0-10MPa, accuracy ±0.5%FS) installed in the spray gun's gas supply pipeline to record transient changes in oxygen injection pressure. The oxygen concentration is detected online using a laser gas analyzer (TDLAS technology), which has a resolution of 0.1 vol% and a data refresh cycle of 1 second.

[0105] The hourly data acquisition method is as follows: integrate offline test data, which means connecting to the laboratory information management system and importing material composition analysis results once an hour. The Sn content in crude tin is determined by X-ray fluorescence spectrometry (XRF) with an accuracy of ±0.05%, and the data format is percentage (%).

[0106] The data spatiotemporal reference calibration operation is performed as follows: the acquisition terminals for second-level and hour-level data are connected to the NTP time server (clock deviation <10ms), and an equipment topology map is established in the DCS system. The sensor data is bound to the coordinates of the corresponding process unit (such as smelting furnace, fuming furnace, waste heat boiler), and each data point is attached with equipment ID, physical unit, and range attribute information to form a structured data dictionary.

[0107] S2. Perform multi-timescale data fusion operations on the structured data dictionary to construct a smelting process dataset;

[0108] Multi-timescale data fusion operations include: second-level moving average filtering, hour-level cubic spline interpolation, and unified time-indexed dataset construction, such as... Figure 3 As shown;

[0109] The second-level data moving average filtering operation is performed as follows: A moving average filter is applied to the second-level data from high-frequency sensors (melt pool temperature, spray gun pressure, etc.) to suppress high-frequency noise interference and retain effective process characteristics. The expression is as follows:

[0110]

[0111] In the formula, This represents the output value after filtering. The window width is w=60, the step size=10, the window width of 60 seconds covers the melting reaction cycle, and the step size of 10 seconds balances the smoothness and real-time performance of the data, retaining effective process features while eliminating random noise. Indicates the current time point; The index representing the current time point, in seconds; This refers to the raw input data, which in this invention is second-level data from a high-frequency sensor;

[0112] The method for cubic spline interpolation of hourly data is as follows: Time alignment is performed on hourly process parameters using a cubic spline interpolation function. The cubic spline interpolation function satisfies the second derivative continuity condition, and its expression is as follows:

[0113]

[0114] In the formula, This represents the cubic spline interpolation function; Represents the original hourly timestamp; This represents the process parameter value corresponding to the timestamp, and after interpolation, outputs data with a time resolution in the second range. This represents the total number of hourly data points; j represents the index of the total number of hourly data points.

[0115] The unified time-indexed dataset construction method involves integrating multi-source data into a unified spatiotemporal benchmark to form a matrix-based dataset. Specifically, it uses second-level data timestamps as the benchmark and synchronizes and aligns the interpolated hour-level data to construct the smelting process dataset. Where n is the total number of time points and d is the multidimensional feature. In this embodiment, d=15, including: 6-dimensional second-level data, 5-dimensional hour-level process parameters, 2-dimensional hour-level test data and 2-dimensional derived features.

[0116] S3. Improved Particle Swarm Optimization (IPSO) algorithm, which takes the smelting process dataset as input to obtain the optimal set of hyperparameters for the diffusion model;

[0117] IPSO simultaneously optimizes model accuracy and computational efficiency, balancing detection performance with real-time requirements;

[0118] Process parameters such as raw material ratios and melting temperature are encoded as feature vectors and used as input dimensions for IPSO. IPSO optimizes the noise scheduling factor. At that time, the search range is automatically adjusted according to the current process parameters, and the anomaly detection results are used as the fitness function correction term of IPSO; when anomaly scores occur, IPSO prioritizes optimizing the noise scheduling factor. To enhance noise suppression capabilities, a hierarchical optimization architecture is adopted, with the upper layer optimizing the IPSO global noise scheduling factor. With DDPM core hyperparameter set Updated every 24 hours; Lower-level fine-tuning: Based on real-time process data, noise scheduling factors are adjusted using local particle swarm optimization. Hourly fine-tuning was performed to match the noise injection rate with the smelting stage, including the hyperparameter set. middle, Represents the initial noise scheduling coefficient. Indicates the noise attenuation coefficient. Indicates the noise scheduling factor;

[0119] like Figure 4 As shown, the improvement steps include:

[0120] S3.1, using the smelting process dataset As input, the positions and velocities of a preset number of particles are randomly initialized, and initial parameters and optimization objectives are set;

[0121] Initialize the preset number of particles to 50;

[0122] The initial parameters include: inertia weight, first learning factor, and second learning factor; the inertia weight is set to 0.9, the first learning factor is set to 2.5, and the second learning factor is set to 0.5.

[0123] The optimization objective is the set of hyperparameters for the diffusion model (DDPM);

[0124] S3.2 Initialize the particle swarm, generate the current iteration number, and perform nonlinear inertia weight adjustment to improve the convergence speed;

[0125] The method for performing nonlinear inertia weight adjustment is as follows: design an inertia weight update mechanism with quadratic function decay to balance the algorithm's global exploration and local development capabilities;

[0126] The expression for the nonlinear inertia weight adjustment operation is as follows:

[0127]

[0128] In the formula, This represents the initial inertia weight, which is set to 0.9 in this embodiment; This indicates the termination weight, which is set to 0.4 in this embodiment; This represents the maximum number of iterations, which is set to 200 in this embodiment. Indicates the current iteration step;

[0129] The quadratic decay curve maintains a high weight in the early stage of iteration, allowing particles to search a wide range and quickly locate candidate solution regions with high accuracy and low step count; in the later stage, it is rapidly reduced to 0.4 to finely adjust the hyperparameters and avoid premature convergence to a suboptimal solution; compared with the linear decay strategy, the convergence speed is improved.

[0130] S3.3 When a particle fails to update its optimal position within a preset number of iterations, a Cauchy-Gaussian hybrid mutation is used. By introducing a hybrid mutation perturbation mechanism, premature convergence of the particle swarm is avoided, and the historical optimal solution is obtained.

[0131] Cauchy mutations make long jumps in the solution space, avoiding getting trapped in local optima and improving global search efficiency;

[0132] Gaussian mutation is used to fine-tune the neighborhood of high-quality solutions, improving the accuracy of parameter optimization.

[0133] In this invention, when a particle fails to update its optimal position for K=5 consecutive iterations, with probability p m =0.2 performs a mutation operation, with the following expression:

[0134]

[0135] In the formula, Indicates the parameter value of the current particle; This represents the new parameter value after the mutation; Indicates the control Cauchy distribution The global disturbance intensity term, =0.1; Indicates a moderated Gaussian distribution Local fine-tuning items, =0.05;

[0136] The long-tailed nature of the Cauchy distribution helps to escape local optima, the fine-tuning ability of the Gaussian distribution improves convergence accuracy, and the Cauchy-Gaussian mixed mutation improves the search efficiency of the algorithm in the hyperparameter set of the diffusion model (DDPM).

[0137] S3.4. Using the current iteration number and the historical best solution of the particle swarm as input, perform an adaptive operation on the social learning factor to dynamically adjust the individual learning factor and the social learning factor, and optimize the particle swarm cooperation mode.

[0138] The expressions for dynamically adjusting individual learning factors and social learning factors are as follows:

[0139]

[0140]

[0141] In the formula, Represents an individual's learning factor; Represents social learning factors; let It decreases linearly from 2.5 to 0.5. It increases linearly from 0.5 to 2.5;

[0142] Social learning factor adaptive operation is highly effective in the early stages of iteration. Value reinforcement enhances individual experience learning and promotes extensive exploration of the parameter space; high efficiency in later iterations. The value emphasizes group knowledge sharing, which accelerates the convergence of the optimal solution.

[0143] S4. Based on the diffusion model and the obtained optimal hyperparameter set of the diffusion model, and using the smelting process dataset as input, perform tin smelting anomaly detection operation;

[0144] The procedure for performing anomaly detection in tin smelting is as follows:

[0145] like Figure 5 As shown, using the smelting process dataset as input, forward diffusion and reverse denoising operations are performed to obtain the predicted data;

[0146] The forward diffusion process design includes: defining a progressive noise injection mechanism with a preset total diffusion time step to gradually perturb the original data into a Gaussian distribution; whereby forward diffusion includes multi-step diffusion and single-step diffusion;

[0147] The expression for multi-step diffusion is as follows:

[0148]

[0149] In the formula, This represents the raw data, which in this invention is the smelting process dataset; Indicates the total diffusion time steps. The index representing the total diffusion time steps. It is sampled from a uniform distribution in the range [1, T]; Indicates the first Noisy data of the step; Indicates the first Noisy data of the step;

[0150] The expression for single-step diffusion is as follows:

[0151]

[0152] In the formula, This represents the transfer distribution of a single-step diffusion; This represents the mean value after noise injection; Represents the noise variance; where, The noise scheduling coefficient is dynamically generated using a cosine adjustment strategy, and its expression is as follows:

[0153]

[0154] In the formula, This represents the truncation function; Represents the noise scheduling factor. ∈[0.8, 1.2] is the scheduling factor for IPSO optimization, used to adjust the noise injection rate; This represents the loop variable in the summation formula, indicating that when calculating the normalized denominator, the loop iterates from step 1 to step 2. All diffusion steps in the total number of diffusion steps;

[0155] Cosine tuning avoids the boundary effect of increasing linear noise by slowly injecting noise in the early stage of diffusion and accelerating convergence to an isotropic Gaussian distribution in the final stage. The optimization enables noise scheduling to adapt to the characteristics of smelting data, reducing training error compared to a fixed scheduling strategy;

[0156] The reverse denoising process training includes: inputting noisy data into a pre-trained UNet network, learning the data distribution reconstruction, and using the DDIM algorithm to improve sampling efficiency. The loss function is designed as follows:

[0157]

[0158] In the formula, Represents random Gaussian noise. It is random noise; This represents the noise predicted by UNet; This represents the cumulative noise product factor. is the cumulative noise product factor, where Indicates the first The noise scheduling coefficient of the step is optimized by IPSO. Control, used to determine the noise injection rate;

[0159] In UNet training, the Cauchy-Gaussian mixture mutation mechanism of IPSO is introduced to perturb the gradient update direction and avoid the model from getting trapped in local optima. At the same time, IPSO is used to search for the optimal number of layers, convolutional kernel size and other structural parameters of UNet to improve the feature extraction capability of high-frequency sensor data.

[0160] In the inverse denoising process of DDPM, IPSO is used to generate the latent variable z. (m) The key feature dimensions that cause anomalies are located through particle swarm collaboration mechanism;

[0161] The expression for improving sampling efficiency using the DDIM algorithm is as follows:

[0162]

[0163] In the formula, express Single-step noise retention factor; express Single-step noise retention factor; The intensity of random disturbance is expressed by the following formula:

[0164]

[0165] In the formula, Denotes the coefficient of certainty. =0.5, balancing generation quality and speed, avoiding false alarms caused by excessive random perturbations;

[0166] DDIM improves speed by reducing the number of sampling steps, and uses IPSO to dynamically adjust the deterministic coefficients of DDIM. The number of sampling steps was reduced to minimize computation time while ensuring reconstruction accuracy. The particle swarm distribution of IPSO was combined with multi-chain sampling of DDIM, and GPU parallel computing was used to accelerate Monte Carlo evaluation. Accelerated sampling reduced the number of reverse generation steps to 100 steps and the time for a single sampling from 3.2 seconds to 0.8 seconds.

[0167] S5. Calculate the comprehensive anomaly score and feed it back to the improved particle swarm optimization algorithm (IPSO) through a dynamic threshold update mechanism. Re-optimize the hyperparameters every preset time period to form a closed-loop optimization system and complete the anomaly detection in tin smelting.

[0168] The comprehensive anomaly score calculation includes: reconstruction probability calculation and latent space KL divergence calculation;

[0169] The reconstruction probability is calculated using real-time process data and the latent variable z. (m) Using Monte Carlo sampling as input, the negative log-likelihood of the input samples is calculated to obtain the reconstruction error score;

[0170] The expression for calculating the reconstruction probability is as follows:

[0171]

[0172] In the formula, Indicates the reconstruction error score; In this embodiment, the number of Monte Carlo samplings is indicated. ; This represents the probability of generation by the diffusion model (DDPM); This represents the input sample, which in this invention is the smelting process dataset at the current moment; Indicate latent variables;

[0173] The latent space KL divergence is calculated as follows: the posterior distribution output by the UNet network is used as input, and the KL divergence calculation formula is used to calculate the KL divergence score.

[0174] The expression for calculating the KL divergence in the latent space is as follows:

[0175]

[0176] In the formula, This represents the posterior distribution after UNet encoding; This represents the standard Gaussian prior. ; Represents the trace of a matrix; This represents the covariance of the posterior distribution; This represents the mean of the posterior distribution; This represents a multidimensional feature, d=15;

[0177] The comprehensive anomaly score is calculated by weighting and fusing the reconstruction error score and the KL divergence score to generate the comprehensive anomaly score.

[0178] The expression for calculating the anomaly score is as follows:

[0179]

[0180] In the formula, The weighting coefficients are determined through ROC curve analysis on the validation set; IPSO can also be used for real-time optimization. This allows for dynamic adjustment based on process conditions. For example, during the high-temperature stage, KL divergence weights are increased to capture potential distribution shifts. Anomaly scores are calculated for second-level and hour-level data respectively. IPSO optimizes the fusion weights at each time scale to improve sensitivity to sudden and gradual anomalies.

[0181] Noise scheduling parameters optimized by IPSO The sensitivity of each feature to anomaly scoring during the forward diffusion process is analyzed to achieve a physical explanation of the anomaly source.

[0182] The dynamic threshold update mechanism works as follows: the alarm threshold is updated every 24 hours based on the latest data. When the comprehensive calculated anomaly score exceeds the threshold, it is determined to be an anomaly, and the anomaly detection result is fed back to IPSO in real time to re-optimize hyperparameters. In this invention, X is collected. new For 1000 normal samples covering one production cycle, the formula for calculating the statistic is as follows:

[0183]

[0184]

[0185] In the formula, This represents the mean of the abnormalities among normal samples. The standard deviation of abnormal scores in normal samples; This represents the number of normal samples; in this embodiment, N=1000. Index representing a normal sample; Indicates the first The comprehensive abnormality score of a normal sample;

[0186] The expression for the threshold is as follows:

[0187]

[0188] In the formula, This represents the threshold.

[0189] This invention improves the particle swarm optimization algorithm through three innovations: nonlinear inertial weighting, hybrid mutation, and adaptive learning factor. These innovations significantly increase the optimization speed of the diffusion model DDPM hyperparameters, raising the global optimal solution hit rate to 89.2%. Compared to traditional grid search methods, training time is shortened, and subjective biases from manual parameter tuning are avoided. The IPSO-optimized DDPM model reduces the modeling error for normal operating condition data distribution to 0.023 (MSE), an improvement of 18.3% compared to the standard DDPM model.

[0190] This invention's 24-hour periodic threshold update mechanism, combined with the 3σ criterion, effectively adapts to process fluctuations and equipment aging, achieving a false alarm rate of <0.5%, an 82% reduction compared to fixed threshold methods. DDIM accelerated sampling compresses the reverse generation steps to 100, reducing single sampling time from 3.2 seconds to 0.8 seconds, meeting the real-time requirements of online production line monitoring. The parallel computing architecture supports processing 12 data windows per second, achieving a throughput six times that of traditional LSTM models.

Claims

1. A method for detecting anomalies in tin smelting that integrates an improved optimization algorithm and a diffusion model, characterized in that, Includes the following steps: S1. Collect multi-source heterogeneous data during the tin smelting process, and perform data spatiotemporal reference calibration on the collected data to form a structured data dictionary; The multi-source heterogeneous data includes: second-level data and hour-level data; S2. Perform multi-timescale data fusion operations on the structured data dictionary to construct a smelting process dataset; S3. Improve the particle swarm optimization algorithm, using the smelting process dataset as input, to obtain the optimal set of hyperparameters for the diffusion model; The improvements include: introducing nonlinear inertia weight adjustment operations, introducing Cauchy-Gaussian mixed mutation, and introducing social learning factor adaptive operations into the particle swarm optimization algorithm; S4. Based on the diffusion model and the obtained optimal hyperparameter set of the diffusion model, and using the smelting process dataset as input, perform tin smelting anomaly detection operation; S5. Calculate the comprehensive anomaly score, and feed the comprehensive anomaly score back to the improved particle swarm optimization algorithm through a dynamic threshold update mechanism. Re-optimize the hyperparameters every preset time period to form a closed-loop optimization system and complete the anomaly detection in tin smelting. The comprehensive anomaly score includes: reconstruction probability calculation and latent space KL divergence calculation; The threshold includes the mean of the average abnormality of normal samples and the standard deviation of the abnormality score of normal samples; The method of feeding back the comprehensive anomaly score to the improved particle swarm optimization algorithm through the dynamic threshold update mechanism and re-optimizing the hyperparameters at preset time intervals is as follows: when the comprehensive anomaly score is greater than the threshold, the improved particle swarm optimization algorithm is used to re-optimize the hyperparameters.

2. The method for detecting anomalies in tin smelting by integrating the improved optimization algorithm and the diffusion model according to claim 1, characterized in that, The process of performing multi-time-scale data fusion operations on the structured data dictionary to construct a smelting process dataset includes: second-level data moving average filtering, hour-level data cubic spline interpolation, and unified time index dataset construction.

3. The tin smelting anomaly detection method based on the fusion of improved optimization algorithm and diffusion model according to claim 2, characterized in that, The second-level data moving average filtering operation is performed as follows: a moving average filter is applied to the second-level data of the high-frequency sensor to suppress high-frequency noise interference and retain effective process characteristics; The method of the hourly data cubic spline interpolation operation is as follows: the hourly process parameters are time-aligned using a cubic spline interpolation function, and the cubic spline interpolation function satisfies the condition of second derivative continuity. The unified time index dataset is constructed by using second-level data timestamps as a benchmark, synchronizing and aligning the interpolated hour-level data, and constructing a smelting process dataset.

4. The method for detecting anomalies in tin smelting by integrating the improved optimization algorithm and the diffusion model according to claim 1, characterized in that, The improved particle swarm optimization algorithm, using a smelting process dataset as input, includes the following steps to obtain the optimal set of hyperparameters for the diffusion model: S3.

1. Using the smelting process dataset as input, randomly initialize the position and velocity of a preset number of particles, and set the initial parameters and optimization objectives; S3.2 Initialize the particle swarm, generate the current iteration number, and perform nonlinear inertia weight adjustment to improve the convergence speed; The method for performing nonlinear inertia weight adjustment is as follows: design an inertia weight update mechanism with quadratic function decay to balance the algorithm's global exploration and local development capabilities; S3.3 When a particle fails to update its optimal position within a preset number of iterations, a Cauchy-Gaussian hybrid mutation is used. By introducing a hybrid mutation perturbation mechanism, premature convergence of the particle swarm is avoided, and the historical optimal solution is obtained. S3.

4. Using the current iteration number and the historical best solution of the particle swarm as input, perform an adaptive operation on the social learning factor to dynamically adjust the individual learning factor and the social learning factor, thereby optimizing the particle swarm collaboration mode.

5. The method for detecting anomalies in tin smelting by integrating the improved optimization algorithm and the diffusion model according to claim 1, characterized in that, The method for performing tin smelting anomaly detection operation based on the diffusion model and the obtained optimal hyperparameter set of the diffusion model, using the smelting process dataset as input, is as follows: using the smelting process dataset as input, performing forward diffusion and reverse denoising operations to obtain predicted data, wherein the DDIM algorithm is introduced in the reverse denoising operation to improve sampling efficiency.

6. The method for detecting anomalies in tin smelting by integrating the improved optimization algorithm and the diffusion model according to claim 1, characterized in that, The calculation of the comprehensive anomaly score involves feeding the comprehensive anomaly score back to the improved particle swarm optimization algorithm through a dynamic threshold update mechanism. The hyperparameters are re-optimized every preset time period to form a closed-loop optimization system, thus completing the anomaly detection in tin smelting. The reconstruction probability is calculated by using real-time process data and latent variables as input, and calculating the negative log-likelihood of the input samples through Monte Carlo sampling to obtain the reconstruction error score. The latent space KL divergence is calculated by using the posterior distribution output by the UNet network as input and calculating it using the KL divergence calculation formula to obtain the KL divergence score.

7. The method for detecting anomalies in tin smelting by integrating the improved optimization algorithm and the diffusion model according to claim 1 or 6, characterized in that, The expression for calculating the comprehensive anomaly score is as follows: In the formula, These are the weighting coefficients; The expression for the threshold is as follows: In the formula, Indicates the threshold. This represents the mean of the abnormalities among normal samples. This represents the standard deviation of the abnormality score in a normal sample.

Citation Information

Patent Citations

  • Multi-process flow process parameter fusion optimization method based on improved particle swarm optimization algorithm

    CN117420803A

  • Model training and water detection method and system based on multivariate data diffusion

    CN118035926A

  • DE-MK-MSVR-based tin smelting process multi-class energy consumption prediction method

    CN118917463A

  • Soil pollution diffusion prediction method based on differential evolution

    CN120124793A

  • Systems, methods, devices, and platforms for industrial internet of things

    WO2024155584A1