A collaborative denitrification process status diagnosis method based on image recognition

By extracting features from macroscopic and microscopic video streams in a synergistic denitrification process, and utilizing an improved pelican optimization algorithm and an adaptive morphological filtering model, combined with a deep learning network, early warning of microbial phenotypes was achieved. This solved the problems of hysteresis and sensor failure in existing technologies, and improved the early warning capabilities for sludge disintegration and load shocks.

CN122416031APending Publication Date: 2026-07-17WUXI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUXI UNIV
Filing Date
2026-05-15
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing technologies in synergistic denitrification processes suffer from severe lag, sensor failure, and lack of phenotypic information, resulting in the inability to provide timely warnings when microbial metabolism is abnormal, and irreversible sludge disintegration or microbial poisoning.

Method used

By extracting macroscopic and microscopic video streams from the synergistic denitrification reactor, and utilizing an improved pelican optimization algorithm and an adaptive morphological filtering model, features of multidimensional discrete time series signals are extracted. Combined with a bidirectional long short-term memory network and a cross-attention mechanism, early warning of microbial phenotypes is achieved.

Benefits of technology

It has achieved a leap from lagging water quality monitoring to early biological phenotypic warning, and can capture the step characteristics of microbial phenotypic changes before indicators such as dissolved oxygen and pH deteriorate. This improves the early warning capability of sludge disintegration and load shocks, and enhances the system's shock resistance robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122416031A_ABST
    Figure CN122416031A_ABST
Patent Text Reader

Abstract

This invention discloses a method for diagnosing the state of a synergistic denitrification process based on image recognition, belonging to the field of visual inspection technology. This invention acquires macroscopic video, microscopic video, and real-time sensor signals from the reactor; utilizes an improved pelican optimization algorithm to find the extreme value of the two-dimensional maximum information entropy, obtains the optimal segmentation threshold, and combines adaptive morphological filtering to extract pure foam and sludge particle targets; calculates the macroscopic surface evolution matrix, microscopic color and geometric complexity matrix, and divides them by the global biological phenotypic baseline features to obtain the relative drift ratio; orthogonally concatenates the multimodal features and inputs them into a denitrification process state mapping model, uses a bidirectional long short-term memory network to extract temporal features, calculates adaptive dynamic weights through the nonlinear dot product of the cross-attention mechanism, outputs the probability distribution of the process instability evolution state, and generates a control message; this invention overcomes the shortcomings of traditional sensors such as hysteresis and easy failure, and achieves highly robust early warning of synergistic denitrification processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of visual inspection technology, and more specifically, it relates to a method for diagnosing the state of a collaborative denitrification process based on image recognition. Background Technology

[0002] In the field of modern wastewater treatment, synergistic denitrification processes (such as the short-cut nitrification-anaerobic ammonia oxidation process PN / A and the simultaneous nitrification-denitrification process SND) have become core technologies for the industry's low-carbon development due to their advantages such as high denitrification efficiency, no need for external carbon sources, and low aeration energy consumption. However, the synergistic denitrification system involves complex competition and synergy among various functional microorganisms (such as ammonia-oxidizing bacteria, nitrite-oxidizing bacteria, and anaerobic ammonia-oxidizing bacteria), making its ecological niche extremely fragile.

[0003] Currently, for monitoring the operational status of synergistic denitrification reactors, the industry commonly employs online water quality sensors (such as dissolved oxygen (DO) probes, pH meters, oxidation-reduction potential (ORP) probes, and ammonia nitrogen sensors) to collect one-dimensional time-series data, and combines this with programmable logic controllers (PLCs) to set upper and lower thresholds for feedback control. In recent years, some research has begun to introduce data-driven machine learning algorithms (such as support vector machines, random forests, or basic neural networks) to mine historical one-dimensional time-series data collected by sensors, aiming to predict effluent quality or classify abnormal states. These existing technologies are all based on a technical framework of "chemical sensor perception - threshold or single-modal algorithm judgment - equipment response," which is essentially a passive measurement and mathematical fitting of changes in the physicochemical indicators of water bodies.

[0004] This reveals the following problems with existing technologies: 1. Significant lag: Deterioration of water quality indicators is usually the final result of abnormal microbial metabolism. By the time the sensor alarms, sludge disintegration or bacterial poisoning is often irreversible; 2. Probes are prone to failure: In complex wastewater, probes are easily encapsulated by biofilms or scale, leading to data drift; 3. Lack of phenotypic information: One-dimensional sensor data cannot intuitively reflect early warning signals that best characterize microbial activity, such as sludge morphology, color, and foam texture. Summary of the Invention

[0005] (a) Technical problems to be solved To address the problems in related technologies, this invention provides a method for synergistic denitrification process status diagnosis based on image recognition, thereby overcoming the aforementioned technical problems existing in the prior art.

[0006] (II) Technical Solution To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution: A collaborative denitrification process status diagnosis method based on image recognition S1. Extract the macroscopic video stream from the surface of the synergistic denitrification reactor, the microscopic video stream from the mixed liquor, and the real-time water quality sensor signal to obtain a multidimensional discrete time series signal. S2. Using the two-dimensional maximum information entropy feature of the image frame in the multidimensional discrete time series signal as the optimization target of the fitness function, the optimal threshold space matrix for adaptive image segmentation is obtained by using the improved pelican optimization algorithm. S3. Based on the optimal threshold space matrix, construct an adaptive morphological filtering model; input macroscopic and microscopic image frames into the adaptive morphological filtering model, and output the macroscopic foam target region and the microscopic sludge particle target region; S4. Extract the intrinsic texture features of the macroscopic foam target region and convert them into a surface evolution feature matrix; extract the coordinate sequence of all microscopic sludge particle target regions and calculate the color space distribution and geometric complexity feature matrix. Calculate the global biological phenotypic baseline features of the multidimensional discrete time series signal; based on the global biological phenotypic baseline features, calculate the features of each target region and the relative drift ratio features of the water quality sensing signal; S5. Input the surface evolution feature matrix, color space distribution and geometric complexity feature matrix and relative drift ratio feature into the denitrification process state mapping model to obtain the conditional probability distribution sequence and determine the unstable evolution state of the synergistic denitrification process. Preferably, step S1 includes the following steps: S11. When the absolute value of the real-time first derivative of the dissolved oxygen or pH sensor is detected to be greater than the set derivative over-limit threshold, the synchronous sampling is interrupted; the historical background sequence and the working condition evolution sequence are extracted based on the trigger time and spliced ​​together to generate the original multidimensional discrete time series. S12. Extract the global mean and global standard deviation features of the water quality sensing signal from the original multidimensional discrete time series; using the Z-score normalization equation, subtract the global mean feature from each discrete data point in the original water quality sensing signal and divide by the global standard deviation feature to obtain a one-dimensional discrete time sensing sequence that follows a standard normal distribution. Preferably, step S2 includes the following steps: S21. Define the population state space of the improved pelican optimization algorithm; define the position coordinates of the two-dimensional optimization particle as the global brightness threshold feature and local contrast threshold feature of image segmentation; S22. Establish a fitness function based on the two-dimensional maximum information entropy feature; for any set of position coordinates, perform trial segmentation on the macroscopic and microscopic image frames in the multidimensional discrete time series signal generated in S1 to obtain a trial binary mask; The two-dimensional histogram distribution probability of the target region and the background region is calculated based on the tentative binarized mask; the two-dimensional histogram distribution probability is transformed into a normalized probability distribution sequence, and the spatial information entropy of the target and the background is calculated using the Shannon information entropy formula, and the sum of the two is defined as the two-dimensional maximum information entropy feature. S23. Based on the fitness function, with the goal of maximizing the two-dimensional maximum information entropy feature as the global optimization objective, update the population state space within the set maximum number of iterations; when the maximum number of iterations is reached, the iteration terminates, and the coordinates of the position with the largest global fitness value are output as the optimal threshold space matrix. Preferably, updating the population state space in S23 specifically includes the following steps: S231. In the prey-approaching stage of the algorithm, a nonlinear dynamic inertia weight factor is introduced; the nonlinear dynamic inertia weight factor is defined as a mathematical function that decays cosine with the number of iterations, and the nonlinear dynamic inertia weight factor is multiplied by the position coordinates of the previous generation of pelicans. S232. During the water flight phase of the algorithm, extract the location coordinates of the pelican with the best fitness value in the current population; substitute the optimal pelican location coordinates into the Cauchy mutation operator equation; and use the Cauchy distribution function to generate large-step mutated location coordinates around the original optimal location. S233. If the fitness value of the mutated position coordinates is greater than the fitness value of the original optimal position, then the mutated position coordinates shall be used to replace the original optimal position coordinates. Preferably, step S3 includes the following steps: S31. Using the optimal brightness threshold feature in the optimal threshold space matrix as the binarization segmentation benchmark and the optimal contrast threshold feature as the edge gradient constraint operator, construct an adaptive morphological filtering model for the macroscopic and microscopic image frames. S32. Input the macroscopic and microscopic image frames in the multidimensional discrete time series signal generated in S1 into the adaptive morphological filtering model; in the pixel space, use morphological opening operation to eliminate isolated noise points below the optimal brightness threshold feature, and use morphological closing operation to fill the small holes inside the target to obtain the filtered binarized image. S33. Perform a connected component labeling algorithm on the filtered binarized image to extract all connected components and boundary pixel coordinates; calculate the pixel gradient of all connected component boundaries; when the relative change rate of the boundary pixel gradient between two adjacent iterations is less than the preset convergence tolerance feature, stop the iteration and output the macroscopic foam target region and the microscopic sludge particle target region with clear boundaries and arranged in descending order of area. Preferably, step S4 includes the following steps: S41. Extract the macroscopic foam target region output by S33, and use the gray-level co-occurrence matrix operator to extract the contrast, correlation, energy and homogeneity in four spatial directions, and transform them into a surface evolution feature matrix. S42. Extract the pixel coordinate sequence of all microscopic sludge particle target areas output by S33, and reconstruct the RGB color space into an HSV color space matrix. S43. Extract the pixel value sequence of the hue channel in the HSV color space matrix, count the discrete probability distribution characteristics of the number of pixels in the anaerobic ammonia oxidation characteristic hue interval relative to the total number of pixels in the particles, generate the redness index of independent particles, and obtain the color space distribution feature matrix. S44. Calculate the perimeter and area of ​​the target region of each microscopic sludge particle output by S33 respectively; multiply the area by a constant and divide by the square of the perimeter feature to calculate the morphological factor feature of each particle and obtain the geometric complexity feature matrix. S45. Statistical analysis of microscopic images of the synergistic denitrification reactor during a continuous set number of days and when the total nitrogen in the effluent meets the standard, calculation of the average redness index and average morphology factor of all sludge particles, and obtaining the global biological phenotypic baseline characteristics. S46. Divide the redness index generated in S43 and the morphological factor feature generated in S44 by the average redness index and average morphological factor in the global biological phenotypic benchmark features extracted in S45, respectively, to calculate the dimensionless relative drift ratio feature; the relative drift ratio feature includes the relative drift rate of the redness index and the relative drift rate of the morphological factor. Preferably, step S41 includes the following steps: S411. Based on the gray-scale spatial distribution characteristics of the macroscopic foam target area output by S33, extract the joint probability distribution of pixel pairs in the image in four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees, and construct the gray-scale co-occurrence matrix. S412. Extract the joint probability features of the gray-level co-occurrence matrix in three consecutive spatial dimensions: the current pixel pair, the previous pixel pair, and the next pixel pair. S413. Substitute the three consecutive spatial joint probability features into the contrast and homogeneity calculation equation; calculate the sum of the products of the squared differences of the current matrix elements and the probability values, and extract the transient viscosity change features of macroscopic bubbles. S414. Perform statistical operations on the continuous sequence containing the transient viscosity mutation feature, extract its global mean feature and texture variance feature, and construct a one-dimensional surface evolution feature matrix. Preferably, step S5 includes the following steps: S51. The surface evolution feature matrix, color space distribution and geometric complexity feature matrix and relative drift ratio feature are used as feedforward inputs to the denitrification process state mapping model, and the temporal fusion hidden state matrix is ​​extracted using a bidirectional long short-term memory network. S52. Calculate the original correlation score between the image modal hidden state and the sensor modal hidden state at each time step using the nonlinear dot product scoring function of the cross-attention mechanism; substitute the original correlation score into the Softmax normalization equation to transform it into an adaptive dynamic weight allocation matrix. S53. Multiply the weight coefficients in the adaptive dynamic weight allocation matrix output by S52 with the temporal fusion hidden state matrix extracted by S51 element by element and sum them to output a weighted context feature vector focusing on the mutation interval of biological phenotype and sensor data. S54. Input the weighted context feature vector into the fully connected classification layer, and use the weight matrix and bias to perform a linear mapping to a logical output tensor with a dimension equal to the total number of state categories. S55. Substitute the logic output tensor into the Softmax function to calculate the conditional probability distribution sequence of the process operation within the time window belonging to each label category; extract the state category label corresponding to the feature with the maximum probability value, and generate a control message with timestamp features to be sent to the control node. Preferably, step S51 includes the following steps: S511. Expand the surface evolution feature matrix, color space distribution and geometric complexity feature matrix, and relative drift ratio feature into an input sequence vector by time step; S512. During the forward propagation of the network, the input sequence vector at the current time step is linearly mapped to the forward hidden state features at the previous time step, and activation function operations are performed to calculate the forgetting gating feature and the input gating feature i. t The forgetting gate feature and the input gate feature are used to filter historical cell states and update the current cell state, and output the positive hidden state feature of the current time step. S513. During the backpropagation of the network, the input sequence vector of the current time step and the back hidden state feature of the next time step are subjected to the same gating mathematical operation steps as in S512, and the back hidden state feature of the current time step is output. S514. The positive hidden state features and the negative hidden state features at the same time step are concatenated bit by bit to generate a temporal fusion hidden state matrix containing global temporal context information. Preferably, step S52 includes the following steps: S521. Extract the hidden state vectors belonging to the image modality from the temporal fusion hidden state matrix output by S51, and multiply them by the pre-trained query weight matrix to construct the query matrix; extract the hidden state vectors belonging to the sensing modality, and multiply them by the pre-trained key weight matrix and value weight matrix respectively to construct the key matrix and value matrix. S522. Extract the feature dimension scaling factor obtained by updating through backpropagation algorithm during the offline training phase of the network; perform a dot product operation on the transpose of the query matrix and the key matrix, and divide it by the square root of the feature dimension scaling factor to calculate the nonlinear mapping feature representing the cross-correlation strength between modalities. S523. Substitute the nonlinear mapping feature as the original association score into the Softmax normalization equation; calculate the ratio of the natural index value of the nonlinear mapping feature at the current time step to the sum of the natural index values ​​at all time steps, and output an adaptive dynamic weight allocation matrix with a sum of 1.

[0007] (III) Beneficial Effects The present invention has the following beneficial effects: This invention achieves a leap from delayed water quality monitoring to early biological phenotypic warning. By introducing dual-scale image and video streams of macroscopic foam and microscopic microscopy, it can keenly capture microbial phenotypic step features such as fading of red color in anaerobic ammonia-oxidizing bacteria, dispersion of particle edges, and thickening of macroscopic foam before conventional chemical water quality indicators such as dissolved oxygen and pH show significant deterioration. Combined with the temporal prediction capabilities of bidirectional long short-term memory networks, this method can output early warnings of sludge disintegration or load shocks, gaining a golden window for process control.

[0008] This invention constructs an objective and adaptive feature decoupling and relative benchmark calibration mechanism to eliminate systematic errors. It abandons the blind reliance on manual experience to set thresholds in traditional image processing, introducing an improved pelican optimization algorithm and two-dimensional maximum information entropy to achieve objective and adaptive segmentation under complex lighting conditions. Simultaneously, it utilizes global biological phenotypic benchmark features under historical steady-state conditions as the denominator, transforming absolute extracted values ​​into relative drift proportions. This mathematical closed loop fundamentally eliminates the absolute dimensional interference caused by different reactor sizes, probe scaling and drift, and microscope light source attenuation, improving the algorithm's generalization ability across different wastewater treatment plants.

[0009] This invention achieves highly robust dynamic fusion of multimodal data based on a cross-attention mechanism. Addressing the issue of misjudgment in traditional algorithms when sensor probes fail due to contamination, this invention uses the dot product of the query matrix and the key matrix to mathematically quantify the intrinsic correlation between image and sensing modes. When sensor data becomes deadlocked or experiences abnormal drift, the Softmax normalization equation automatically strips the failed modes of their assigned weights, forcing the model to adaptively focus on high-confidence image phenotypic features. This nonlinear dynamic weighting mechanism avoids the logical loopholes of subjectively setting fixed weights, ensuring the accuracy of diagnostic decisions under harsh conditions.

[0010] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0011] To more clearly illustrate the technical solutions of the embodiments of the invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, the drawings can be obtained from these drawings without creative effort.

[0012] Figure 1 This is a schematic flowchart of a collaborative denitrification process status diagnosis method based on image recognition according to the present invention. Detailed Implementation

[0013] The technical solutions of the embodiments of the invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the invention, and not all embodiments. Based on the embodiments of the invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the invention.

[0014] To address the technical problems raised in the background section, please refer to [link / reference]. Figure 1 This invention provides a method for synergistic denitrification process status diagnosis based on image recognition, comprising: S1. Extract the macroscopic video stream from the surface of the synergistic denitrification reactor, the microscopic video stream from the mixed liquor, and the real-time water quality sensor signal to obtain a multidimensional discrete time series signal. S2. Using the two-dimensional maximum information entropy feature of the image frame in the multidimensional discrete time series signal as the optimization target of the fitness function, the optimal threshold space matrix for adaptive image segmentation is obtained by using the improved pelican optimization algorithm. S3. Based on the optimal threshold space matrix, construct an adaptive morphological filtering model for the macroscopic and microscopic image frames; input the macroscopic and microscopic image frames into the adaptive morphological filtering model for pixel-level binarization stripping, and output macroscopic foam target regions and microscopic sludge particle target regions with clear connected domain boundaries; S4. Extract the texture intrinsic features of the macroscopic foam target region using the gray-level co-occurrence matrix operator and convert them into a surface evolution feature matrix; extract the coordinate sequence of all microscopic sludge particle target regions and calculate their color space distribution and geometric complexity feature matrix. Calculate the global biological phenotypic baseline features of the multidimensional discrete time series signal within the historical steady-state operating cycle; use the global biological phenotypic baseline features as the denominator to calculate the features of each target area and the relative drift ratio features of the water quality sensing signal; S5. Input the surface evolution feature matrix, color space distribution and geometric complexity feature matrix, and relative drift ratio feature into the denitrification process state mapping model, and use a bidirectional long short-term memory network to extract the temporal fusion hidden state matrix; use the nonlinear dot product scoring function of the cross-attention mechanism to calculate the original association score of the image mode and the sensing mode at each time step, and use the Softmax normalized exponential function to transform the original association score into an adaptive dynamic weight allocation matrix. Based on the weighted summation characteristics of the adaptive dynamic weight allocation matrix and the temporal fusion hidden state matrix, a conditional probability distribution sequence is obtained to determine the unstable evolution state of the synergistic denitrification process. The above embodiments, by constructing a multimodal data chain encompassing macroscopic foam texture, microscopic sludge morphology, and real-time sensor data, break through the limitations of traditional wastewater treatment relying solely on one-dimensional chemical sensors. Utilizing an improved pelican optimization algorithm and two-dimensional maximum information entropy, objective and adaptive segmentation of biological phenotypes under complex lighting conditions is achieved. By introducing historical steady-state global benchmark features, absolute extracted values ​​are transformed into relative drift proportions, eliminating systematic errors caused by different reactor physical specifications and light source attenuation. Based on a bidirectional long short-term memory network and a cross-attention mechanism, the model can adaptively quantify the intrinsic correlation between image phenotypic mutations and water quality fluctuations. This method shifts process diagnosis from "lagging alarms after water quality deterioration" to "early warnings when microscopic changes occur in microbial phenotypes," improving the shock resistance robustness of the synergistic denitrification system. The above embodiment S1 includes the following steps: S11. When the absolute value of the real-time first derivative of the dissolved oxygen or pH sensor is detected to be greater than the set derivative over-limit threshold, the synchronous sampling is interrupted; the historical background sequence and the working condition evolution sequence are extracted based on the trigger time and spliced ​​together to generate the original multidimensional discrete time series. In specific implementation, the above embodiment S11 specifically involves: installing an anti-fogging high-definition camera on the liquid surface of the synergistic denitrification reactor, installing a flow-through microscopic imager on the bypass return pipeline, and deploying chemical sensors such as DO and pH within the tank; setting a threshold D for the derivative of DO to exceed the limit. thdo The derivative threshold D with respect to pH thph The system continuously collected sensor data for 7 days during the initial operation phase, under conditions of no abnormal load shocks and stable effluent total nitrogen (TN) levels meeting standards, and calculated the standard deviation σ of its steady-state first derivative. der Based on the 3σ statistical criterion, let D be... thdo =3σ derdo D thph =3σ derph To filter out aeration fluctuations from conventional blowers; where σ derdo σ derph These are the standard deviations of the steady-state first derivatives of DO and pH, respectively. When the first derivative of the real-time sampled signal |d(DO) / dt|>D thdo At this time, the microcontroller triggers a hardware interrupt, marking the current time as the trigger origin t0; the controller extracts data from the circular buffer in memory for a duration of T1 (set to 30 minutes) before time t0, and simultaneously samples data for a duration of T2 (set to 30 minutes) consecutively, splicing them together to generate an original multidimensional discrete time sequence A=[a1,a2,...,a] with a total length of N. i ,...,a N ]; where a i represents the data vector synchronously captured at the i-th discrete sampling time. This vector contains a macroscopic surface RGB image matrix of the current time, a microscopic RGB image matrix of the current time, and a one-dimensional water quality feature array composed of DO and pH values; N represents the total length of the captured time series. Furthermore, to overcome the motion blur problem in microscopic imaging caused by the flow of high-concentration mixed liquids, the flow-through microscopy imager is equipped with a microfluidic ultra-shallow depth-of-field flow cell (the flow layer thickness is set to 0.1mm-0.2mm) and a strobe LED cold light source hard-wired to the camera shutter; within the microsecond-level window of camera exposure, the strobe light source emits high-intensity pulse light, and uses the optical freeze effect to obtain clear instantaneous images of moving particles; Furthermore, to address the time misalignment issue caused by inconsistent sampling frequencies of the macroscopic camera, microscopic imager, and chemical sensor, a timestamp alignment step is performed before stitching together the original multidimensional discrete time series A: using the sampling timestamp sequence of the chemical sensor as the absolute time reference, the relative timestamps of macroscopic and microscopic image frames are extracted; using the nearest neighbor interpolation algorithm, the image frame with the timestamp closest to the reference time point is forcibly bound to the sensor data at that moment; if there are no valid image frames within a set time tolerance before and after a certain reference time point, linear interpolation is performed using the feature vectors of the two adjacent frames, thereby ensuring the absolute time alignment of the multimodal data across N discrete time steps. S12. Extract the global mean and global standard deviation features of the water quality sensing signal from the original multidimensional discrete time series; using the Z-score normalization equation, subtract the global mean feature from each discrete data point in the original water quality sensing signal and divide by the global standard deviation feature to obtain a one-dimensional discrete time sensing sequence that follows a standard normal distribution. In specific implementation, the above embodiment S12 specifically involves: calculating the global mean feature μ and the global standard deviation feature σ of the sensing sequence A; and using the Z-score normalization equation: a 1 i =(a i -μ) / σ;This step physically eliminates baseline drift interference caused by minor scaling on the probe; The above embodiment S1 sets an over-limit threshold based on the standard deviation of the first derivative of the historical steady state, and uses a mathematical statistical algorithm to replace the fixed dead zone set manually based on experience, thus avoiding false triggering caused by the fluctuation of conventional aeration. At the same time, it uses the Z-score normalization equation to perform zero mean and variance normalization processing on the real-time sensor signal, and physically removes the interference of data baseline drift caused by slight scaling of the probe, providing a dimensionless pure data source for the subsequent orthogonal splicing of multimodal features. The above embodiment S2 includes the following steps: S21. Define the population state space of the improved pelican optimization algorithm; define the position coordinates of the two-dimensional optimization particle as the global brightness threshold feature and local contrast threshold feature of image segmentation; In specific implementation, the above embodiment S21 specifically involves: constructing a two-dimensional search space, and setting the position matrix of the i-th pelican as P. i =[Tlum i ,Tcon i The population size is set to M, and the maximum number of iterations is Iter. max Among them, Tlum i Tcon represents the global brightness threshold feature represented by the i-th pelican in the current iteration, with a value range of [0, 255], used to distinguish the overall brightness and darkness of the image background;i This represents the local contrast threshold feature, with a value range of [0,1], and is used to constrain the degree of gray-level gradient jump at the target edge; Furthermore, to address the problem that the traditional pelican optimization algorithm is prone to getting trapped in local optima when processing reflective images of sewage surfaces, this invention makes the following improvements: a dynamic inertia weight factor that decays nonlinearly with the number of iterations is introduced in the prey approach stage; and a mutation operator based on the Cauchy distribution function is introduced in the water surface flight stage, using its long-tail effect to force the algorithm to escape local extremum traps. S22. Establish a fitness function based on the two-dimensional maximum information entropy feature; for any set of position coordinates [Tlum, Tcon], perform trial segmentation on the macroscopic and microscopic image frames in the multidimensional discrete time series signal generated in S1 to obtain a trial binary mask; The two-dimensional histogram distribution probability of the target region and the background region is calculated based on the tentative binarized mask; the two-dimensional histogram distribution probability is transformed into a normalized probability distribution sequence, and the spatial information entropy of the target and the background is calculated using the Shannon information entropy formula, and the sum of the two is defined as the two-dimensional maximum information entropy feature. In specific implementation, the above embodiment S22 specifically involves: using the current parameters to compare the image gray level g(x,y) with the neighborhood average gray level g avg The region is divided into two-dimensional histograms (x, y); let the joint probability density functions of the target region (Object) and the background region (Background) be PO(i,j) and PB(i,j), respectively. The formula for calculating the information entropy of the target region is: The formula for calculating the information entropy of the background region is: Extract the sum of the two as the global fitness value F for the current parameter combination. fi =HO+HB, where a larger value indicates that the information of the target and background is preserved most completely under this segmentation parameter; where HO represents the two-dimensional information entropy of the target region (sludge particles or foam); HB represents the two-dimensional information entropy of the background region (abiotic region); PO(i,j) represents the joint probability density of the target region at gray level i and the average gray level j of its neighborhood; PB(i,j) represents the joint probability density of the background region; PO total PB represents the total probability sum of the target region (normalized denominator); total This represents the total probability of the background region; S23. Based on the fitness function, with maximizing the two-dimensional maximum information entropy feature as the global optimization objective, update the population state space within a set maximum number of iterations; when the maximum number of iterations is reached, the iteration terminates, and the coordinates of the position with the largest global fitness value are output as the optimal threshold space matrix [Tlum]. opt ,Tcon opt ]; The above embodiment S2 abandons the blindness of the traditional Otsu method or the manual experience of setting a fixed threshold, and transforms image segmentation into a mathematical optimization problem in a high-dimensional space; by establishing an objective fitness function based on two-dimensional maximum information entropy, and combining the nonlinear optimization capability of the improved pelican optimization algorithm, the model can adaptively resist environmental interference such as water surface foam reflection and microscope light source aging, ensuring that the extracted binarized mask retains the true topological boundary of sludge particles and macroscopic foam to the maximum extent; The above embodiment S231 is specifically as follows: The update of the population state space in embodiment S23 above specifically includes the following steps: S231. In the prey approximation stage of the algorithm, a nonlinear dynamic inertia weight factor w is introduced; the nonlinear dynamic inertia weight factor w is defined as a mathematical function that decays cosinely with the number of iterations. , where w max With w min The upper and lower limits of the weights are set, and t is the current iteration number; and the nonlinear dynamic inertia weight factor is multiplied by the position coordinates of the previous generation of pelican, so that the algorithm has a strong global search capability in the early stage and a fine local development capability in the later stage, so as to balance the global search and local development capabilities. Furthermore, w max With w min The mean grayscale variance of the image is calculated using the historical background images collected before the system was put into operation: The global grayscale variance of the image is defined as Var. g The theoretical maximum variance is Var max ; , Among them, w maxer w miner λ represents the initial values ​​of the upper and lower bounds of the baseline, respectively, taken from the classical empirical upper bound of the inertia weight in the traditional pelican optimization algorithm, used to maintain strong global search capability in the early stages of the algorithm (or in low-noise environments); er Sensitivity coefficient representing the variance of image gray levels; S232. During the water-based flight phase of the algorithm, extract the location coordinates P of the pelican with the best fitness value in the current population. best The optimal pelican position coordinates P best Substituting into the Cauchy mutation operator equation Where Cauchy(0,1) is the standard Cauchy distribution function; utilizing the long tails at both ends of the Cauchy distribution function, large-step variation position coordinates P are generated around the original optimal position. new ; S233, Calculate the coordinates P of the variation location. new The two-dimensional maximum information entropy feature F fi (Pnew If F fi (P new The fitness value F is greater than the original optimal position. fi (P best Then, using the aforementioned variable position coordinates P new Replace the original optimal position coordinates P best This is to avoid the image optimization process getting stuck in a local optimum caused by uneven local illumination; The above embodiments S231-S233 address the challenge of image optimization in complex wastewater treatment environments by introducing nonlinear dynamic inertial weights and a Cauchy mutation mechanism. The dynamic inertial weights enable the algorithm to traverse smooth noise regions with large steps in the early stages and approach the true threshold with small steps in the later stages. The long-tail characteristic of the Cauchy mutation operator allows the algorithm to trigger large leaps with mathematical probability when it gets stuck in a pseudo-information entropy extreme point caused by local uneven illumination (such as local reflection on the liquid surface). This mechanism avoids undersegmentation or oversegmentation of the image from the underlying algorithm logic, improving the global convergence accuracy of threshold optimization. The above embodiment S3 includes the following steps: S31, using the optimal brightness threshold feature Tlum in the optimal threshold space matrix. opt Using the optimal contrast threshold feature Tcon as the binarization segmentation benchmark opt As an edge gradient constraint operator, an adaptive morphological filtering model is constructed for the macroscopic and microscopic image frames; In specific implementation, the above embodiment S31 specifically involves: introducing a structuring element B(x,y) and an optimal threshold, and performing morphological opening operations (erosion followed by dilation to eliminate isolated small impurities) and closing operations (dilation followed by erosion to fill the voids inside the particles) on the original image f(x,y). Furthermore, the constructed adaptive morphological filtering model is a cascaded image processing pipeline containing parameter adaptive layers, and its internal structure sequentially includes: the first layer is based on the optimal brightness threshold feature Tlum. opt The first layer is a global binarization mapping layer; the second layer is based on the optimal contrast threshold feature Tcon. opt The Sobel edge gradient constraint layer is used to remove gradients smaller than Tcon. opt The pseudo-boundary pixels; the third and fourth layers are the morphological opening and closing operation layers that call the dynamic structuring element B(x,y), respectively; S32. Input the macroscopic and microscopic image frames in the multidimensional discrete time series signal generated in S1 into the adaptive morphological filtering model; in the pixel space, use morphological opening operation to eliminate isolated noise points below the optimal brightness threshold feature, and use morphological closing operation to fill the small holes inside the target to obtain the filtered binarized image. In specific implementation, the above embodiment S32 specifically involves: defining a structuring element B(x,y) in the pixel space, and using morphological opening operations. Eliminate below Tlum opt Isolated noise points, using morphological closing operation Fill in the holes inside the target; f represents the original binary image or grayscale image (the image matrix after thresholding); B represents the structuring element, usually a small binary matrix (such as a 3×3 square or circle), used to define the neighborhood shape; The erosion operator (⊕) slides the structuring element B across image f, keeping the center pixel at 1 only when B completely covers the foreground region; used to eliminate isolated noise and fine connections smaller than the structuring element. The dilation operator (⊕) slides the structuring element B across image f, setting the center pixel to 1 whenever B intersects with the foreground region; used to fill small holes and breaks within the target object. open This represents the image resulting from the opening operation, which involves erosion followed by dilation to remove isolated bright spots without significantly altering the size of larger targets; f close The image representing the result of the closing operation is first dilated and then eroded, filling small dark holes without changing the outline of larger targets; Furthermore, the size of the structuring element B(x,y) is not a fixed empirical value, but rather the optimal brightness threshold feature Tlum obtained based on two-dimensional maximum information entropy optimization. opt Generated through adaptive dynamic mapping; the specific quantization rule is as follows: define the structuring element B as a square matrix with a side length and pixel size L. B pass Calculate; where λ B The global luminance mapping coefficient is set. This indicates a floor operation, and max(3,...) means ensuring that the minimum size of the structuring element is not less than 3×3. The physical meaning of this formula is: when the brightness threshold obtained by optimization is high (meaning that the overall image is too bright and noise may be amplified), the size of the structuring element is automatically increased to enhance the denoising power of the morphological opening operation, thus eliminating the subjectivity of manually setting the size. S33. Perform a connected component labeling algorithm on the filtered binarized image to extract all connected components and boundary pixel coordinates; calculate the pixel gradient of all connected component boundaries; when the relative change rate of the boundary pixel gradient between two adjacent iterations is less than the preset convergence tolerance feature, stop the iteration and output the macroscopic foam target region and the microscopic sludge particle target region with clear boundaries and arranged in descending order of area. The above embodiment S3 constructs an adaptive morphological filtering model with parameter linkage, and materializes the abstract threshold matrix obtained by optimization into a pixel-level stripping tool; by utilizing the geometric characteristics of opening and closing operations and the combination of gradient constraints, it removes isolated noise points caused by suspended impurities in microscopic images, as well as small holes caused by rupture in foam images. The output connected domain boundaries are smooth and the geometric features are complete, laying the foundation for image quality for subsequent accurate extraction of morphological factors and color features. The above embodiment S4 includes the following steps: S41. Extract the macroscopic foam target region output by S33, and use the gray-level co-occurrence matrix (GLCM) operator to extract the contrast, correlation, energy and homogeneity in four spatial directions, and transform them into a surface evolution feature matrix. The above embodiment S41 includes the following steps: S411. Based on the gray-scale spatial distribution characteristics of the macroscopic foam target region output by S33, extract the joint probability distribution P(i,j,d,θ) of pixel pairs in the image at four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees, and construct the gray-scale co-occurrence matrix; P(i,j,d,θ) represents the joint probability of two pixels in the whole image whose gray-scale values ​​are exactly the gray-scale levels i and j of the two pixels, which are d apart and θ apart, respectively (i.e., the total number of pixel pairs that satisfy this condition divided by the total number of pixel pairs in the image). S412. Extract the joint probability features of the gray-level co-occurrence matrix in three consecutive spatial dimensions: the current pixel pair, the previous pixel pair, and the next pixel pair. S413. Substitute the joint probability features of the three consecutive spaces into the contrast and homogeneity calculation equations. Where Con represents the contrast feature, reflecting the clarity of the image texture and the depth of the grooves; i and j represent gray levels (ranging from 1 to L, where L is the number of gray levels); P(i,j): the probability of a pixel pair having a gray value of (i,j) in the normalized gray-level co-occurrence matrix; calculate the sum of the products of the squared differences of the current matrix elements and the probability values ​​to extract the transient viscosity change features of macroscopic foam, so as to amplify the step edges of foam texture caused by sludge aging or filamentous bacteria expansion; S414. Perform statistical operations on the continuous sequence containing the transient viscosity mutation feature, extract its global mean feature and texture variance feature, and construct a one-dimensional surface evolution feature matrix F. macro ; In specific implementation, the surface evolution feature matrix F macroThe mathematical structure is defined as a two-dimensional real matrix of dimension [N×8], where N is the total number of discrete time steps; the eight column vectors of the matrix correspond to: the arithmetic mean of the contrast features in the four spatial directions (0 degrees, 45 degrees, 90 degrees, 135 degrees) at the current time step, the global variance of the contrast features in the four spatial directions, the arithmetic mean of the homogeneity features in the four spatial directions, the global variance of the homogeneity features in the four spatial directions, the energy mean, the energy variance, the correlation mean, and the correlation variance; the data type of the matrix elements is single-precision floating-point numbers. This matrix fully quantifies the viscosity and roughness evolution trajectory of macroscopic bubbles in the time series. The above embodiments S411-S414 utilize the gray-level co-occurrence matrix operator to transform the vague sensory descriptions of foam stickiness and surface roughness in the subjective vision of operators into mathematical feature variables of contrast and homogeneity. By calculating the product of the squared difference of gray levels of adjacent pixels and the joint probability, the fine texture step edges caused by sludge aging or filamentous bacteria expansion can be amplified exponentially, realizing an objective and quantitative characterization of the macroscopic liquid surface deterioration trend of the synergistic denitrification reactor. S42. Extract the pixel coordinate sequence of all microscopic sludge particle target areas output by S33, and reconstruct the RGB color space into an HSV (hue, saturation, brightness) color space matrix. S43. Extract the pixel value sequence of the hue channel in the HSV color space matrix, count the discrete probability distribution characteristics of the number of pixels in the anaerobic ammonia oxidation characteristic hue interval relative to the total number of pixels in the particles, generate the redness index of independent particles, and obtain the color space distribution feature matrix. In specific implementation, the above embodiment S43 specifically involves: taking the pixel value sequence of the hue channel in the HSV color space matrix; defining the characteristic hue H interval as [0,20]∪[340,360] based on the biological characteristics of anaerobic ammonia oxidizing bacteria rich in cytochrome c; traversing all pixels within the target and counting the total number N of pixels that satisfy the H threshold condition. red With the total number of pixels N total ; Calculate the redness index RI of a single particle = N red / N total ; Furthermore, to overcome the hue drift caused by differences in color temperature of different batches of microscope light sources, the characteristic hue H range is not fixed, but dynamically obtained through a benchmark adaptive calibration algorithm: During the initial healthy steady-state period of system operation, target region pixels of 1000 frames of microscopic images are extracted and mapped to HSV space; unsupervised clustering of the hue channels is performed using the K-means clustering algorithm (setting the number of clusters K=3, corresponding to red bacteria, inorganic suspended background, and black aged sludge, respectively); the cluster whose cluster center point is closest to the pure red hue (H=0) is extracted, and the mean hue value μ of all pixels in the cluster is calculated.H With standard deviation σ H Subsequently, using statistical confidence intervals, the characteristic hue H interval was redefined as [μ H -2σ H ,μ H +2σ H (If the value exceeds the limit, the modulus is taken by 360); the above mechanism ensures the robustness of the feature interval to differences in hardware environment; S44. Calculate the perimeter (Peri) and area (Area) of the target region for each microscopic sludge particle output in S33; multiply the area by a constant and divide by the square of the perimeter feature to calculate the morphological factor feature of each particle, obtaining the geometric complexity feature matrix; the specific formula for calculating the morphological factor feature is as follows: Where SF represents the morphological factor feature, with a value range of (0,1], and the closer it is to 1, the closer the shape is to a circle; S45. Statistical analysis of microscopic images of the synergistic denitrification reactor during a continuous set number of days and when the total nitrogen in the effluent meets the standard, calculation of the average redness index and average morphology factor of all sludge particles, and obtaining the global biological phenotypic baseline characteristics. In specific implementation, the above embodiment S45 is as follows: According to the principles of image morphology, the healthy short-cut nitrification-anammox granular sludge exhibits a regular spherical shape and is rich in heme, appearing brick red; the average redness index RI of all particles during the steady-state period is calculated. bl With the mean of the morphological factor SF bl ; Furthermore, to avoid errors in benchmark feature extraction caused by the lagging indicator of "total nitrogen in effluent meeting standards," this embodiment defines a criterion for determining the historical steady-state operating cycle: the system sets a sliding time window of 72 hours. Benchmark feature extraction and updating are triggered only when the following three conditions are met simultaneously within this time window: (1) the total nitrogen in effluent from laboratory testing or online instruments is below the discharge limit for 72 consecutive hours; (2) the variance of real-time data from DO and pH sensors within the time window is less than 10% of the long-term historical variance; (3) the influent flow rate fluctuation is less than 5%. The system is confirmed to be in an absolute biologically healthy steady state only when the above multidimensional indicators are met simultaneously. At this time, the extracted RI bl With SF bl Only then is it written into the controller memory as a global baseline; S46. Divide the redness index RI generated in S43 and the morphological factor feature SF generated in S44 by the average redness index RI extracted in the global biological phenotypic benchmark features in S45. bl With average morphological factor SF bl The dimensionless relative drift ratio characteristic is calculated; the relative drift ratio characteristic includes the relative drift rate (Ratio) of the redness index.RI The relative drift ratio of morphological factors SF The surface evolution feature matrix, the relative drift ratio feature, and the one-dimensional discrete-time sensing sequence generated in S12 are orthogonally concatenated by row vectors to generate a multi-dimensional multimodal joint feature matrix. In specific implementation, the above embodiment S46 specifically refers to: the relative drift rate Ratio of the redness index. RI The calculation formula is The relative drift ratio of the morphological factor. SF The calculation formula is ; Furthermore, to standardize the mathematical structure of the feature matrix to adapt to the input of the deep learning model, this embodiment defines the matrix dimension as follows: For the t-th discrete sampling time step (t=1, 2,...,N), where N is the total length of the time series; extract the relative drift rates of all M effective sludge particles in the microscopic image of that frame, and calculate their arithmetic mean as the representative feature of that time step; arrange the features of N consecutive time steps in rows to generate a color space distribution and geometric complexity feature matrix with dimension N×2; the first column of the matrix is ​​the relative drift rate of redness, and the second column is the relative drift rate of morphological factors; The above embodiment S4 constructs a comprehensive, multi-scale feature extraction and calibration system; it captures macroscopic foam viscosity mutations through gray-scale co-occurrence matrix, quantifies the abundance decay of microscopic core bacterial communities (such as anaerobic ammonia oxidizing bacteria) using HSV color space, and quantifies sludge disintegration trends using morphological factors; this embodiment uses the calculated steady-state global benchmark features as the denominator to transform absolute pixel statistics into relative drift rates characterizing the degree of system deterioration; this multimodal joint stitching and relative benchmark calibration mechanism not only eliminates the one-sidedness caused by the hysteresis of a single sensor, but also smooths out the system errors caused by differences in the physical dimensions of different reactors and camera parameters; The above embodiment S5 includes the following steps: S51. The surface evolution feature matrix, color space distribution and geometric complexity feature matrix and relative drift ratio feature are used as feedforward inputs to the denitrification process state mapping model, and the temporal fusion hidden state matrix is ​​extracted using a bidirectional long short-term memory network. In specific implementation, the above embodiment S51 is as follows: the denitrification process state mapping model includes a bidirectional long short-term memory network layer, a cross-attention layer, and a fully connected classification layer; the bidirectional long short-term memory network layer contains 64 hidden neurons in both the forward and reverse directions, used to extract the sequential dependencies of the sequence; the cross-attention layer contains a multi-head attention mechanism (set to 4 heads), used to calculate the dot product similarity between different modalities; the fully connected classification layer contains two linear mapping layers, and the final output dimension is 6 (corresponding to 6 process states). Furthermore, the offline training process of the model is as follows: collect 26,280 hours of multimodal historical data from the wastewater treatment plant over the past three years; to eliminate the subjective error of manual labeling, establish objective location rules for state change points based on multidimensional time-series derivatives; for example, define the starting timestamp of the precursor state of sludge disintegration as: the time point when the negative first derivative of the relative drift rate of the micromorphological factor exceeds the historical 95th percentile for three consecutive time steps, and the effluent ammonia nitrogen data has not yet exceeded the standard; based on this rule, use the sliding window algorithm to automatically extract data segments containing 60 time steps, generating a total of 45,000 effective training samples; The dataset was divided into training, validation, and test sets in an 8:1:1 ratio; the prediction error was calculated using the cross-entropy loss function; the Adam optimizer was used, with an initial learning rate of 0.001 and a batch size of 64. The maximum number of iterations (Epoch) is set to 100. During training, if the model's loss value on the validation set does not decrease for 10 consecutive Epochs, an early stopping mechanism is triggered to prevent overfitting. At this point, all network weight matrices and bias vectors are fixed to obtain the final denitrification process state mapping model. The above embodiment S51 includes the following steps: S511. Expand the surface evolution feature matrix, color space distribution and geometric complexity feature matrix, and relative drift ratio feature into an input sequence vector by time step; S512. During the forward propagation of the network, the input sequence vector at the current time step is linearly mapped to the forward hidden state features at the previous time step, and activation function operations are performed to calculate the forgetting gating feature and the input gating feature i. t The forgetting gate feature and the input gate feature are used to filter historical cell states and update the current cell state, and output the positive hidden state feature of the current time step. In specific implementation, the above embodiment S512 specifically involves: during forward propagation, the input vector a of the current time step is... t Compared to the previous time step, the positive hidden state h forward Perform a linear mapping on {t-1} and compute the forget gate. With input gate i t Update cell state C t Output the positive hidden state h forward {t}; where f t The output of the forget gate determines how much of the cell's state from the previous moment is discarded; W f The weight matrix of the forget gate, b fThe bias vector representing the forget gate is called the bias vector, and σ is the Sigmoid activation function; S513. During the backpropagation of the network, the input sequence vector of the current time step and the back hidden state feature of the next time step are subjected to the same gating mathematical operation steps as in S512, and the back hidden state feature h of the current time step is output. backward {t}; S514. The forward hidden state features and the reverse hidden state features at the same time step are concatenated bit by bit to generate a temporal fusion hidden state matrix containing global temporal context information. ; The above embodiments S511-S514 introduce a bidirectional long short-term memory network. The forget gate and input gate structure can adaptively determine the retention ratio of historical steady-state information and the update ratio of current mutation information. By forward capturing the evolution trend of toxic substance accumulation and backward tracing the initial cause of sludge disintegration, and orthogonally splicing the bidirectional hidden states, the model extracts the global temporal context information of the collaborative denitrification system in the time dimension to the maximum extent. S52. Calculate the original correlation score between the image modal hidden state and the sensor modal hidden state at each time step using the nonlinear dot product scoring function of the cross-attention mechanism; substitute the original correlation score into the Softmax normalization equation to transform it into an adaptive dynamic weight allocation matrix. The above embodiment S52 includes the following steps: S521. Extract the hidden state vectors belonging to the image modality from the temporal fusion hidden state matrix H(t) output by S51, and multiply them by the pre-trained query weight matrix W. q Construct the query matrix Q; extract the hidden state vectors belonging to the sensing modality, and multiply them by the pre-trained key weight matrix W. k The weight matrix W v Construct the key matrix K and the value matrix V; In specific implementation, the above embodiment S521 specifically refers to: the pre-trained query weight matrix W q Key weight matrix W k The weight matrix W v All three matrices were generated during the offline training phase of the model. Initially, they were randomly initialized using a Xavier normal distribution. During training, the cross-entropy loss was calculated during forward propagation, and the loss function was calculated using the backpropagation algorithm. q W k With W vThe partial derivative gradients; the Adam optimizer updates the values ​​of the internal elements of these three matrices epoch by epoch based on the gradient descent direction; when the model converges on the validation set, the values ​​of these three matrices are fixed and used to map the hidden state vectors to a specific attention computation subspace during online diagnostics; S522. Extract the feature dimension scaling factor d obtained by updating the feature dimension through backpropagation algorithm during the offline training phase of the network. k The query matrix Q and the transpose of the key matrix K are then multiplied by a dot product, and the result is divided by the square root of the feature dimension scaling factor to calculate the nonlinear mapping feature representing the cross-association strength between modalities. Where T represents transpose; In specific implementation, the above embodiment S522 specifically refers to: feature dimension scaling factor d k The column dimension of the key matrix K used for attention calculation is equal to the column dimension of the key matrix K. If the feature dimension of matrix K is 64, then d k =64; Divide by d after the dot product operation. k The square root is used to prevent the result from becoming extremely large when high-dimensional vectors are dot-producted, which would cause the gradient to fall into the saturation region (approaching 0) when subsequently substituted into the Softmax function. This scaling operation ensures the stable flow of gradients during backpropagation and ensures the mathematical stability of the intermodal correlation score calculation. S523. Substitute the nonlinear mapping feature as the original correlation score into the Softmax normalization equation. ; where exp(Score t () represents the raw score at time t with the natural constant e as the base. t The index; Score i Represents the original score at any time i; calculates the ratio of the natural index value of the nonlinear mapping feature at the current time step to the sum of the natural index values ​​at all time steps, and outputs an adaptive dynamic weight allocation matrix with a sum of 1. The above embodiments S521-S523 replace the traditional multi-sensor weighted average method with a cross-attention mechanism; by performing a high-dimensional space dot product operation between the query matrix and the key matrix, the model objectively measures the intrinsic correlation between image features and sensing features in a purely mathematical way; the dynamic weights output by the Softmax normalization equation enable the system to automatically deprive the weights of the failed sensors when facing the harsh working condition of the probe being covered by sludge and causing data deadlock, and focus attention on the image phenotype, thereby improving the anti-interference ability of the diagnostic method; S53. Multiply the weight coefficients in the adaptive dynamic weight allocation matrix output from S52 with the temporal fusion hidden state matrix extracted from S51 element-wise and sum them to output a weighted context feature vector focusing on the mutation intervals of biological phenotype and sensor data. , where α t V represents the adaptive dynamic weight coefficient at time step t (the sum of the weights at all time steps is 1); t This represents the value matrix at time step t; S54. Input the weighted context feature vector into the fully connected classification layer, and use the weight matrix W cls With bias b cls Perform linear mapping This is mapped to a logical output tensor whose dimension equals the total number of state categories; In specific implementation, the above embodiment S54 specifically involves: utilizing the pre-trained and fixed classification weight matrix W within the fully connected classification layer. cls With classification bias vector b cls Perform a linear mapping; where W cls It is a dimension [H dim C num A two-dimensional real matrix, where H dim C represents the dimension of the weighted context feature vector output by the attention layer. num The total number of state categories is 6; b cls It is a dimension [1, C num A one-dimensional row vector; S55. Substitute the logical output tensor Logits into the Softmax function to calculate the conditional probability distribution sequence P of the process operation within the time window belonging to each label category. class Extract the state category label corresponding to the feature with the highest probability value (such as normal operation, over-aeration, insufficient carbon source, nitrite accumulation, sludge disintegration precursor, load shock), generate a control message with timestamp feature and send it to the control node; The above embodiment S5 combines a bidirectional long short-term memory network with cross-attention and uses nonlinear dot product quantification to measure the cosine similarity between phenotypic mutations and water quality fluctuations. This dynamic weighting mechanism enables the model to automatically assign judgment weights to image modalities in the early stage when sensor data has not yet deteriorated significantly but biological phenotypes have already undergone a step change, thereby outputting an accurate conditional probability distribution. It directly generates control messages with timestamps, thus establishing a closed-loop link from multimodal perception, feature decoupling, intelligent early warning to process adaptive control. This invention is inspired by the principle in environmental microbiology that phenotype precedes water quality variation. Addressing the extreme fragility and vulnerability of synergistic denitrification processes, this invention abandons the traditional passive diagnostic model that relies solely on chemical probes. Instead, it constructs a three-dimensional multimodal perception framework integrating "macroscopic appearance - microscopic essence - physicochemical environment." It employs an improved pelican optimization algorithm to objectively optimize the segmentation threshold, utilizes a relative benchmark drift equation to eliminate dimensional errors in physical quantities, and dynamically allocates weights through matrix dot product operations based on a cross-attention mechanism. This solves the critical flaw of delayed water quality alarms, achieving zero-contact, low-latency early warning. It effectively shields data distortion caused by probe scaling or light source aging. By outputting intuitive conditional probabilities and control messages, it establishes a closed loop from AI perception to adaptive process control, providing intelligent decision-making for the low-carbon and stable operation of wastewater treatment plants. The following detailed explanation is provided with reference to specific embodiments: Example 1: This embodiment uses a municipal wastewater treatment plant employing a short-cut nitrification-anaerobic ammonium oxidation (PN / A) process as an example to illustrate the method of the present invention in detail: In the PN / A reactor, the sampling frequency of the high-frequency camera and microscopic imager was set to 1 frame per minute, and the sampling period of the water quality sensor was 10 seconds; the threshold for exceeding the first derivative of DO was set to Dth. do =0.1 mg / (L·min); During the initial health compliance phase of the system, the effluent met the standards for 7 consecutive days, and the global biological phenotypic baseline characteristics were calculated: the average redness index (RI) of anaerobic ammonia oxidation particles. bl =0.65, average morphological factor SF bl =0.85; In the early morning of a certain day, a sudden surge of high-concentration industrial organic wastewater (COD) hit the upstream pipeline network. In the initial stage of the surge (minutes 1-30), heterotrophic bacteria in the reactor began to multiply rapidly using organic matter and secreted sticky extracellular polymers (EPS) that adhered to the surface of anaerobic ammonia oxidation particles. At this time, the DO sensor in the water slowly decreased from 1.5 mg / L to 1.3 mg / L due to the oxygen consumption of the heterotrophic bacteria. Since the decrease did not touch the PLC's preset absolute lower limit alarm threshold (e.g., 0.5 mg / L), the traditional control system did not react. However, the multimodal diagnostic system of this invention triggered an interrupt (marked as t0) at the 30-minute mark of the surge (absolute time) because it detected that the combined rate of change of DO and image features exceeded the threshold. The controller immediately captured data from 30 minutes before to 30 minutes after time t0, constructing an analysis time window of 60 minutes (i.e., a relative time step from -30 minutes to +30 minutes). When a sudden surge of high concentrations of organic matter (COD) occurs upstream, heterotrophic bacteria proliferate and crowd out the space of anaerobic ammonia-oxidizing bacteria. At this time, the DO sensor in the water only shows a slight decrease due to the oxygen consumption of heterotrophic bacteria (derivative change = 0.05, not triggering the traditional dead zone alarm), but the edges of granular sludge in the microscopic image begin to disperse. When the combined rate of change triggers an interruption, the microcontroller extracts a sequence of data from 60 minutes before and after the event. The mean DO value of 1.5 and the standard deviation of 0.2 are extracted and normalized using Z-score mapping to a normal distribution. The population size is set to M=30; in the 15th iteration, a nonlinear inertial weight w and a Cauchy mutation operator are introduced, allowing the pelican individuals to escape local halo interference and converge towards the two-dimensional maximum information entropy extremum region, outputting the optimal threshold space matrix [Tlum]. opt =125,Tcon opt =45], at which point the sum of the information entropy of the target and the background reaches its maximum value of 7.82; In the S3 phase, Tlum opt =125 Input adaptive morphological filtering model, after opening and closing operation to remove background, to extract pure micro-particle targets; In phase S4, the system performs frame-by-frame analysis of the images at these 60 relative time steps. It was found that in the microscopic image at a relative time step of -10 minutes (i.e., the 20th minute after the actual impact, when sensor data shows almost no change), a statistical analysis of the target pixels revealed a sharp decrease in the number of red pixels within the [0,20] hue range. The redness index RI for this frame was objectively calculated to be 0.32. Based on the baseline features, the relative drift ratio Ratio was calculated. RI =0.32 / 0.65=0.49 (The redness has decreased by more than 50%). The above features are orthogonally concatenated into a multimodal matrix, which is then input into a bidirectional long short-term memory network to extract hidden states. After entering the cross-attention mechanism, a Q-matrix is ​​constructed using the image hidden states, and a K-matrix is ​​constructed using the sensor hidden states. Dot product operations are performed to obtain the nonlinear mapping feature score. Due to the abrupt change in image modality (Ratio...),... RI With Ratio SF The attention score spiked at this time step due to a significant decrease in the perceived modality (DO) and a slight change in the perceived modality (DO). Substituting this into the Softmax normalization equation, the adaptive dynamic weighting coefficient α for the abrupt time segment (minutes 20-25) increased. t The mathematical formula calculates it to be 0.82, while the weight of a stable historical background time is only 0.02; The weights are multiplied and summed with the value matrix V to obtain a weighted context feature vector Context that is highly focused on phenotypic mutations in sludge disintegration. The fully connected layer maps this to a 6-dimensional tensor and outputs a conditional probability distribution sequence through Softmax: P=[0.01(normal),0.02(over-aeration),0.01(insufficient carbon source),0.04(nitrite accumulation),0.89(sludge disintegration precursor),0.03(load shock)]; Extract the maximum probability value P max =0.89 corresponds to the sludge disintegration precursor category. The controller immediately determines that the current process has entered the sludge disintegration precursor state. In the early stage when the effluent ammonia nitrogen has not yet exceeded the standard, a control message is generated and sent to the PLC: the frequency of the influent booster pump is automatically reduced and the opening of the bottom sludge discharge valve is increased, which successfully discharges the proliferating flocculent heterotrophic bacteria and ensures the stable operation of the process.

[0015] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0016] The preferred embodiments of the invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention.

Claims

1. A method for synergistic denitrification process status diagnosis based on image recognition, characterized in that, Includes the following steps: S1. Extract the macroscopic video stream from the surface of the synergistic denitrification reactor, the microscopic video stream from the mixed liquor, and the real-time water quality sensor signal to obtain a multidimensional discrete time series signal. S2. Using the two-dimensional maximum information entropy feature of the image frame in the multidimensional discrete time series signal as the optimization target of the fitness function, the optimal threshold space matrix for adaptive image segmentation is obtained by using the improved pelican optimization algorithm. S3. Based on the optimal threshold space matrix, construct an adaptive morphological filtering model; input macroscopic and microscopic image frames into the adaptive morphological filtering model, and output the macroscopic foam target region and the microscopic sludge particle target region; S4. Extract the intrinsic texture features of the macroscopic foam target region and convert them into a surface evolution feature matrix; Extract the coordinate sequence of all target regions of microscopic sludge particles, and calculate the color space distribution and geometric complexity feature matrix; Calculate the global biological phenotypic baseline features of the multidimensional discrete-time series signal; Based on the global biological phenotypic baseline characteristics, the characteristics of each target area and the relative drift ratio of water quality sensing signals are calculated. S5. Input the surface evolution feature matrix, color space distribution and geometric complexity feature matrix and relative drift ratio feature into the denitrification process state mapping model to obtain the conditional probability distribution sequence and determine the unstable evolution state of the synergistic denitrification process.

2. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 1, characterized in that, S1 includes the following steps: S11. When the absolute value of the real-time first derivative of the dissolved oxygen or pH sensor is detected to be greater than the set derivative over-limit threshold, the synchronous sampling is interrupted; the historical background sequence and the working condition evolution sequence are extracted based on the trigger time and spliced ​​together to generate the original multidimensional discrete time series. S12. Extract the global mean and global standard deviation features of the water quality sensing signal from the original multidimensional discrete time series; using the Z-score normalization equation, subtract the global mean feature from each discrete data point in the original water quality sensing signal and divide by the global standard deviation feature to obtain a one-dimensional discrete time sensing sequence that follows a standard normal distribution.

3. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 2, characterized in that, S2 includes the following steps: S21. Define the population state space of the improved pelican optimization algorithm; define the position coordinates of the two-dimensional optimization particle as the global brightness threshold feature and local contrast threshold feature of image segmentation; S22. Establish a fitness function based on the two-dimensional maximum information entropy feature; for any set of position coordinates, perform trial segmentation on the macroscopic and microscopic image frames in the multidimensional discrete time series signal generated in S1 to obtain a trial binary mask; The two-dimensional histogram distribution probability of the target region and the background region is calculated based on the tentative binarized mask; the two-dimensional histogram distribution probability is transformed into a normalized probability distribution sequence, and the spatial information entropy of the target and the background is calculated using the Shannon information entropy formula, and the sum of the two is defined as the two-dimensional maximum information entropy feature. S23. Based on the fitness function, with the goal of maximizing the two-dimensional maximum information entropy feature as the global optimization objective, the population state space is updated within the set maximum number of iterations; when the maximum number of iterations is reached, the iteration terminates, and the position coordinates of the position with the largest global fitness value are output as the optimal threshold space matrix.

4. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 3, characterized in that, The process of updating the population state space in S23 specifically includes the following steps: S231. In the prey-approaching stage of the algorithm, a nonlinear dynamic inertia weight factor is introduced; the nonlinear dynamic inertia weight factor is defined as a mathematical function that decays cosine with the number of iterations, and the nonlinear dynamic inertia weight factor is multiplied by the position coordinates of the previous generation of pelicans. S232. During the water flight phase of the algorithm, extract the location coordinates of the pelican with the best fitness value in the current population; substitute the optimal pelican location coordinates into the Cauchy mutation operator equation; and use the Cauchy distribution function to generate large-step mutated location coordinates around the original optimal location. S233. If the fitness value of the mutated position coordinates is greater than the fitness value of the original optimal position, then the mutated position coordinates shall replace the original optimal position coordinates.

5. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 3, characterized in that, S3 includes the following steps: S31. Using the optimal brightness threshold feature in the optimal threshold space matrix as the binarization segmentation benchmark and the optimal contrast threshold feature as the edge gradient constraint operator, construct an adaptive morphological filtering model for the macroscopic and microscopic image frames. S32. Input the macroscopic and microscopic image frames in the multidimensional discrete time series signal generated in S1 into the adaptive morphological filtering model; in the pixel space, use morphological opening operation to eliminate isolated noise points below the optimal brightness threshold feature, and use morphological closing operation to fill the small holes inside the target to obtain the filtered binarized image. S33. Perform a connected component labeling algorithm on the filtered binarized image to extract the coordinates of all connected components and boundary pixels; calculate the pixel gradient of all connected component boundaries; when the relative change rate of the boundary pixel gradient between two adjacent iterations is less than the preset convergence tolerance feature, stop the iteration, and output the macroscopic foam target region and the microscopic sludge particle target region with clear boundaries and arranged in descending order of area.

6. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 5, characterized in that, S4 includes the following steps: S41. Extract the macroscopic foam target region output by S33, and use the gray-level co-occurrence matrix operator to extract the contrast, correlation, energy and homogeneity in four spatial directions, and transform them into a surface evolution feature matrix. S42. Extract the pixel coordinate sequence of all microscopic sludge particle target areas output by S33, and reconstruct the RGB color space into an HSV color space matrix. S43. Extract the pixel value sequence of the hue channel in the HSV color space matrix, count the discrete probability distribution characteristics of the number of pixels in the anaerobic ammonia oxidation characteristic hue interval relative to the total number of pixels in the particles, generate the redness index of independent particles, and obtain the color space distribution feature matrix. S44. Calculate the perimeter and area of ​​the target region of each microscopic sludge particle output by S33 respectively; multiply the area by a constant and divide by the square of the perimeter feature to calculate the morphological factor feature of each particle and obtain the geometric complexity feature matrix. S45. Statistical analysis of microscopic images of the synergistic denitrification reactor during a continuous set number of days and when the total nitrogen in the effluent meets the standard, calculation of the average redness index and average morphology factor of all sludge particles, and obtaining the global biological phenotypic baseline characteristics. S46. Divide the redness index generated in S43 and the morphological factor feature generated in S44 by the average redness index and average morphological factor in the global biological phenotypic benchmark features extracted in S45, respectively, to calculate the dimensionless relative drift ratio feature; the dimensionless relative drift ratio feature includes the relative drift rate of the redness index and the relative drift rate of the morphological factor.

7. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 6, characterized in that, S41 includes the following steps: S411. Based on the gray-scale spatial distribution characteristics of the macroscopic foam target area output by S33, extract the joint probability distribution of pixel pairs in the image in four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees, and construct the gray-scale co-occurrence matrix. S412. Extract the joint probability features of the gray-level co-occurrence matrix in three consecutive spatial dimensions: the current pixel pair, the previous pixel pair, and the next pixel pair. S413. Substitute the three consecutive spatial joint probability features into the contrast and homogeneity calculation equation; calculate the sum of the products of the squared differences of the current matrix elements and the probability values, and extract the transient viscosity change features of macroscopic bubbles. S414. Perform statistical operations on the continuous sequence containing the transient viscosity mutation feature, extract its global mean feature and texture variance feature, and construct a one-dimensional surface evolution feature matrix.

8. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 6, characterized in that, S5 includes the following steps: S51. The surface evolution feature matrix, color space distribution and geometric complexity feature matrix and relative drift ratio feature are used as feedforward inputs to the denitrification process state mapping model, and the temporal fusion hidden state matrix is ​​extracted using a bidirectional long short-term memory network. S52. Calculate the original correlation score between the image modal hidden state and the sensor modal hidden state at each time step using the nonlinear dot product scoring function of the cross-attention mechanism; substitute the original correlation score into the Softmax normalization equation to transform it into an adaptive dynamic weight allocation matrix. S53. Multiply the weight coefficients in the adaptive dynamic weight allocation matrix output by S52 with the temporal fusion hidden state matrix extracted by S51 element by element and sum them to output a weighted context feature vector focusing on the mutation interval of biological phenotype and sensor data. S54. Input the weighted context feature vector into the fully connected classification layer, and use the weight matrix and bias to perform a linear mapping to a logical output tensor with a dimension equal to the total number of state categories. S55. Substitute the logic output tensor into the Softmax function to calculate the conditional probability distribution sequence of the process operation within the time window belonging to each label category; extract the state category label corresponding to the feature with the maximum probability value, and generate a control message with timestamp features to be sent to the control node.

9. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 8, characterized in that, S51 includes the following steps: S511. Expand the surface evolution feature matrix, color space distribution and geometric complexity feature matrix, and relative drift ratio feature into an input sequence vector by time step; S512. During the forward propagation of the network, the input sequence vector at the current time step is linearly mapped to the forward hidden state features at the previous time step, and activation function operations are performed to calculate the forgetting gating feature and the input gating feature i. t The forgetting gate feature and the input gate feature are used to filter historical cell states and update the current cell state, and output the positive hidden state feature of the current time step. S513. During the backpropagation of the network, the input sequence vector of the current time step and the back hidden state feature of the next time step are subjected to the same gating mathematical operation steps as in S512, and the back hidden state feature of the current time step is output. S514. The positive hidden state features and the negative hidden state features at the same time step are concatenated bit by bit to generate a temporal fusion hidden state matrix containing global temporal context information.

10. The method for synergistic denitrification process status diagnosis based on image recognition according to claim 8, characterized in that, S52 includes the following steps: S521. Extract the hidden state vectors belonging to the image modality from the temporal fusion hidden state matrix output by S51, and multiply them by the pre-trained query weight matrix to construct the query matrix; extract the hidden state vectors belonging to the sensing modality, and multiply them by the pre-trained key weight matrix and value weight matrix respectively to construct the key matrix and value matrix. S522. Extract the feature dimension scaling factor obtained by updating through backpropagation algorithm during the offline training phase of the network; perform a dot product operation on the transpose of the query matrix and the key matrix, and divide it by the square root of the feature dimension scaling factor to calculate the nonlinear mapping feature representing the cross-correlation strength between modalities. S523. Substitute the nonlinear mapping feature as the original association score into the Softmax normalization equation; calculate the ratio of the natural index value of the nonlinear mapping feature at the current time step to the sum of the natural index values ​​at all time steps, and output an adaptive dynamic weight allocation matrix with a sum of 1.