Self-adaptive block chain water basin monitoring method and system based on intelligent analysis algorithm
By using intelligent analysis algorithms and blockchain technology in the water basin monitoring system, an adaptive water basin analysis network model is built, which solves the problems of low data processing efficiency and poor data security in the existing technology, and achieves efficient, accurate and reliable water basin monitoring.
Patent Information
- Application Number
- CN202411620680.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing water basin monitoring system lacks intelligent data processing capabilities and cannot effectively extract valuable information from massive monitoring data. Due to the lack of support from blockchain technology, there is a risk of tampering during the storage and transmission of monitoring data, which affects the authenticity and reliability of the data.
Adaptive blockchain water basin monitoring method based on intelligent analysis algorithm is adopted. By obtaining new sensor monitoring data in the source and target domains of multiple monitoring sites, monitoring data sequences are extracted using sliding time window and data fusion method, new sample sets are generated, and an adaptive water basin analysis network model based on blockchain distributed ledger and smart contract mechanism is constructed. This model combines graph convolutional neural network (GCN) and long short-term memory network (LSTM).
It improves the processing efficiency and analysis accuracy of water basin monitoring data, enhances the security and immutability of monitoring data, ensures the reliability of monitoring results, and adapts to environmental changes through adaptive learning mechanisms, improving the flexibility and adaptability of monitoring systems.
Smart Images

Figure CN119578457A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent analysis algorithms and blockchain technology, and more specifically, to an adaptive blockchain watershed monitoring method and system based on intelligent analysis algorithms. Background Art
[0002] Existing watershed monitoring technologies mainly rely on traditional sensors and monitoring stations to collect data such as water quality parameters, water level changes, and water flow speed. Although these methods can provide certain monitoring data, they have problems such as low data update frequency, poor real-time performance, and difficulty in ensuring data security and integrity. In addition, traditional monitoring systems often lack adaptive learning capabilities and are difficult to cope with environmental changes and uneven data distribution, resulting in limited accuracy and reliability of monitoring results. In terms of data fusion and feature extraction, traditional methods often rely on manual feature extraction, which is not only inefficient, but also difficult to capture complex environmental changes and deep correlations between data.
[0003] In the process of implementing the embodiments of the present invention, the inventors found that there are at least the following problems or defects in the prior art: the existing watershed monitoring system lacks intelligent data processing capabilities and cannot effectively extract valuable information from massive monitoring data; at the same time, due to the lack of support from blockchain technology, there is a risk of tampering during the storage and transmission of monitoring data, which affects the authenticity and reliability of the data; furthermore, when faced with data migration problems in different environments and conditions, existing monitoring models often need to be retrained, which is not only time-consuming and labor-intensive, but also difficult to adapt to rapidly changing environmental requirements. Summary of the invention
[0004] The present invention provides an adaptive blockchain watershed monitoring method and system based on an intelligent analysis algorithm.
[0005] In a first aspect of the present invention, there is provided an adaptive blockchain watershed monitoring method based on an intelligent analysis algorithm, comprising:
[0006] Acquire newly added sensor monitoring data of source domain and target domain of multiple monitoring stations in the watershed, extract monitoring data sequence by sliding time window and data fusion method, and generate newly added sample set; use the newly added sample set as training sample set;
[0007] Constructing an adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism, the model integrates a graph convolutional neural network GCN and a long short-term memory network LSTM, training the adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism based on the training sample set, and calculating the overall loss of the model;
[0008] If the overall loss is greater than the threshold, some samples are randomly extracted from the current training sample set according to the data importance sampling algorithm and stored in the experience learning library, and some samples are extracted from the experience learning library and the samples in the newly added sample set of the next round of training form the training sample set of the next round of training, and the next round of training is continued; otherwise, the training ends and the watershed monitoring model is obtained;
[0009] Based on the water basin monitoring model, the water quality parameters, water level changes and water flow velocity of the water basin to be monitored in the target area are monitored to obtain the monitoring results.
[0010] Furthermore, the method of extracting the monitoring data sequence by using the sliding time window and data fusion method to generate a new sample set includes:
[0011] For each sensor monitoring data channel, a multi-dimensional data vector is used to represent the monitoring data of each time period, and a sliding time window method is used to extract the monitoring data of the T time period to form an initial data matrix;
[0012] For the initial data matrix of different sensor monitoring data channels, principal component analysis PCA and wavelet transform are used to perform data fusion to generate a fused data matrix;
[0013] Split the fused data matrix of each window into three data matrix components, and calculate the covariance matrix of each data matrix component separately;
[0014] The three covariance matrices are combined by weighted average operation to generate a sample data, and multiple sample data constitute a newly added sample set.
[0015] Further, the adaptive watershed analysis network model based on blockchain distributed ledger and smart contract mechanism is trained based on the training sample set, including:
[0016] Extracting local features through a local feature perception network, the local feature perception network combines an attention mechanism and a convolutional layer, using a first data discriminator to perform domain discrimination on the local features, calculating local migration losses and weights of the local features according to domain discrimination results, and obtaining transferable features based on the local features and the corresponding weights;
[0017] The number of the first data discriminators is determined according to the size of the local feature matrix and the data category;
[0018] Input the transferable features into a multi-head attention and graph convolution fusion feature extraction network, and extract representative transferable features based on the multi-head attention mechanism and graph convolution operation;
[0019] Using a second data discriminator to perform domain discrimination on the representative transferable features, and calculating the overall transfer loss according to the domain discrimination result;
[0020] A classifier is used to classify and discriminate the representative transferable features of source domain samples, and the source domain classification and discrimination loss is calculated. The classifier is a multi-layer perceptron MLP structure.
[0021] The total loss of the sample is calculated based on the local migration loss, the overall migration loss and the source domain classification discrimination loss. The adaptive water basin analysis network model based on the blockchain distributed ledger and the smart contract mechanism is trained with the minimum total loss as the training goal.
[0022] The M samples with the largest weighted probability of loss are extracted from the experience learning library and the samples in the newly added sample set of the next round of training form the training sample set of the next round of training.
[0023] In a second aspect of the present invention, an adaptive blockchain watershed monitoring system based on an intelligent analysis algorithm is provided, comprising:
[0024] A training set generation module is used to obtain newly added sensor monitoring data of source domains and target domains of multiple monitoring stations in a watershed, extract monitoring data sequences using a sliding time window and data fusion method, and generate newly added sample sets; and use the newly added sample sets as training sample sets;
[0025] A network model training module is used to build an adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism. The model integrates a graph convolutional neural network GCN and a long short-term memory network LSTM. The adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism is trained based on the training sample set, and the overall loss of the model is calculated. If the overall loss is greater than a threshold, some samples are randomly extracted from the current training sample set according to a data importance sampling algorithm and stored in an experience learning library. Some samples are extracted from the experience learning library and combined with samples from the newly added sample set of the next round of training to form a training sample set for the next round of training, and the next round of training is continued; otherwise, the training ends and a water basin monitoring model is obtained;
[0026] The water basin monitoring module is used to monitor the water quality parameters, water level changes, and water flow velocity of the water basin to be monitored in the target domain based on the water basin monitoring model to obtain monitoring results.
[0027] The above-mentioned embodiments of the present invention have at least the following beneficial effects: the present invention extracts the monitoring data sequence by adopting the sliding time window and data fusion method, generates a new sample set, and combines the graph convolutional neural network (GCN) and the long short-term memory network (LSTM) to construct an adaptive water basin analysis network model, which can effectively improve the processing efficiency and analysis accuracy of water basin monitoring data. This method utilizes the blockchain distributed ledger and smart contract mechanism to enhance the security and non-tamperability of monitoring data and ensure the reliability of monitoring results. At the same time, through the adaptive learning mechanism, the model can be dynamically adjusted according to real-time data to adapt to different environmental changes, which can improve the flexibility and adaptability of the monitoring system.
[0028] In addition, the method of the present invention also includes an experience learning library based on a data importance sampling algorithm, which can extract some samples from the current training sample set and store them in the experience learning library when the overall loss is greater than a threshold, and use these samples in the next round of training, thereby reducing the reliance on a large amount of labeled data and reducing training costs. At the same time, by calculating the weighted probability of loss of the sample and selecting the sample with the largest weighted probability of loss for training, the training efficiency of the model and the accuracy of the monitoring results can be further improved. This method can not only optimize the performance of the model, but also automatically process monitoring tasks through smart contracts, reduce the need for manual intervention, and improve the level of automation of monitoring work. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, in which:
[0030] Figure 1 A schematic flow chart of an adaptive blockchain watershed monitoring method based on an intelligent analysis algorithm provided in one embodiment of the present invention;
[0031] Figure 2 A schematic diagram of the structure of an adaptive blockchain watershed monitoring system based on an intelligent analysis algorithm provided by an embodiment of the present invention;
[0032] Figure 3 The schematic diagram schematically shows the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.
[0034] Those skilled in the art know that the embodiments of the present invention can be implemented as a system, device, apparatus, method or computer program product. Therefore, the present invention can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0035] It should be noted that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction and does not have any limiting meaning.
[0036] Reference below Figure 1 , Figure 1 The flowchart of the adaptive blockchain watershed monitoring method based on intelligent analysis algorithm provided by one embodiment of the present invention is as follows. Figure 1 As shown, an adaptive blockchain watershed monitoring method 100 based on an intelligent analysis algorithm includes:
[0037] Step 101, acquiring newly added sensor monitoring data of source domains and target domains of multiple monitoring stations in a watershed, extracting monitoring data sequences using a sliding time window and data fusion method, and generating a newly added sample set; using the newly added sample set as a training sample set;
[0038] Step 102, constructing an adaptive watershed analysis network model based on a blockchain distributed ledger and a smart contract mechanism, the model integrating a graph convolutional neural network GCN and a long short-term memory network LSTM, training the adaptive watershed analysis network model based on a blockchain distributed ledger and a smart contract mechanism based on the training sample set, and calculating the overall loss of the model;
[0039] Step 103, if the overall loss is greater than the threshold, some samples are randomly extracted from the current training sample set according to the data importance sampling algorithm and stored in the experience learning library, some samples are extracted from the experience learning library and the samples in the newly added sample set of the next round of training form the training sample set of the next round of training, and the next round of training is continued; otherwise, the training ends and the watershed monitoring model is obtained;
[0040] Step 104, based on the water basin monitoring model, the water quality parameters, water level changes, and water flow velocity of the water basin to be monitored in the target domain are monitored to obtain monitoring results.
[0041] It should be noted that this method first involves obtaining new sensor monitoring data from the source domain and target domain of multiple monitoring sites in the watershed. The source domain here refers to the initial environment of data collection, while the target domain is the environment of data application, and there may be differences between the two. New sensor monitoring data means that these data are recently collected and used to update and optimize the monitoring model. Monitoring sites refer to geographical locations where sensors are installed to collect relevant data in the watershed.
[0042] Specifically, these monitoring data may include information such as water quality parameters, water level changes, and water flow speed. Sensors can be water quality sensors, water level meters, and flow meters. Data fusion methods involve combining data from different sensors to obtain more comprehensive monitoring information. The sliding time window method is a commonly used time series analysis method that can extract continuous data segments by setting the size of the time window (for example, T period) to form an initial data matrix.
[0043] Preferably, the data fusion can be performed on the initial data matrices of different sensor monitoring data channels using techniques such as principal component analysis (PCA) and wavelet transform. PCA is a statistical method used to reduce the dimensionality of data while retaining the most important features. Wavelet transform is a mathematical tool used to analyze the frequency components of a signal.
[0044] Furthermore, in actual operation, the fused data matrix of each window can be split into three data matrix components, and the covariance matrix of each data matrix component can be calculated. Finally, the three covariance matrices are combined through weighted average operation to generate a sample data, thereby forming a new sample set. Such processing can enhance the model's understanding and prediction capabilities of data.
[0045] In some embodiments, the method of extracting the monitoring data sequence by using a sliding time window and a data fusion method to generate a new sample set includes:
[0046] For each sensor monitoring data channel, a multi-dimensional data vector is used to represent the monitoring data of each time period, and a sliding time window method is used to extract the monitoring data of the T time period to form an initial data matrix;
[0047] For the initial data matrix of different sensor monitoring data channels, principal component analysis PCA and wavelet transform are used to perform data fusion to generate a fused data matrix;
[0048] Split the fused data matrix of each window into three data matrix components, and calculate the covariance matrix of each data matrix component separately;
[0049] The three covariance matrices are combined by weighted average operation to generate a sample data, and multiple sample data constitute a newly added sample set.
[0050] It should be noted that this embodiment involves the process of extracting monitoring data sequences using sliding time windows and data fusion methods to generate new sample sets. The sliding time window here is a time series analysis technology used to capture the changing trend of data in a continuous time period. Data fusion method refers to combining data from different sensors to obtain more comprehensive information. The new sample set refers to the data set used to train the model after processing by this method.
[0051] Specifically, for each sensor monitoring data channel, a multi-dimensional data vector is first used to represent the monitoring data of each period. This means that the data of each sensor at each time point can be represented as a vector containing multiple eigenvalues. Then, the sliding time window method is used to extract the monitoring data of the T period to form an initial data matrix.
[0052] More specifically, the T period here can be set according to the actual monitoring needs and the frequency of data changes. For example, if the monitoring data is collected once every minute, then T can be set to 60, which represents one hour of data. Then, the initial data matrix of different sensor monitoring data channels is fused using principal component analysis (PCA) and sum wave transform to generate a fused data matrix.
[0053] Preferably, the data fusion process can be further refined. For example, when performing PCA, the number of main components to be retained can be selected, which is usually determined based on the cumulative contribution rate, such as retaining 95% of the information. In wavelet transform, different wavelet bases and decomposition levels can be selected to adapt to different types of signal characteristics.
[0054] Furthermore, after splitting the fused data matrix of each window into three data matrix components, the covariance matrix of each data matrix component can be calculated separately, and then the three covariance matrices can be merged using a weighted average operation to generate a sample data. The weights here can be assigned according to the importance of each component. For example, if a component contains more key information, its weight in the weighted average can be higher. In this way, a more comprehensive and representative sample set can be generated for subsequent model training.
[0055] In some embodiments, training the adaptive watershed analysis network model based on blockchain distributed ledger and smart contract mechanism based on the training sample set includes:
[0056] Extracting local features through a local feature perception network, the local feature perception network combines an attention mechanism and a convolutional layer, using a first data discriminator to perform domain discrimination on the local features, calculating local migration losses and weights of the local features according to domain discrimination results, and obtaining transferable features based on the local features and the corresponding weights;
[0057] The number of the first data discriminators is determined according to the size of the local feature matrix and the data category;
[0058] Input the transferable features into a multi-head attention and graph convolution fusion feature extraction network, and extract representative transferable features based on the multi-head attention mechanism and graph convolution operation;
[0059] Using a second data discriminator to perform domain discrimination on the representative transferable features, and calculating the overall transfer loss according to the domain discrimination result;
[0060] A classifier is used to classify and discriminate the representative transferable features of source domain samples, and the source domain classification and discrimination loss is calculated. The classifier is a multi-layer perceptron MLP structure.
[0061] The total loss of the sample is calculated based on the local migration loss, the overall migration loss and the source domain classification discrimination loss. The adaptive water basin analysis network model based on the blockchain distributed ledger and the smart contract mechanism is trained with the minimum total loss as the training goal.
[0062] It should be noted that this embodiment describes the process of training an adaptive watershed analysis network model based on a training sample set. This model combines a graph convolutional neural network (GCN) and a long short-term memory network (LSTM) to improve the analysis of watershed data. A graph convolutional neural network (GCN) is a neural network used to process graph structured data, while a long short-term memory network (LSTM) is a special recurrent neural network that is good at processing and predicting long-term dependencies in time series data.
[0063] Specifically, the training process first extracts local features through a local feature perception network, which combines an attention mechanism and a convolutional layer. The attention mechanism allows the model to focus more on important features when processing data, while the convolutional layer is used to extract the spatial features of the data. Next, the first data discriminator is used to perform domain discrimination on the local features, and the local migration loss and the weights of the local features are calculated. Domain discrimination here refers to the process of determining whether a feature belongs to the source domain or the target domain, while the local migration loss refers to the loss incurred when the feature distributions of the source domain and the target domain are inconsistent in transfer learning. The weights of the local features are calculated based on the domain discrimination results to determine which features are more important in the migration process.
[0064] Preferably, the process of local feature extraction and weight calculation can be further refined. For example, the local feature perception network can be designed as a deep network containing multiple convolutional layers and attention layers, and each convolutional layer can be followed by a batch normalization layer and a ReLU activation function to enhance the ability of feature extraction.
[0065] Furthermore, the attention mechanism can be implemented by weighted summation, where the weights are determined by a trained parameter matrix. The first data discriminator can be one or more fully connected layers, whose outputs are used to calculate the cross entropy loss to evaluate the effect of domain discrimination. The weights of local features can be calculated by a softmax function, which can convert the output of the first data discriminator into a weight distribution. In addition, in order to improve the generalization ability of the model, a dropout layer can be added after local feature extraction to reduce the risk of overfitting.
[0066] In some embodiments, the local migration loss is calculated using the following formula:
[0067]
[0068] in, represents the kth first data discriminator, G lf represents the local feature perception network, d i Represents sample x i The domain label, L entropy represents the cross entropy loss function, n is the number of training samples, D s represents the source domain, D t represents the target domain, K is the number of the first data discriminators, and γ is the regularization parameter.
[0069] It should be noted that this embodiment describes in detail the specific formula for calculating the local transfer loss. The local transfer loss is an indicator that measures the difference in the distribution of source domain and target domain data features during the transfer learning process. The first data discriminator here refers to the model component used to distinguish the source domain and target domain features, and the cross entropy loss function is a commonly used loss function used to measure the difference between the predicted value and the actual value.
[0070] Specifically, the calculation of local transfer loss involves the first data discriminator performing domain discrimination on the local features of each sample, and then calculating the cross entropy loss based on the discrimination result and the domain label of the sample. The domain label here refers to the label that identifies whether the sample comes from the source domain or the target domain.
[0071] More specifically, the "||·||" in the formula represents the L2 norm, which is used to calculate the Euclidean distance between feature vectors, and "λ" is a regularization parameter used to control the weight of the feature vector distance to prevent overfitting. The summation in the formula is performed on all samples to obtain the overall local transfer loss.
[0072] Preferably, the calculation process of the local migration loss can be further refined. For example, the first data discriminator can be designed as a neural network comprising multiple fully connected layers, each of which is followed by a ReLU activation function to enhance the nonlinear expression capability. The specific form of the cross entropy loss function can be a binary or multi-classification cross entropy loss, depending on the number of categories for domain discrimination. The calculation of the L2 norm can be simplified to the square root of the sum of the squares of the elements of the feature vector.
[0073] Furthermore, the regularization parameter λ can be set empirically or the optimal value can be determined by cross-validation. In addition, in order to improve computational efficiency, batch normalization and dropout techniques can be used to reduce internal covariate shift and overfitting during training.
[0074] In some embodiments, the local migration loss and the weight of the local feature are calculated according to the domain discrimination result, and the transferable feature is obtained based on the local feature and the corresponding weight; including:
[0075] According to the formula
[0076]
[0077] Calculate the attention weight of local features, where Represents the kth first data discriminator for sample x i The domain discrimination result of the local features of , k = 1, 2, ..., K, K is the number of the first data discriminator, α is the scaling factor;
[0078] Multiply the local features with the corresponding attention weights to obtain transferable features.
[0079] It should be noted that this embodiment describes how to calculate the weights of local features based on the domain discrimination results and obtain transferable features based on these weights. Here, local features refer to features extracted from the original data for subsequent analysis, and domain discrimination results refer to the model's judgment on whether these features belong to the source domain or the target domain. Transferable features refer to those features that have certain commonalities between the source domain and the target domain and can be used for transfer learning.
[0080] Specifically, calculating the attention weight of local features involves the first data discriminator performing domain discrimination on the local features of the sample and adjusting the weight of the feature based on the discrimination result. The attention weight here is a method to measure the importance of features, which can help the model pay more attention to those features that are more helpful to the task when processing data. D^θ in the formula represents the i-th first data discriminator, where θ is the model parameter and D is the function of the discriminator. φ in the formula represents the local feature perception network, and y represents the domain label of the sample. α is a scaling factor used to adjust the size of the weight to ensure the rationality of the weight distribution.
[0081] Preferably, the calculation of local feature weights and the extraction process of transferable features can be further refined. For example, the first data discriminator can be a neural network containing multiple hidden layers, each hidden layer can be followed by an activation function, such as ReLU or Sigmoid, to increase the nonlinear expression ability of the model. The local feature perception network φ can be designed as a deep convolutional network for extracting local features in image or sequence data.
[0082] Furthermore, when calculating the attention weight, the softmax function can be used to normalize the weight so that the sum of the weights of all features is 1. In addition, in order to improve the generalization ability of the model, a dropout layer can be added during the feature extraction process to randomly discard a part of the neurons to reduce the risk of overfitting. After obtaining the transferable features, the features can be further optimized through methods such as feature normalization or feature selection to improve the performance of the model.
[0083] In some embodiments, the overall migration loss is calculated using the following formula:
[0084]
[0085] Among them, D 2 represents the second data discriminator, G df represents the multi-head attention and graph convolution fusion feature extraction network, g i Represents sample x i The transferable characteristics of i Represents sample x i The domain label, L entropy represents the cross entropy loss function, n is the number of training samples, D s represents the source domain, D t represents the target domain and μ is the regularization parameter.
[0086] It should be noted that this embodiment describes in detail the process of calculating the overall transfer loss. The overall transfer loss is another important indicator to measure the difference in the distribution of source domain and target domain data features during the transfer learning process. Here, the second data discriminator refers to a model component used to further distinguish the source domain and target domain features, and the cross entropy loss function is a commonly used loss function used to measure the difference between the predicted value and the actual value.
[0087] Specifically, the calculation of the overall transfer loss involves the second data discriminator performing domain discrimination on the representative transferable features processed by the multi-head attention and graph convolution fusion feature extraction network, and then calculating the cross entropy loss based on the discrimination results and the domain labels of the samples. The representative transferable features here refer to those features that are representative and common between the source domain and the target domain, which are crucial for transfer learning tasks.
[0088] More specifically, the ||·|| in the formula represents the L2 norm, which is used to calculate the Euclidean distance between feature vectors, and λ is a regularization parameter used to control the weight of the feature vector distance to prevent overfitting. The summation in the formula is performed on all samples to obtain the overall overall transfer loss.
[0089] Preferably, the calculation process of the overall transfer loss can be further refined. For example, the second data discriminator can be designed as a neural network comprising multiple fully connected layers, each of which is followed by a ReLU activation function to enhance the nonlinear expression capability. The specific form of the cross entropy loss function can be a binary or multi-classification cross entropy loss, depending on the number of categories for domain discrimination. The calculation of the L2 norm can be simplified to the square root of the sum of the squares of the elements of the feature vector.
[0090] Furthermore, the regularization parameter λ can be set empirically or the optimal value can be determined through cross-validation. In addition, in order to improve computational efficiency, batch normalization and dropout techniques can be used to reduce internal covariate shift and overfitting during training. When calculating the overall transfer loss, other regularization terms can also be considered, such as feature sparsity constraints, to further improve the generalization ability of the model.
[0091] In some embodiments, the total loss of the sample is calculated based on the local migration loss, the overall migration loss, and the source domain classification discrimination loss, including calculating the total loss of the sample using the following formula:
[0092] L θ =L s -λL l -βL d
[0093] Where λ and β are hyperparameters, L l is the local migration loss, Ld is the overall migration loss, L s is the source domain classification discriminative loss.
[0094] It should be noted that this embodiment involves the process of calculating the total loss of samples based on local migration loss, overall migration loss and source domain classification discrimination loss. The total loss here refers to a comprehensive indicator used to optimize model performance during training. It combines multiple loss functions to ensure that the performance of the model in different aspects can be improved. Local migration loss and overall migration loss measure the migration effect of the model on local features and overall features respectively, while source domain classification discrimination loss measures the accuracy of the model in classifying source domain data.
[0095] Specifically, the calculation of the total loss involves three different loss functions, each of which corresponds to a specific goal in model training. The local transfer loss focuses on the difference in local features between the source domain and the target domain, the global transfer loss focuses on the difference in overall features between the two domains, and the source domain classification loss focuses on the model's ability to classify source domain data.
[0096] More specifically, these loss functions are weighted and combined by specific hyperparameters α and β to balance their contributions to the total loss. The hyperparameters α and β here can be adjusted according to specific tasks and datasets to obtain the best training results.
[0097] Preferably, the calculation method of the total loss can be further refined. For example, different weights can be used for local transfer loss and overall transfer loss to reflect their relative importance in a specific task. If the task requires higher classification accuracy of source domain data, the weight of source domain classification discriminant loss can be appropriately increased.
[0098] Furthermore, the hyperparameters α and β can be determined by hyperparameter optimization techniques such as grid search or random search to find the best combination of loss function weights. In practical applications, other types of loss functions, such as adversarial loss or consistency loss, can also be considered to further improve the generalization and robustness of the model. These loss functions can be customized and adjusted according to the specific architecture of the model and the characteristics of the training data.
[0099] In some embodiments, the overall loss of the adaptive watershed analysis model based on blockchain distributed ledger and smart contract mechanism is calculated using the following formula:
[0100]
[0101] Among them, σ and η are hyper parameters, S is the newly added sample set, and x i is a sample in the newly added sample set, E is a sample set extracted from the experience learning library, xj is the sample extracted from the experience learning library in the current task, M is the number of samples extracted from the experience learning library, and L θ (x i ) is the sample x i loss.
[0102] It should be noted that this embodiment describes how to calculate the overall loss of an adaptive watershed analysis model based on a blockchain distributed ledger and a smart contract mechanism. The overall loss here refers to the objective function that the model needs to minimize during the training process, which combines the sum of different samples and different loss calculations. The blockchain distributed ledger refers to a decentralized data storage system that ensures the immutability and transparency of data. Smart contracts refer to contract terms that are automatically executed on the blockchain, which can be used to automatically process and verify data and results during model training.
[0103] Specifically, the calculation of the overall loss involves summing the losses of each sample in the newly added sample set and the samples extracted from the experience learning library. The newly added sample set here refers to the collection of recently collected data samples, while the experience learning library refers to the database that stores important samples from previous training processes.
[0104] More specifically, the hyperparameters μ and ν are used to adjust the weights of the losses of samples from different sources to reflect their importance in the overall loss. The sum in the formula accumulates the losses of all samples, including samples in the newly added sample set and samples extracted from the experience learning library.
[0105] Preferably, the calculation process of the overall loss can be further refined. For example, for each sample in the newly added sample set, its prediction error during the training process can be calculated and used as part of the loss. For samples in the experience learning library, different weights can be given according to their historical performance and importance.
[0106] Furthermore, the hyperparameters μ and ν can be adjusted according to the training effect of the model to ensure that the model maintains good performance when processing new data and historical data. In addition, you can also consider adding regularization terms, such as L1 or L2 regularization, to prevent the model from overfitting. In practical applications, you can also choose different loss functions, such as mean square error loss, cross entropy loss, or Huber loss, according to the specific needs of the model and data characteristics, to adapt to different types of prediction tasks.
[0107] In some embodiments, extracting some samples from the experience learning library and samples in the newly added sample set of the next round of training to form a training sample set for the next round of training includes:
[0108] Calculate the loss-weighted probability for each sample in the experience learning base:
[0109]
[0110] Among them, P i represents the loss weighted probability of the i-th sample, L θ (x i ) is the sample x i loss, ε is a constant, β is an adjustment factor, i = 1, 2, ... n h ;n h is the number of samples in the experience learning library;
[0111] The M samples with the largest weighted probability of loss are extracted from the experience learning library and the samples in the newly added sample set of the next round of training form the training sample set of the next round of training.
[0112] It should be noted that this embodiment involves the process of extracting samples from the experience learning library and combining them with newly added samples to form the next round of training sample sets. The experience learning library refers to a database that stores representative samples screened out in previous training. These samples are retained because of their importance in the training process. The loss weighted probability is a method of measuring the importance of a sample, which is calculated based on the loss value of the sample.
[0113] Specifically, calculating the loss-weighted probability of each sample in the experience learning library involves an exponential function of the sample loss value, where the smaller the loss value of the sample, the larger the corresponding loss-weighted probability. The loss value here refers to the prediction error of the sample in model training, and the constant τ is a temperature parameter used to adjust the probability distribution, which can control the concentration of the probability distribution. The adjustment factor η is used to balance the impact of the loss values of different samples on the probability to ensure the diversity of sample selection. The sum in the formula is to accumulate the exponential function values of all samples to ensure the normalization of the probability.
[0114] Preferably, the process of sample extraction and probability calculation can be further refined. For example, the loss value of the sample can be determined based on the performance of the model on the validation set, and those samples with larger errors are selected as the key learning objects. The constant τ can be adjusted according to the complexity of the model and the distribution of the training data to obtain the best probability distribution. The adjustment factor η can be set to a smaller value to emphasize the importance of samples with smaller loss values.
[0115] Furthermore, in practical applications, we can select M samples with the largest loss weighted probability, where M is a hyperparameter that can be determined based on the needs of model training and computing resources. In addition, we can also consider using other probability distribution functions, such as the log-likelihood function, to calculate the loss weighted probability to adapt to different training scenarios and optimization objectives.
[0116] The above-mentioned embodiments of the present invention have the following beneficial effects: The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm described in the present invention can significantly improve the efficiency and accuracy of water quality monitoring. By acquiring the newly added sensor monitoring data of the source domain and target domain of multiple monitoring sites, and using the sliding time window and data fusion method to extract the monitoring data sequence to generate a new sample set, this method can ensure the continuity and integrity of the monitoring data. The adaptive watershed analysis network model constructed by combining the graph convolutional neural network (GCN) and the long short-term memory network (LSTM) can effectively process and analyze these data, thereby accurately monitoring water quality parameters, water level changes and water flow velocity. In addition, through the application of blockchain technology, this method can enhance the security and transparency of the data, and ensure the reliability and non-tamperability of the monitoring results.
[0117] Furthermore, the adaptive learning mechanism allows the model to dynamically adjust according to real-time data to adapt to environmental changes and uneven data distribution. This mechanism can optimize model performance, reduce dependence on large amounts of labeled data, and reduce training costs. By combining the data importance sampling algorithm with the experience learning library, this method can extract some samples from the current training sample set and store them in the experience learning library when the overall loss is greater than the threshold, and use these samples in the next round of training, which can further improve the training efficiency of the model and the accuracy of the monitoring results. This method can not only improve the flexibility and adaptability of the monitoring system, but also automate the monitoring tasks through smart contracts, reduce the need for manual intervention, and improve the automation level of monitoring work.
[0118] like Figure 2 As shown, in some embodiments, an adaptive blockchain watershed monitoring system 200 based on an intelligent analysis algorithm includes:
[0119] The training set generation module 201 is used to obtain the newly added sensor monitoring data of the source domain and the target domain of multiple monitoring stations in the watershed, extract the monitoring data sequence by using the sliding time window and data fusion method, and generate a newly added sample set; and use the newly added sample set as the training sample set;
[0120] The network model training module 202 is used to construct an adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism. The model integrates a graph convolutional neural network GCN and a long short-term memory network LSTM. The adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism is trained based on the training sample set, and the overall loss of the model is calculated. If the overall loss is greater than a threshold, some samples are randomly extracted from the current training sample set according to a data importance sampling algorithm and stored in an experience learning library. Some samples are extracted from the experience learning library and combined with samples in a newly added sample set for the next round of training to form a training sample set for the next round of training, and the next round of training is continued; otherwise, the training ends and a water basin monitoring model is obtained;
[0121] The water basin monitoring module 203 is used to monitor the water quality parameters, water level changes, and water flow velocity of the water basin to be monitored in the target domain based on the water basin monitoring model to obtain monitoring results.
[0122] It is understandable that the modules recorded in the adaptive blockchain watershed monitoring system 200 based on intelligent analysis algorithm are similar to those in the reference Figure 1 The steps in the adaptive blockchain watershed monitoring method based on the intelligent analysis algorithm described above correspond to each other. Therefore, the operations, features and beneficial effects described above for the adaptive blockchain watershed monitoring method based on the intelligent analysis algorithm are also applicable to the adaptive blockchain watershed monitoring system 200 based on the intelligent analysis algorithm and the modules contained therein, which will not be repeated here.
[0123] Reference below Figure 3 , which shows a schematic diagram of a structure 300 of an electronic device suitable for implementing some embodiments of the present invention. The electronic devices in some embodiments of the present invention may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 3 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0124] like Figure 3As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0125] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0126] Furthermore, the storage medium of the embodiment of the present application stores program instructions that can implement all the above methods, wherein the program instructions can be stored in the above storage medium in the form of a software product, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or terminal devices such as a computer, a server, a mobile phone, and a tablet.
[0127] The above descriptions are only some preferred embodiments of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present invention is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present invention to form a technical solution.
Claims
1. An adaptive blockchain watershed monitoring method based on intelligent analysis algorithm, characterized in that: The following steps are involved: Acquire newly added sensor monitoring data of source domain and target domain of multiple monitoring stations in the watershed, extract monitoring data sequence by sliding time window and data fusion method, and generate newly added sample set; use the newly added sample set as training sample set; Constructing an adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism, the model integrates a graph convolutional neural network GCN and a long short-term memory network LSTM, training the adaptive water basin analysis network model based on a blockchain distributed ledger and a smart contract mechanism based on the training sample set, and calculating the overall loss of the model; If the overall loss is greater than the threshold, some samples are randomly extracted from the current training sample set according to the data importance sampling algorithm and stored in the experience learning library, and some samples are extracted from the experience learning library and combined with samples in the newly added sample set of the next round of training to form the training sample set of the next round of training, and the next round of training is continued; Otherwise, the training ends and the watershed monitoring model is obtained; Based on the water basin monitoring model, the water quality parameters, water level changes and water flow velocity of the water basin to be monitored in the target area are monitored to obtain the monitoring results.
2. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 1 is characterized in that: The method of extracting monitoring data sequence by using sliding time window and data fusion method to generate new sample set includes: For each sensor monitoring data channel, a multi-dimensional data vector is used to represent the monitoring data of each time period, and a sliding time window method is used to extract the monitoring data of T time periods to form an initial data matrix.
3. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 2 is characterized in that: The method of extracting monitoring data sequence by using sliding time window and data fusion method to generate new sample set includes: For the initial data matrices of different sensor monitoring data channels, principal component analysis PCA and wavelet transform are used to perform data fusion to generate a fused data matrix.
4. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 3 is characterized in that: The method of extracting monitoring data sequence by using sliding time window and data fusion method to generate new sample set includes: The fused data matrix of each window is split into three data matrix components, and the covariance matrix of each data matrix component is calculated separately.
5. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 4 is characterized in that: The method of extracting monitoring data sequence by using sliding time window and data fusion method to generate new sample set includes: The three covariance matrices are combined by weighted average operation to generate a sample data, and multiple sample data constitute a newly added sample set.
6. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 1 is characterized in that: The adaptive watershed analysis network model based on the blockchain distributed ledger and smart contract mechanism is trained based on the training sample set, including: Extracting local features through a local feature perception network, the local feature perception network combines an attention mechanism and a convolutional layer, using a first data discriminator to perform domain discrimination on the local features, calculating local migration losses and weights of the local features according to domain discrimination results, and obtaining transferable features based on the local features and the corresponding weights; The number of the first data discriminators is determined according to the size of the local feature matrix and the data category.
7. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 6 is characterized in that: The adaptive watershed analysis network model based on the blockchain distributed ledger and smart contract mechanism is trained based on the training sample set, including: Input the transferable features into a multi-head attention and graph convolution fusion feature extraction network, and extract representative transferable features based on the multi-head attention mechanism and graph convolution operation; A second data discriminator is used to perform domain discrimination on the representative transferable features, and the overall migration loss is calculated according to the domain discrimination result.
8. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 7 is characterized in that: The adaptive watershed analysis network model based on the blockchain distributed ledger and smart contract mechanism is trained based on the training sample set, including: A classifier is used to classify and discriminate the representative transferable features of source domain samples, and the source domain classification and discrimination loss is calculated. The classifier is a multi-layer perceptron MLP structure. The total loss of the sample is calculated based on the local migration loss, the overall migration loss and the source domain classification discrimination loss. The adaptive water basin analysis network model based on the blockchain distributed ledger and the smart contract mechanism is trained with the minimum total loss as the training goal.
9. The adaptive blockchain watershed monitoring method based on intelligent analysis algorithm according to claim 1 is characterized in that: Extracting some samples from the experience learning library and samples in the newly added sample set of the next round of training to form a training sample set for the next round of training includes: Calculate the loss-weighted probability for each sample in the experience learning library; The M samples with the largest weighted probability of loss are extracted from the experience learning library and the samples in the newly added sample set of the next round of training form the training sample set of the next round of training.
10. An adaptive blockchain watershed monitoring system based on intelligent analysis algorithm, characterized in that: Includes the following modules: A training set generation module is used to obtain newly added sensor monitoring data of source domains and target domains of multiple monitoring stations in a watershed, extract monitoring data sequences using a sliding time window and data fusion method, and generate newly added sample sets; and use the newly added sample sets as training sample sets; A network model training module is used to build an adaptive watershed analysis network model based on a blockchain distributed ledger and a smart contract mechanism. The model integrates a graph convolutional neural network GCN and a long short-term memory network LSTM. The adaptive watershed analysis network model based on a blockchain distributed ledger and a smart contract mechanism is trained based on the training sample set, and the overall loss of the model is calculated. If the overall loss is greater than a threshold, some samples are randomly extracted from the current training sample set according to a data importance sampling algorithm and stored in an experience learning library. Some samples are extracted from the experience learning library and combined with samples in the newly added sample set of the next round of training to form a training sample set for the next round of training, and the next round of training is continued; Otherwise, the training ends and the watershed monitoring model is obtained; The water basin monitoring module is used to monitor the water quality parameters, water level changes, and water flow velocity of the water basin to be monitored in the target domain based on the water basin monitoring model to obtain monitoring results.
Citation Information
Cited By
Water body pollution monitoring and processing system based on multi-dimensional data analysis
CN120654038A