High-rise building water quality change prediction method and system based on image recognition
By using image recognition technology to obtain multimodal data from the inner walls and centers of water pipes in high-rise buildings, and combining it with long-short-term memory networks, we can achieve multi-dimensional predictions of water quality changes, solving the lag and single-dimensional analysis problems of traditional water quality monitoring technology and improving the safety and predictive capabilities of the water supply system.
Patent Information
- Application Number
- CN202510909011.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-07-02
AI Technical Summary
Traditional water quality monitoring technology is unable to capture the biofilm adhesion and rust morphology on the inner walls of water pipes in high-rise buildings, resulting in delayed pollution warnings. It also lacks the ability to analyze the temporal and spatial evolution of pollutants and has insufficient dynamic prediction capabilities, making it difficult to provide a reliable basis for proactive prevention and control.
An image recognition-based method is used to obtain image time series data of the inner wall and center of the pipeline. A water quality change prediction model is constructed through a long-short-term memory network. Combined with multimodal data fusion technology, including the change characteristics of rust spots on the inner wall of the pipeline and the fluorescence change characteristics of the pipeline center, a multi-dimensional prediction of water quality changes is achieved.
It improves the accuracy and timeliness of water quality change predictions, enables early identification of complex water quality risks, and enhances the water supply safety of secondary water supply systems in high-rise buildings.
Smart Images

Figure CN120766082A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of power system communication technology, and in particular to a method and system for predicting water quality changes in high-rise buildings based on image recognition. Background Art
[0002] With the acceleration of urbanization, the secondary water supply system of high-rise buildings, as a core facility to ensure the safety of residents' water supply, has attracted much attention for its water quality stability and pollution warning capabilities. Traditional water quality monitoring technology mainly relies on physical and chemical sensors (such as residual chlorine sensors, turbidity meters, etc.) to collect water quality parameters in real time and trigger warnings through threshold judgment. However, this method has significant limitations, mainly including: (1) Lack of visual pollution detection: The sensor cannot capture the pollution characteristics visible to the naked eye, such as biofilm adhesion, rust morphology, and algae growth on the inner wall of the water pipe, which are often the direct cause of microbial excess or metal ion precipitation. For example, rust pitting (circularity > 0.7) may cause heavy metal penetration, but traditional sensors need to wait until the water quality parameters deteriorate (such as turbidity > 1NTU) before they can alarm, which has a lag of more than 24 hours. (2) Single data dimension: Existing technologies are mostly based on single-point sensor data and lack the ability to analyze the spatiotemporal evolution of pollutants. Studies have shown that the distribution of microbial film on the inner wall of the pipe is nonlinearly related to the water flow rate. It is difficult to accurately predict the pollution spread trend based on pH or residual chlorine data alone. (3) Insufficient dynamic prediction capabilities: Prediction models based on historical sensor data (such as time series analysis) have poor adaptability to sudden pollution events, especially the lack of response mechanisms to changes in optical characteristics (such as sudden changes in fluorescence intensity caused by algae blooms). This leads to insufficient prediction accuracy and makes it difficult to provide a reliable basis for active prevention and control.
[0003] In recent years, optical imaging technology has been gradually applied in the field of water quality monitoring, such as detecting suspended matter concentration through underwater cameras. However, existing image recognition solutions are mostly limited to static particle statistics, and lack effective solutions to key issues such as image distortion correction, low-light imaging optimization, and multi-spectral feature fusion in complex pipeline environments. In addition, image noise caused by reflections from highly turbid water or curved pipe surfaces further reduces the reliability of visual detection. In response to the above technical bottlenecks, there is an urgent need for an innovative monitoring method that can simultaneously acquire and fuse the visual features of the inner wall of the pipe and the multi-dimensional data of water quality parameters, and realize early prediction and accurate warning of water quality changes through dynamic models, thereby improving the active protection capabilities and water safety level of the secondary water supply system of high-rise buildings. Summary of the Invention
[0004] In response to the above technical problems, the present application provides a method and system for predicting water quality changes in high-rise buildings based on image recognition to improve the water supply safety of secondary water supply systems in high-rise buildings.
[0005] In a first aspect, an embodiment of the present application provides a method for predicting water quality changes in high-rise buildings based on image recognition, comprising: Acquire a time series data set for a preset time period of the target water pipe, the time series data set including first image time series data, second image time series data, and water quality sensor time series data for the preset time period of the target water pipe, wherein the first image time series data is constructed based on image data of the inner wall of the target water pipe at multiple moments, and the second image time series data is constructed based on image data of the center of the target water pipe at multiple moments; Perform feature extraction on the first image time series data and the second image time series data respectively to obtain corresponding pipeline inner wall rust spot change features and pipeline center fluorescence change features; Performing multimodal fusion on the rust spot change characteristics on the inner wall of the pipeline, the fluorescence change characteristics at the center of the pipeline, and the time series data of the water quality sensor to obtain multimodal time series data; Inputting the multimodal time series data into a preset water quality change prediction model, so that the water quality change prediction model predicts the water quality change trend of the target pipeline according to the multimodal time series data, and then outputs a corresponding water quality change prediction result; generating corresponding early warning signals according to the water quality change prediction results; The water quality change prediction model is obtained by training an initial water quality change prediction model based on a historical time series data set, and the initial water quality change prediction model is constructed based on a long short-term memory network.
[0006] The embodiment of the present application provides a method for predicting water quality changes in high-rise buildings based on image recognition. By extracting image features from a number of image data and combining them with sensor data to construct a multimodal time series data set including images of rust spots on the inner wall of the pipe, fluorescence images of the center of the pipe, and sensor data, the method breaks through the limitations of traditional single-point sensor monitoring in the dimension of pollution feature perception, allowing the water quality change prediction model to comprehensively predict the water quality changes of the target pipe from multiple dimensions, thereby improving the accuracy of water quality change prediction. Furthermore, the embodiment of the present application uses a long-short-term memory network to construct a prediction model, which can effectively capture the temporal evolution law of water quality sensor data and combine it with the change law of rust spots on the inner wall of the pipe and the change law of algae in the water, so that the prediction model has the ability to early identify complex water quality risks such as heavy metal precipitation and excessive microorganisms. As the last link in the residential water supply system, the secondary water supply system of high-rise buildings needs this early identification capability to ensure the safety of residents' water use. Compared with existing single-modal water quality detection or prediction technologies, the water quality change prediction method based on multimodal data provided in this embodiment significantly improves the timeliness of prediction of water quality mutation events and the risk tracing capability, thereby improving the water supply safety of the secondary water supply system of high-rise buildings.
[0007] Furthermore, the step of constructing the first image time series data based on the pipe inner wall image data of the target water pipe at multiple moments includes: Acquire pipeline inner wall image data of the target water pipe at multiple times through an optical imaging device at a first preset position of the target water pipe, and mark each pipeline inner wall image data with a GPS timing signal at a corresponding time; Arranging the pipeline inner wall image data in time sequence according to the GPS timing signal of the pipeline inner wall image data to obtain initial first image time series data; According to a preset time interval, the initial first image time series data is interpolated and reconstructed using a cubic spline interpolation method to construct the first image time series data with equal time intervals.
[0008] This embodiment of the present application provides a method for acquiring time-series data from first images. This method uses a fixed-position optical imaging device to capture continuous time-series images, forming a stable spatial reference coordinate system that enables comparable morphological analysis of corroded areas. Finally, using cubic spline interpolation to construct time-series data from first images at equal time intervals, this method accurately captures the progression of rust from pitting to general corrosion. This provides a reliable time-series imaging basis for predicting the changing trend of rust on pipeline inner walls, while also providing standardized input data for subsequent model predictions, improving the accuracy of model predictions.
[0009] Furthermore, the step of constructing the second image time series data based on the pipeline center image data of the target water pipe at multiple moments includes: When the pipeline inner wall image data is acquired, the active imaging device uses excitation light of a preset wavelength to illuminate a second preset position of the target water pipe, and simultaneously captures a fluorescence image of a preset wavelength band at the second preset position, thereby obtaining pipeline center image data of the target water pipe at multiple moments, and marking each pipeline center image data with the GPS timing signal at the corresponding moment; Arranging the pipeline center image data in chronological order according to the GPS timing signal of the pipeline center image data to obtain initial second image time series data; According to a preset time interval, the initial second image time series data is interpolated and reconstructed using a cubic spline interpolation method to construct the second image time series data with equal time intervals.
[0010] The embodiment of the present application provides a method for acquiring second image timing data, which introduces an active excitation light-fluorescence imaging mechanism in the process of acquiring image data, and constructs a specific detection channel for biological pollution characteristics. Through the combination design of preset wavelength excitation light irradiation and preset waveband fluorescence acquisition, background light interference can be effectively inhibited in a closed pipeline water environment, so that the imaging stability is not affected by the change of water flow velocity, the signal fluctuation problem of the traditional optical detection method under dynamic hydraulic conditions is solved, and the method is particularly suitable for concentration monitoring of fluorescent substances such as algal metabolites, and the accuracy of subsequent water quality change prediction is improved.
[0011] In a possible implementation manner, the feature extraction on the first image timing data comprises: segmenting a rust area from the first image timing data based on an image recognition technology to generate each pipeline inner wall rust image corresponding to each pipeline inner wall image data; respectively calculating an area coverage rate and an edge fractal dimension of each pipeline inner wall rust image according to each pipeline inner wall image data; constructing the pipeline inner wall rust change feature according to the change trend of the area coverage rate and the edge fractal dimension over time.
[0012] The embodiment of the present application provides a pipeline inner wall rust change feature extraction method, which accurately segments a rust area in each image through an image recognition technology, and quantitatively represents a rusting feature by using an area coverage rate and an edge fractal dimension double-parameter system. The area coverage rate reflects the change trend of the rusting scale, and the edge fractal dimension quantifies the irregular degree of the rust shape, and the combination of the two can distinguish different corrosion stages (such as active oxidation period and passivation peeling period), so that the corresponding pipeline inner wall rust change feature can be more accurately extracted from the first image timing data, and the accuracy of subsequent water quality change prediction is ensured.
[0013] In a possible implementation manner, the feature extraction on the second image timing data comprises: performing binaryzation processing on the second image timing data by using an Otsu algorithm to generate a binary image corresponding to each pipeline center image data; calculating an average gray value of each binary image; generating a metabolite concentration value corresponding to each pipeline center image data according to the average gray value of each binary image and a preset gray-concentration mapping model, the gray-concentration mapping model being obtained by fitting a least square method according to a plurality of different concentrations of algal metabolite solutions and a plurality of corresponding binary images; According to the change trend of the metabolite concentration value over time, the fluorescence change characteristics of the pipeline center are constructed.
[0014] This embodiment of the present application provides a method for extracting fluorescence variation features from the center of a pipeline. By combining the binarization processing of the Otsu algorithm with a pre-built grayscale-concentration mapping model, a digital transformation path for converting fluorescence image data into biological contamination concentration is constructed, achieving data conversion from the image dimension to the biological feature dimension. The feature extraction method provided in this embodiment of the application effectively converts visual information into numerical features that can be used in model training, compensating for the subjective shortcomings of traditional manual interpretation methods, providing richer reference data for subsequent water quality change predictions, and improving the accuracy of water quality change predictions.
[0015] Furthermore, the water quality change prediction model predicts the water quality change trend of the target pipeline based on the multimodal time series data, and then outputs the corresponding water quality change prediction result, including: Based on the multi-head attention mechanism, weight is assigned to each modality in the multimodal time series data to determine the corresponding weight of each modality; Inputting the water quality sensor time series data in the multimodal time series data into a bidirectional LSTM network, so that the bidirectional LSTM network captures the forward and reverse time-dependent features respectively, and then outputs the corresponding bidirectional hidden state sequence; Based on the corresponding weights of each modality, the bidirectional hidden state sequence, the rust spot change characteristics of the pipeline inner wall, and the fluorescence change characteristics of the pipeline center are weightedly spliced to obtain a fusion feature vector; Inputting the fused feature vector into a stacked LSTM layer so that the stacked LSTM layer outputs a final hidden state sequence, wherein the stacked LSTM layer is constructed by sequentially connecting multiple LSTM layers in series, and in the stacked LSTM layer, the output data of each LSTM layer serves as the input data of the next LSTM layer; The final hidden state sequence is mapped to a preset prediction space through a fully connected layer, and the predicted values of water quality parameters for several future time steps are output; According to the predicted values of each water quality parameter and the preset threshold, the corresponding water quality change prediction result is output.
[0016] The embodiment of the present application provides a method for predicting water quality changes within a model, integrating a multi-head attention mechanism, a bidirectional LSTM network, and a stacked LSTM layer into a water quality change prediction model, forming a hybrid architecture for multimodal data, and realizing dynamic feature fusion of multimodal data and multi-step water quality parameter prediction. Among them, the multi-head attention mechanism is used to evaluate the importance of each mode in the multimodal time series data and perform weight assignment, the bidirectional LSTM network is used to capture the forward time series dependency and reverse historical association of the sensor data respectively, and the stacked structure enhances the feature abstraction capability through multi-layer nonlinear transformation, effectively adapts the input multimodal time series data, and improves the accuracy of the prediction results. In addition, the embodiment of the present application uses a weighted splicing strategy in the feature fusion process, so that the model can adaptively adjust the contribution weight of each modal data according to different working conditions, significantly improving the robustness of the prediction model under sudden pollution events.
[0017] In one possible implementation, the training of the initial water quality change prediction model based on the historical time series data set to obtain the water quality change prediction model includes: The initial water quality change prediction model is obtained based on the long short-term memory network, and the initial water quality change prediction model includes a weight distribution layer, a bidirectional LSTM network layer, a feature fusion layer, a stacked LSTM layer and a fully connected layer; Construct a loss function based on mean squared error and attention weight regularization term; Obtain historical time series data sets of pipelines in several high-rise buildings and the corresponding water quality change data, and then construct a labeled training data set; Training the initial water quality change prediction model according to the training data set and the loss function to obtain a number of model parameters; The initial water quality change prediction model is updated according to the several model parameters to obtain the water quality change prediction model.
[0018] This embodiment of the present application provides a training method for a water quality change prediction model. Based on a composite loss function of mean square error and attention weight regularization, the model's prediction accuracy and feature selection preferences are simultaneously optimized during model training. The regularization constraint mechanism effectively prevents the model from over-relying on certain features, thereby enhancing the robustness of the water quality change prediction model. During the construction of the training dataset, historical time series datasets of different high-rise buildings are used to construct the training dataset, effectively alleviating the performance degradation caused by data distribution offset. This allows the trained water quality change prediction model to be deployed simultaneously in multiple building scenarios, improving the model's applicability and ease of deployment across building scenarios.
[0019] In a second aspect, accordingly, an embodiment of the present application provides a high-rise building water quality change prediction system based on image recognition, comprising an acquisition module, an image feature extraction module, a multimodal fusion module, a prediction module, and an early warning module; The acquisition module is used to acquire a time series data set of a preset time period of the target pipe, and the time series data set includes first image time series data, second image time series data, and water quality sensor time series data of the preset time period of the target water pipe, wherein the first image time series data is constructed based on the pipe inner wall image data of the target water pipe at multiple moments, and the second image time series data is constructed based on the pipe center image data of the target water pipe at multiple moments; The image feature extraction module is used to extract features from the first image time series data and the second image time series data respectively to obtain corresponding pipeline inner wall rust spot change features and pipeline center fluorescence change features; The multimodal fusion module is used to perform multimodal fusion on the change characteristics of the rust spots on the inner wall of the pipeline, the change characteristics of the fluorescence in the center of the pipeline, and the time series data of the water quality sensor to obtain multimodal time series data; The prediction module is used to input the multimodal time series data into a preset water quality change prediction model, so that the water quality change prediction model predicts the water quality change trend of the target pipeline according to the multimodal time series data, and then outputs a corresponding water quality change prediction result; The early warning module is used to generate a corresponding early warning signal according to the water quality change prediction result; The water quality change prediction model is obtained by training an initial water quality change prediction model based on a historical time series data set, and the initial water quality change prediction model is constructed based on a long short-term memory network.
[0020] Furthermore, the water quality change prediction model predicts the water quality change trend of the target pipeline based on the multimodal time series data, and then outputs the corresponding water quality change prediction result, including: Based on the multi-head attention mechanism, weight is assigned to each modality in the multimodal time series data to determine the corresponding weight of each modality; Inputting the water quality sensor time series data in the multimodal time series data into a bidirectional LSTM network, so that the bidirectional LSTM network captures the forward and reverse time-dependent features respectively, and then outputs the corresponding bidirectional hidden state sequence; Based on the corresponding weights of each modality, the bidirectional hidden state sequence, the rust spot change characteristics of the pipeline inner wall, and the fluorescence change characteristics of the pipeline center are weightedly spliced to obtain a fusion feature vector; Inputting the fused feature vector into a stacked LSTM layer so that the stacked LSTM layer outputs a final hidden state sequence, wherein the stacked LSTM layer is constructed by sequentially connecting multiple LSTM layers in series, and in the stacked LSTM layer, the output data of each LSTM layer serves as the input data of the next LSTM layer; The final hidden state sequence is mapped to a preset prediction space through a fully connected layer, and the predicted values of water quality parameters for several future time steps are output; According to the predicted values of each water quality parameter and the preset threshold, the corresponding water quality change prediction result is output.
[0021] Furthermore, the water quality change prediction system also includes a model training module, which is used to train the initial water quality change prediction model according to the historical time series data set to obtain the water quality change prediction model, including a model construction unit, a loss function construction unit, a training data acquisition unit, a training unit and a model update unit; The model construction unit is used to obtain the initial water quality change prediction model based on the long short-term memory network, and the initial water quality change prediction model includes a weight distribution layer, a bidirectional LSTM network layer, a feature fusion layer, a stacked LSTM layer and a fully connected layer; The loss function construction unit is used to construct a loss function based on a mean square error and an attention weight regularization term; The training data acquisition unit is used to acquire historical time series data sets and corresponding water quality change data of pipelines in several high-rise buildings, and then construct a labeled training data set; The training unit is used to train the initial water quality change prediction model according to the training data set and the loss function to obtain a number of model parameters; The model updating unit is used to update the initial water quality change prediction model according to the several model parameters to obtain the water quality change prediction model. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flowchart of a method for predicting water quality changes in high-rise buildings based on image recognition provided in an embodiment of the present application; Figure 2 A schematic diagram of the model architecture of a method for predicting water quality changes in high-rise buildings based on image recognition provided in an embodiment of the present application; Figure 3 A schematic structural diagram of a high-rise building water quality change prediction system based on image recognition provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0024] It should be noted that the step numbers herein are for convenience of explanation of the specific embodiments and do not serve to define the order in which the steps are to be performed. In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature designated "first" or "second" may explicitly or implicitly include one or more of such features.
[0025] Example 1: like Figure 1 As shown, embodiment 1 provides a method for predicting water quality changes in high-rise buildings based on image recognition, including steps S1-S5: Step S1: Acquire a time series data set for a preset time period of a target water pipe, wherein the time series data set includes first image time series data, second image time series data, and water quality sensor time series data for the preset time period of the target water pipe, wherein the first image time series data is constructed based on image data of the inner wall of the target water pipe at multiple moments, and the second image time series data is constructed based on image data of the center of the target water pipe at multiple moments; Step S2: performing feature extraction on the first image time series data and the second image time series data respectively to obtain corresponding pipeline inner wall rust spot change features and pipeline center fluorescence change features; Step S3, performing multimodal fusion on the rust spot change characteristics of the inner wall of the pipeline, the fluorescence change characteristics of the center of the pipeline, and the time series data of the water quality sensor to obtain multimodal time series data; Step S4: inputting the multimodal time series data into a preset water quality change prediction model, so that the water quality change prediction model predicts the water quality change trend of the target pipeline according to the multimodal time series data, and then outputs a corresponding water quality change prediction result; Step S5: generating a corresponding early warning signal according to the water quality change prediction result; The water quality change prediction model is obtained by training an initial water quality change prediction model based on a historical time series data set, and the initial water quality change prediction model is constructed based on a long short-term memory network.
[0026] The embodiment of the present application provides a method for predicting water quality changes in high-rise buildings based on image recognition. By extracting image features from a number of image data and combining them with sensor data to construct a multimodal time series data set including images of rust spots on the inner wall of the pipe, fluorescence images of the center of the pipe, and sensor data, the method breaks through the limitations of traditional single-point sensor monitoring in the dimension of pollution feature perception, allowing the water quality change prediction model to comprehensively predict the water quality changes of the target pipe from multiple dimensions, thereby improving the accuracy of water quality change prediction. Furthermore, the embodiment of the present application uses a long-short-term memory network to construct a prediction model, which can effectively capture the temporal evolution law of water quality sensor data and combine it with the change law of rust spots on the inner wall of the pipe and the change law of algae in the water, so that the prediction model has the ability to early identify complex water quality risks such as heavy metal precipitation and excessive microorganisms. As the last link in the residential water supply system, the secondary water supply system of high-rise buildings needs this early identification capability to ensure the safety of residents' water use. Compared with existing single-modal water quality detection or prediction technologies, the water quality change prediction method based on multimodal data provided in this embodiment significantly improves the timeliness of prediction of water quality mutation events and the risk tracing capability, thereby improving the water supply safety of the secondary water supply system of high-rise buildings.
[0027] In a preferred embodiment, the water quality sensor time series data is collected through an integrated multi-parameter sensor array, and the water quality sensor time series data includes the residual chlorine value, turbidity value, value and pH value.
[0028] Furthermore, in step S1, constructing and obtaining the first image time series data based on the pipe inner wall image data of the target water pipe at multiple moments includes: Acquire pipeline inner wall image data of the target water pipe at multiple times through an optical imaging device at a first preset position of the target water pipe, and mark each pipeline inner wall image data with a GPS timing signal at a corresponding time; Arranging the pipeline inner wall image data in time sequence according to the GPS timing signal of the pipeline inner wall image data to obtain initial first image time series data; According to a preset time interval, the initial first image time series data is interpolated and reconstructed using a cubic spline interpolation method to construct the first image time series data with equal time intervals.
[0029] This embodiment of the present application provides a method for acquiring time-series data from first images. This method uses a fixed-position optical imaging device to capture continuous time-series images, forming a stable spatial reference coordinate system that enables comparable morphological analysis of corroded areas. Finally, using cubic spline interpolation to construct time-series data from first images at equal time intervals, this method accurately captures the progression of rust from pitting to general corrosion. This provides a reliable time-series imaging basis for predicting the changing trend of rust on pipeline inner walls, while also providing standardized input data for subsequent model predictions, improving the accuracy of model predictions.
[0030] In a preferred embodiment, a 4K endoscopic imager is deployed at the first preset position of the pipeline, equipped with a ring-shaped LED fill light system. In the process of acquiring the pipeline inner wall image data, the current GPS timestamp is attached to each frame of the image, so that each frame of the image is accompanied by time information. After arranging the individual inner wall image data in chronological order, the initial first image time series data is reconstructed using the cubic spline interpolation method. The cubic spline interpolation constructs a piecewise cubic polynomial between adjacent data points to ensure that the first-order and second-order derivatives of the interpolation function are continuous at the nodes, thereby generating a smooth time series. The mathematical form is: S(t) = a i (tt i ) 3 +b i (tt i ) 2 +c i (tt i )+d i , t∈[t i , t i +1]; The coefficient a i 、b i 、c i d i By boundary conditions (such as natural splines: ) and continuity constraint solving. In the embodiment of the present application, the specific process of reconstructing each image data using the cubic spline interpolation method is as follows: 1. Data preprocessing. Analyze the absolute timestamp of each image (such as UTC time) from the GPS timing signal and convert it into a unified time unit (such as seconds or milliseconds), so that each image is accompanied by a time value. At the same time, normalize the pixel values of each image (such as RGB or grayscale values) to a unified range (such as [0,1]) to reduce the impact of lighting or sensor differences. Based on the time values and pixel values corresponding to each image, construct the original time series t original =[t1,t2,…,t N ] and pixel value sequence v original =[v1,v2,…,v NThen, according to the preset time interval, a uniform time point sequence t covering the original time range is generated. new =[t0,t0+Δt,t0+2Δt,…,t end ] Since the evolution of rust spots is a long-time process, the time interval Δt is set to 4 hours in the embodiment of the present application, that is, the time interval between adjacent images in the final first image time series data is 4 hours.
[0031] 2. Interpolation reconstruction. For each pixel (h, w, c) in each pipe inner wall image data, based on t original and v original Fitting to obtain cubic spline function Sh , w , c ( t ). The cubic spline function is used to calculate the uniform time point sequence t new Interpolation everywhere: v new (h,w,c) (t new,k ) = Sh , w , c ( t new,k ), where t new,k represents the time point corresponding to the kth position in the uniform time point sequence, v new (h,w,c) (t new,k ) represents the pixel value corresponding to the pixel point (h, w, c) of the kth image in the uniform time point sequence after interpolation reconstruction, where (h, w) represents the pixel position in the image and c represents the channel (such as R / G / B) of the pixel position. According to the above equation, each t in the uniform time point sequence is new,k Substitute the cubic spline function to implement interpolation calculation for all pixel positions and channels to generate the complete first image time series data.
[0032] Furthermore, in step S1, constructing and obtaining the second image time series data based on the pipeline center image data of the target water pipe at multiple moments includes: When the pipeline inner wall image data is acquired, the active imaging device uses excitation light of a preset wavelength to illuminate a second preset position of the target water pipe, and simultaneously captures a fluorescence image of a preset wavelength band at the second preset position, thereby obtaining pipeline center image data of the target water pipe at multiple moments, and marking each pipeline center image data with the GPS timing signal at the corresponding moment; Arranging the pipeline center image data in chronological order according to the GPS timing signal of the pipeline center image data to obtain initial second image time series data; According to a preset time interval, the initial second image time series data is interpolated and reconstructed using a cubic spline interpolation method to construct the second image time series data with equal time intervals.
[0033] The present embodiment provides a method for acquiring time-series data of a second image. This method incorporates an active excitation light-fluorescence imaging mechanism during the image data acquisition process, constructing a specific detection channel for biological contamination characteristics. Through the combined design of excitation light illumination at a preset wavelength and fluorescence acquisition at a preset wavelength, the method effectively suppresses background light interference even in a closed pipe water environment, ensuring that imaging stability is unaffected by changes in water flow velocity. This method addresses the signal fluctuation issues of traditional optical detection methods under dynamic hydraulic conditions. The method is particularly suitable for monitoring the concentration of fluorescent substances such as algal metabolites, improving the accuracy of subsequent predictions of water quality changes.
[0034] In a preferred embodiment, an active imaging device is deployed at a second preset position on the pipeline, comprising a 405nm laser excitation source and a 520±10nm bandpass filter. The active imaging device is connected to the optical imaging device via Bluetooth to exchange data. When the optical imaging device is about to begin acquiring pipeline inner wall image data, a synchronization signal is sent to the active imaging device, causing the active imaging device to synchronously acquire pipeline center image data and tag each pipeline center image data with the corresponding GPS timing signal. Similarly, the GPS timing signal of each pipeline center image data is converted into a unified time unit, thereby assigning a time value to each pipeline center image data. The images are then arranged based on the time value to obtain initial second image time series data. Similar to the processing of the initial first image time series data, the initial second image time series data is also interpolated and reconstructed using the cubic spline interpolation method to construct second image time series data at 4-hour intervals.
[0035] In one possible implementation, in step S2, extracting features from the first image time series data to obtain corresponding rust spot change features on the inner wall of the pipeline includes: Segmenting the rust spot area from the first image time series data based on image recognition technology to generate each pipeline inner wall rust spot image corresponding to each pipeline inner wall image data; Calculating the area coverage and edge fractal dimension of each rust spot image on the inner wall of the pipeline according to the image data of each pipeline inner wall; According to the changing trends of the area coverage and the edge fractal dimension over time, the changing characteristics of the rust spots on the inner wall of the pipeline are constructed.
[0036] This embodiment of the present application provides a method for extracting the changing characteristics of rust spots on the inner wall of a pipeline. This method uses image recognition technology to accurately segment the rust spots in each image and quantitatively characterizes the rust characteristics using a dual-parameter system: area coverage and edge fractal dimension. The area coverage reflects the changing trend of the rust scale, while the edge fractal dimension quantifies the irregularity of the rust spot morphology. Their combined application distinguishes different corrosion stages (such as the active oxidation phase and the passivation and stripping phase), allowing for more accurate extraction of the corresponding rust spot changing characteristics on the inner wall of the pipeline from the time series data of the first image, ensuring the accuracy of subsequent predictions of water quality changes.
[0037] In a preferred embodiment, in step S2, an improved U-Net network is used to segment the rust spot regions from the first image time series data to obtain images of rust spots on the inner wall of each pipe. Based on the number of rust spots pixels in each image and the number of pixels in the corresponding image data, the area coverage of each image of rust spots on the inner wall of the pipe is calculated. Simultaneously, the fractal dimension of each image of rust spots on the inner wall of the pipe is calculated using the box counting method. The specific process for calculating the fractal dimension of a particular image of rust spots on the inner wall of the pipe using the box counting method is as follows: 1. Divide the pipe inner wall image into several square grids with a side length of m.
[0038] 2. Count the number of grids N (m) covered by the rust spot outline of the corresponding rust spot image on the inner wall of the pipeline.
[0039] 3. Repeat for different values of m (e.g. 1, 2, 4, 8, 16 pixels) and record different N(m).
[0040] 4 Fit each log(N(m)) and log(1 / m) through linear regression, and the slope is the fractal dimension D Finally, based on the temporal trends of the area coverage and edge fractal dimension, the pipeline inner wall rust spot change characteristics are constructed. Each pipeline inner wall rust spot change characteristic specifically includes the corresponding pipeline inner wall rust spot area coverage, the growth rate of the pipeline inner wall rust spot area coverage, the pipeline inner wall rust spot fractal dimension, the rate of change of the pipeline inner wall rust spot fractal dimension, and a stage code, wherein the stage code is determined based on the fractal dimension of the current pipeline inner wall rust spot image, for example:
[0041] In one possible implementation, in step S2, extracting features from the second image time series data to obtain corresponding pipeline center fluorescence change features includes: Binarization is performed on the second image time series data using the Otsu algorithm to generate a binary image corresponding to the center image data of each pipeline; Calculating and obtaining the average grayscale value of each of the binarized images; Generating a metabolite concentration value corresponding to each pipeline center image data based on the average grayscale value of each of the binarized images and a preset grayscale-concentration mapping model, wherein the grayscale-concentration mapping model is constructed using least squares fitting based on a plurality of algae metabolite solutions of different concentrations and a plurality of corresponding binarized images; According to the change trend of the metabolite concentration value over time, the fluorescence change characteristics of the pipeline center are constructed.
[0042] This embodiment of the present application provides a method for extracting fluorescence variation features from the center of a pipeline. By combining the binarization processing of the Otsu algorithm with a pre-built grayscale-concentration mapping model, a digital transformation path for converting fluorescence image data into biological contamination concentration is constructed, achieving data conversion from the image dimension to the biological feature dimension. The feature extraction method provided in this embodiment of the application effectively converts visual information into numerical features that can be used in model training, compensating for the subjective shortcomings of traditional manual interpretation methods, providing richer reference data for subsequent water quality change predictions, and improving the accuracy of water quality change predictions.
[0043] In a preferred embodiment, in step S2, the grayscale-concentration mapping model is constructed as follows: 1. Calibration experiment: Prepare 6 sets of algae metabolite solutions (concentration range 0-50 mg / L), acquire fluorescence images using the same imaging parameters, and calculate the average grayscale value:
[0044] 2. Model fitting: The least squares method was used to fit the linear model: C = a⋅G + b. The fitting parameters were a = 0.205, b = -3.1, and the coefficient of determination R2 = 0.989.
[0045] After obtaining the grayscale-concentration mapping model, the average grayscale value of each binarized image is substituted into the grayscale-concentration mapping model to calculate the corresponding metabolite concentration value. Finally, based on the concentration values of each metabolite, the corresponding concentration growth rate, overall concentration mean, standard deviation, and maximum value are calculated to construct a feature vector, i.e., the fluorescence change characteristic of the pipeline center.
[0046] Furthermore, in step S4, the water quality change prediction model predicts the water quality change trend of the target pipeline based on the multimodal time series data, and then outputs a corresponding water quality change prediction result, including: Based on the multi-head attention mechanism, weight is assigned to each modality in the multimodal time series data to determine the corresponding weight of each modality; Inputting the water quality sensor time series data in the multimodal time series data into a bidirectional LSTM network, so that the bidirectional LSTM network captures the forward and reverse time-dependent features respectively, and then outputs the corresponding bidirectional hidden state sequence; Based on the corresponding weights of each modality, the bidirectional hidden state sequence, the rust spot change characteristics of the pipeline inner wall, and the fluorescence change characteristics of the pipeline center are weightedly spliced to obtain a fusion feature vector; Inputting the fused feature vector into a stacked LSTM layer so that the stacked LSTM layer outputs a final hidden state sequence, wherein the stacked LSTM layer is constructed by sequentially connecting multiple LSTM layers in series, and in the stacked LSTM layer, the output data of each LSTM layer serves as the input data of the next LSTM layer; The final hidden state sequence is mapped to a preset prediction space through a fully connected layer, and the predicted values of water quality parameters for several future time steps are output; According to the predicted values of each water quality parameter and the preset threshold, the corresponding water quality change prediction result is output.
[0047] The embodiment of the present application provides a method for predicting water quality changes within a model, integrating a multi-head attention mechanism, a bidirectional LSTM network, and a stacked LSTM layer into a water quality change prediction model, forming a hybrid architecture for multimodal data, and realizing dynamic feature fusion of multimodal data and multi-step water quality parameter prediction. Among them, the multi-head attention mechanism is used to evaluate the importance of each mode in the multimodal time series data and perform weight assignment, the bidirectional LSTM network is used to capture the forward time series dependency and reverse historical association of the sensor data respectively, and the stacked structure enhances the feature abstraction capability through multi-layer nonlinear transformation, effectively adapts the input multimodal time series data, and improves the accuracy of the prediction results. In addition, the embodiment of the present application uses a weighted splicing strategy in the feature fusion process, so that the model can adaptively adjust the contribution weight of each modal data according to different working conditions, significantly improving the robustness of the prediction model under sudden pollution events.
[0048] In a preferred embodiment, the model architecture of the water quality change prediction model is as follows: Figure 2 As shown, it includes a weight distribution layer, a bidirectional LSTM network layer, a feature fusion layer, a stacked LSTM layer, and a fully connected layer. When multimodal time series data is input into the water quality change prediction model, the data first enters the weight distribution layer. The weight distribution layer assigns weights to each mode in the multimodal time series data based on the multi-head attention mechanism and determines the corresponding weight of each mode. Specifically, for a certain modal time series data, it is input into an independent attention head, and the query matrix Q, key matrix K, and value matrix V are generated through linear transformation. Then, the corresponding attention weight is calculated based on these three matrices: Q= XWJ , K = XWK , V = XWV
[0049] in, X ∈R T x d , T is the number of time steps, d is the feature dimension, WQ 、 WK 、 WV Based on the above formula, the corresponding weight of the modal time series data is obtained by parallel output of four independent attention heads and then merging the attention weights of the four independent attention heads through linear transformation: Head i = Attention(Q i ,K i ,V i ); MultiHead(Q,K,V) = Concat(Head1,...,Head4)W O ; In one possible case, the result after weight distribution is sensor data: 0.35, rust feature: 0.40, fluorescence feature: 0.25.
[0050] Since the water quality sensor time series data has not undergone feature extraction before being input into the model, the bidirectional LSTM network captures the forward and reverse time-dependent features of the water quality sensor time series data within the model, and then outputs the corresponding bidirectional hidden state sequence. The specific formula is as follows: Forward propagation:
[0051] Backward Propagation:
[0052] Bidirectional hidden state:
[0053] Among them, h t is the bidirectional hidden state at time t in the water quality sensor time series data, is the positive time-dependent feature at time t in the water quality sensor time series data, is the reverse time-dependent feature at time t in the water quality sensor time series data, LSTM() is the calculation function corresponding to the bidirectional LSTM network, is the original data at time t in the water quality sensor time series data.
[0054] Then, the bidirectional hidden state sequence, the pipe inner wall rust spot change feature, and the pipe center fluorescence change feature are weighted and spliced to obtain a fusion feature vector, and a specific formula is as follows: ; wherein, a, b, g are the corresponding attention weights of each mode, and a+b+g=1.
[0055] Finally, the feature dimension of the fusion feature vector is reduced layer by layer through a stacked LSTM layer to obtain a final hidden state sequence of a preset dimension, and the final hidden state sequence is mapped to a preset prediction space through a fully connected layer to output water quality parameter prediction values of future time steps.
[0056] In a possible implementation manner, the water quality change prediction model is obtained by training an initial water quality change prediction model according to a historical time series data set, and the method comprises the following steps. The initial water quality change prediction model is obtained based on a long short-term memory network, and the initial water quality change prediction model comprises a weight distribution layer, a bidirectional LSTM network layer, a feature fusion layer, a stacked LSTM layer, and a fully connected layer. A loss function is constructed based on a mean square error and an attention weight regularization term. A historical time series data set and corresponding water quality change data of pipes in a plurality of high-rise buildings are acquired to construct a labeled training data set. The initial water quality change prediction model is trained according to the training data set and the loss function to obtain a plurality of model parameters. The initial water quality change prediction model is updated according to the plurality of model parameters to obtain the water quality change prediction model.
[0057] The embodiments of the present application provide a training method of a water quality change prediction model, a compound loss function based on a mean square error and an attention weight regularization term is used to simultaneously optimize the prediction accuracy and feature selection tendency of the model in the model training process, wherein the regularization term constraint mechanism can effectively prevent the model from excessively relying on a certain type of feature, and enhance the robustness of the water quality change prediction model. In the construction process of the training data set, the historical time series data sets of different high-rise buildings are used to construct the training data set, which can effectively alleviate the performance degradation problem caused by data distribution deviation, so that the water quality change prediction model trained can be deployed in multiple building scenarios, and the migration applicability and deployment convenience of the model across building scenarios are improved.
[0058] In a preferred embodiment, the training process of the water quality change prediction model is as follows: 1. Model architecture design Initial model construction: An initial water quality change prediction model is constructed based on a long short-term memory network (LSTM), which includes the following modules: weight distribution layer: multi-head attention mechanism (4 attention heads, head dimension 16). Bidirectional LSTM network layer: 64 hidden units, sequence length 50. Feature fusion layer: weighted splicing strategy, fusing sensor data, rust stain features and fluorescence features. Stacked LSTM layer: 3 layers (64→32→16 units), nonlinear transformation to enhance feature abstraction ability. Fully connected layer: mapped to a 24-dimensional output space (predicting future 24-hour parameters).
[0059] Model parameter initialization: weight matrix: Xavier initialization (mean 0, variance 1). Bias term: initialized to 0.
[0060] 2. Loss function construction Mean squared error (MSE) term: measures the difference between predicted values and true values .
[0061] Attention weight regularization term: prevents the model from relying too much on a single modality, used to constrain the attention weight distribution:
[0062] where α, β, γ are the weights of sensor data, rust stain features and fluorescence features, λ = μ = ν = 0.3 (optimal value determined by ablation experiment).
[0063] The composite loss function is obtained:
[0064] 3. Training data acquisition and preprocessing Historical data set construction: Collecting pipe monitoring data from 5 high-rise buildings (building height 80-150 meters), covering different materials (galvanized steel pipe, stainless steel pipe, PE pipe) and pollution types (rust dominant, algae outbreak).
[0065] Data range: Time span from 2021 to 2023, a total of 720 days.
[0066] Data entries: 6 groups of multi-modal data are generated daily for each building (corresponding to a 4-hour preset time interval).
[0067] Data labeling: Turbidity > 1.0 NTU and residual chlorine < 0.3 mg / L, marked as red warning (label = 2).
[0068] Turbidity > 1.0 NTU or residual chlorine < 0.3 mg / L, marked as yellow warning (label = 1).
[0069] Normal operating conditions are marked as no warning (label = 0).
[0070] Data partitioning: Training set: 80% (576 days), used for model parameter updates; Validation set: 15% (108 days), used for hyperparameter tuning; Test set: 5% (36 days), used for final performance evaluation.
[0071] 4. Model Training Process Training parameter settings: Optimizer: Adam (learning rate 1e-3, weight decay 1e-5).
[0072] Batch size: 32 (each batch contains data for 32 consecutive time windows).
[0073] Training epochs: 200 (early stopping mechanism: terminate when validation set loss does not improve for 10 consecutive epochs).
[0074] After completing the above preparation process, the initial water quality change prediction model is trained according to the training data set and the loss function to obtain the water quality change prediction model.
[0075] Example 2: like Figure 3 As shown, embodiment 2 provides a high-rise building water quality change prediction system based on image recognition, including an acquisition module 10, an image feature extraction module 20, a multimodal fusion module 30, a prediction module 40 and an early warning module 50; The acquisition module 10 is used to acquire a time series data set of a preset time period of the target pipe, and the time series data set includes first image time series data, second image time series data, and water quality sensor time series data of the preset time period of the target water pipe, wherein the first image time series data is constructed based on the pipe inner wall image data of the target water pipe at multiple moments, and the second image time series data is constructed based on the pipe center image data of the target water pipe at multiple moments; The image feature extraction module 20 is used to extract features from the first image time series data and the second image time series data respectively to obtain corresponding pipeline inner wall rust spot change features and pipeline center fluorescence change features; The multimodal fusion module 30 is used to perform multimodal fusion on the change characteristics of the rust spots on the inner wall of the pipeline, the change characteristics of the fluorescence in the center of the pipeline, and the time series data of the water quality sensor to obtain multimodal time series data; The prediction module 40 is used to input the multimodal time series data into a preset water quality change prediction model, so that the water quality change prediction model predicts the water quality change trend of the target pipeline according to the multimodal time series data, and then outputs a corresponding water quality change prediction result; The early warning module 50 is used to generate a corresponding early warning signal according to the water quality change prediction result; The water quality change prediction model is obtained by training an initial water quality change prediction model based on a historical time series data set, and the initial water quality change prediction model is constructed based on a long short-term memory network.
[0076] The embodiment of the present application provides a high-rise building water quality change prediction system based on image recognition. By extracting image features from a number of image data and combining them with sensor data to construct a multimodal time series data set including images of rust spots on the inner wall of the pipe, fluorescence images of the center of the pipe, and sensor data, the system breaks through the limitations of traditional single-point sensor monitoring in the dimension of pollution feature perception, allowing the water quality change prediction model to comprehensively predict the water quality changes of the target pipe from multiple dimensions, thereby improving the accuracy of water quality change prediction. Furthermore, the embodiment of the present application uses a long-short-term memory network to construct a prediction model, which can effectively capture the temporal evolution law of water quality sensor data and combine it with the change law of rust spots on the inner wall of the pipe and the change law of algae in the water, so that the prediction model has the ability to early identify complex water quality risks such as heavy metal precipitation and excessive microorganisms. As the last link in the residential water supply system, the secondary water supply system of high-rise buildings needs this early identification capability to ensure the safety of residents' water use. Compared with existing single-modal water quality detection or prediction technologies, the water quality change prediction method based on multimodal data provided in this embodiment significantly improves the timeliness of prediction of water quality mutation events and the risk tracing capability, thereby improving the water supply safety of the secondary water supply system of high-rise buildings.
[0077] The more detailed working principle and process flow of this embodiment can be referred to, but not limited to, the relevant records of the first embodiment.
[0078] The specific embodiments described above further illustrate the objectives, technical solutions, and beneficial effects of this application. It should be understood that the above descriptions are merely specific embodiments of this application and are not intended to limit the scope of protection of this application. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this application by those skilled in the art should be included within the scope of protection of this application.
Claims
1. A method for predicting water quality changes in high-rise buildings based on image recognition, characterized in that: include: Acquire a time series data set for a preset time period of the target water pipe, the time series data set including first image time series data, second image time series data, and water quality sensor time series data for the preset time period of the target water pipe, wherein the first image time series data is constructed based on image data of the inner wall of the target water pipe at multiple moments, and the second image time series data is constructed based on image data of the center of the target water pipe at multiple moments; Perform feature extraction on the first image time series data and the second image time series data respectively to obtain corresponding pipeline inner wall rust spot change features and pipeline center fluorescence change features; Perform multimodal fusion on the rust spot change characteristics of the inner wall of the pipeline, the fluorescence change characteristics of the center of the pipeline, and the time series data of the water quality sensor to obtain multimodal time series data; Inputting the multimodal time series data into a preset water quality change prediction model, so that the water quality change prediction model predicts the water quality change trend of the target pipeline according to the multimodal time series data, and then outputs a corresponding water quality change prediction result; generating corresponding early warning signals according to the water quality change prediction results; The water quality change prediction model is obtained by training an initial water quality change prediction model based on a historical time series data set, and the initial water quality change prediction model is constructed based on a long short-term memory network.
2. The method for predicting water quality changes in high-rise buildings based on image recognition according to claim 1, characterized in that: The step of constructing and obtaining the first image time series data based on the pipe inner wall image data of the target water pipe at multiple moments includes: Acquire pipeline inner wall image data of the target water pipe at multiple times through an optical imaging device at a first preset position of the target water pipe, and mark each pipeline inner wall image data with a GPS timing signal at a corresponding time; Arranging the pipeline inner wall image data in time sequence according to the GPS timing signal of the pipeline inner wall image data to obtain initial first image time series data; According to a preset time interval, the initial first image time series data is interpolated and reconstructed using a cubic spline interpolation method to construct the first image time series data with equal time intervals.
3. The method for predicting water quality changes in high-rise buildings based on image recognition according to claim 2, characterized in that: The step of constructing and obtaining the second image time series data based on the pipeline center image data of the target water pipe at multiple moments includes: When the pipeline inner wall image data is acquired, the active imaging device uses excitation light of a preset wavelength to illuminate a second preset position of the target water pipe, and simultaneously captures a fluorescence image of a preset wavelength band at the second preset position, thereby obtaining pipeline center image data of the target water pipe at multiple moments, and marking each pipeline center image data with the GPS timing signal at the corresponding moment; Arranging the pipeline center image data in chronological order according to the GPS timing signal of the pipeline center image data to obtain initial second image time series data; According to a preset time interval, the initial second image time series data is interpolated and reconstructed using a cubic spline interpolation method to construct the second image time series data with equal time intervals.
4. The method for predicting water quality changes in high-rise buildings based on image recognition according to claim 1, characterized in that: The extracting features of the first image time series data to obtain corresponding rust spot change features on the inner wall of the pipeline includes: Segmenting the rust spot area from the first image time series data based on image recognition technology to generate each pipeline inner wall rust spot image corresponding to each pipeline inner wall image data; Calculating the area coverage and edge fractal dimension of each rust spot image on the inner wall of the pipeline according to the image data of each pipeline inner wall; According to the changing trends of the area coverage and the edge fractal dimension over time, the changing characteristics of the rust spots on the inner wall of the pipeline are constructed.
5. The method for predicting water quality changes in high-rise buildings based on image recognition according to claim 1, characterized in that: The extracting features of the second image time series data to obtain corresponding pipeline center fluorescence change features includes: Binarization is performed on the second image time series data using the Otsu algorithm to generate a binary image corresponding to the center image data of each pipeline; Calculating and obtaining the average grayscale value of each of the binarized images; Generating a metabolite concentration value corresponding to each pipeline center image data based on the average grayscale value of each of the binarized images and a preset grayscale-concentration mapping model, wherein the grayscale-concentration mapping model is constructed using least squares fitting based on a plurality of algae metabolite solutions of different concentrations and a plurality of corresponding binarized images; According to the change trend of the metabolite concentration value over time, the fluorescence change characteristics of the pipeline center are constructed.
6. The method for predicting water quality changes in high-rise buildings based on image recognition according to claim 1, characterized in that: The water quality change prediction model predicts the water quality change trend of the target pipeline based on the multimodal time series data, and then outputs the corresponding water quality change prediction result, including: Based on the multi-head attention mechanism, weight is assigned to each modality in the multimodal time series data to determine the corresponding weight of each modality; Inputting the water quality sensor time series data in the multimodal time series data into a bidirectional LSTM network, so that the bidirectional LSTM network captures the forward and reverse time-dependent features respectively, and then outputs the corresponding bidirectional hidden state sequence; Based on the corresponding weights of each modality, the bidirectional hidden state sequence, the rust spot change characteristics of the pipeline inner wall, and the fluorescence change characteristics of the pipeline center are weightedly spliced to obtain a fusion feature vector; Inputting the fused feature vector into a stacked LSTM layer so that the stacked LSTM layer outputs a final hidden state sequence, wherein the stacked LSTM layer is constructed by sequentially connecting multiple LSTM layers in series, and in the stacked LSTM layer, the output data of each LSTM layer serves as the input data of the next LSTM layer; The final hidden state sequence is mapped to a preset prediction space through a fully connected layer, and the predicted values of water quality parameters for several future time steps are output; According to the predicted values of each water quality parameter and the preset threshold, the corresponding water quality change prediction result is output.
7. A method for predicting water quality changes in high-rise buildings based on image recognition according to any one of claims 1 to 6, characterized in that: The water quality change prediction model is obtained by training the initial water quality change prediction model according to the historical time series data set, including: The initial water quality change prediction model is obtained based on the long short-term memory network, and the initial water quality change prediction model includes a weight distribution layer, a bidirectional LSTM network layer, a feature fusion layer, a stacked LSTM layer and a fully connected layer; Construct a loss function based on mean squared error and attention weight regularization term; Obtain historical time series data sets of pipelines in several high-rise buildings and the corresponding water quality change data, and then construct a labeled training data set; Training the initial water quality change prediction model according to the training data set and the loss function to obtain a number of model parameters; The initial water quality change prediction model is updated according to the several model parameters to obtain the water quality change prediction model.
8. A high-rise building water quality change prediction system based on image recognition, characterized in that: It includes acquisition module, image feature extraction module, multimodal fusion module, prediction module and early warning module; The acquisition module is used to acquire a time series data set of a preset time period of the target pipe, and the time series data set includes first image time series data, second image time series data, and water quality sensor time series data of the preset time period of the target water pipe, wherein the first image time series data is constructed based on the pipe inner wall image data of the target water pipe at multiple moments, and the second image time series data is constructed based on the pipe center image data of the target water pipe at multiple moments; The image feature extraction module is used to extract features from the first image time series data and the second image time series data respectively to obtain corresponding pipeline inner wall rust spot change features and pipeline center fluorescence change features; The multimodal fusion module is used to perform multimodal fusion on the change characteristics of the rust spots on the inner wall of the pipeline, the change characteristics of the fluorescence in the center of the pipeline, and the time series data of the water quality sensor to obtain multimodal time series data; The prediction module is used to input the multimodal time series data into a preset water quality change prediction model, so that the water quality change prediction model predicts the water quality change trend of the target pipeline according to the multimodal time series data, and then outputs a corresponding water quality change prediction result; The early warning module is used to generate a corresponding early warning signal according to the water quality change prediction result; The water quality change prediction model is obtained by training an initial water quality change prediction model based on a historical time series data set, and the initial water quality change prediction model is constructed based on a long short-term memory network.
9. The high-rise building water quality change prediction system based on image recognition according to claim 8, characterized in that: The water quality change prediction model predicts the water quality change trend of the target pipeline based on the multimodal time series data, and then outputs the corresponding water quality change prediction result, including: Based on the multi-head attention mechanism, weight is assigned to each modality in the multimodal time series data to determine the corresponding weight of each modality; Inputting the water quality sensor time series data in the multimodal time series data into a bidirectional LSTM network, so that the bidirectional LSTM network captures the forward and reverse time-dependent features respectively, and then outputs the corresponding bidirectional hidden state sequence; Based on the corresponding weights of each modality, the bidirectional hidden state sequence, the rust spot change characteristics of the pipeline inner wall, and the fluorescence change characteristics of the pipeline center are weightedly spliced to obtain a fusion feature vector; Inputting the fused feature vector into a stacked LSTM layer so that the stacked LSTM layer outputs a final hidden state sequence, wherein the stacked LSTM layer is constructed by sequentially connecting multiple LSTM layers in series, and in the stacked LSTM layer, the output data of each LSTM layer serves as the input data of the next LSTM layer; The final hidden state sequence is mapped to a preset prediction space through a fully connected layer, and the predicted values of water quality parameters for several future time steps are output; According to the predicted values of each water quality parameter and the preset threshold, the corresponding water quality change prediction result is output.
10. A high-rise building water quality change prediction system based on image recognition according to claim 8 or 9, characterized in that: The water quality change prediction system further includes a model training module, which is used to train the initial water quality change prediction model according to the historical time series data set to obtain the water quality change prediction model, including a model construction unit, a loss function construction unit, a training data acquisition unit, a training unit, and a model update unit; The model building unit is used to obtain the initial water quality change prediction model based on the long short-term memory network, and the initial water quality change prediction model includes a weight distribution layer, a bidirectional LSTM network layer, a feature fusion layer, a stacked LSTM layer and a fully connected layer; The loss function construction unit is used to construct a loss function based on a mean square error and an attention weight regularization term; The training data acquisition unit is used to acquire historical time series data sets and corresponding water quality change data of pipelines in several high-rise buildings, and then construct a labeled training data set; The training unit is used to train the initial water quality change prediction model according to the training data set and the loss function to obtain a number of model parameters; The model updating unit is used to update the initial water quality change prediction model according to the several model parameters to obtain the water quality change prediction model.
Citation Information
Patent Citations
Water quality state fusion perception and prediction traceability method
CN118070234A
Visual identification system for urban water pollution treatment
CN119888343A
Method and system for determining degree of NAPL contamination in groundwater
WO2024244277A1
System and method of multi-modal multi-task environmental quality forecasting
WO2025030137A1