Sensor data recovery method and system based on mask perception space-time modeling
By employing a deep learning method based on mask-aware spatiotemporal modeling, the robustness of sensor data in scenarios with high missing rates and dynamic topology is addressed, achieving high-precision data repair. This method is suitable for large-scale heterogeneous sensor networks, improving data integrity and reliability, and can be applied to environmental monitoring, industrial IoT, and smart grids.
Patent Information
- Application Number
- CN202511502908.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2026-02-10
AI Technical Summary
Existing sensor data repair methods lack robustness in scenarios with high missing rates, heterogeneous distributions, and dynamic topologies, and have limited repair accuracy, affecting the data integrity and reliability of smart IoT and industrial systems.
We employ a deep learning approach based on mask-aware spatiotemporal modeling. Through adaptive missing representation, mask-constrained attention mechanism, and spatiotemporal dual-channel feature aggregation, we achieve adaptive modeling of missing locations and differentiated processing of spatiotemporal dependencies. We combine spatial convolution and multi-scale gated temporal convolution for feature aggregation and use L1/L2 hybrid loss function to optimize model training.
It improves the accuracy and robustness of sensor data repair, is suitable for large-scale heterogeneous sensor networks, adapts to dynamic environments, reduces noise interference, and improves data integrity and reliability. It is applicable to scenarios such as environmental monitoring, industrial IoT, and smart grids.
Smart Images

Figure CN121502157A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of Internet of Things and intelligent sensing data processing, and particularly relates to a deep learning method for large-scale high-dimensional spatiotemporal sensor data missing repair. BACKGROUND
[0002] With the rapid development of Internet of Things, industrial Internet and smart grid, distributed sensor networks have been widely deployed in key links such as city operation, industrial production, energy management and environmental monitoring, forming a spatiotemporal data matrix covering a wide range, multiple modalities and high frequency. Under this background, how to ensure the integrity and reliability of sensor data, and then provide reliable data support for prediction modeling, anomaly detection and intelligent scheduling, has become one of the core problems in intelligent sensing system.
[0003] However, in practical applications, sensor data generally has problems such as serious missing, strong noise interference, unstable structure and multi-source heterogeneity. The reasons for the missing include sensor dropouts, network congestion, communication packet loss, energy constraints and environmental interference, etc. These problems not only weaken the representation ability of the sensor network to the external environment, but also directly affect the accuracy and robustness of downstream tasks such as device health monitoring, environmental prediction and scheduling optimization. Therefore, there is an urgent need for a sensor data repair technology that can balance robustness and generalization ability to improve the quality and reliability of the overall data assets.
[0004] Traditional sensor data recovery methods mainly include interpolation estimation, low-rank matrix decomposition and regularization modeling based on graph structure. Interpolation methods rely on neighboring observations and are difficult to capture complex nonlinear spatiotemporal dependencies; low-rank decomposition (such as RPCA, SVD) usually assumes that the data has a low-dimensional latent structure, but performs poorly under high-dimensional sparse conditions; graph regularization-based methods require pre-defined topology or similarity graph, and the repair quality is highly dependent on the graph prior, which is difficult to adapt to dynamic environments and topologically incomplete scenarios.
[0005] In recent years, deep learning methods have been gradually applied to sensor data completion tasks, among which autoencoders, graph neural networks and time series modeling frameworks have improved the accuracy of data recovery to some extent. However, existing methods generally rely on pre-padding strategies (such as zero padding, mean padding) to handle missing values, which can introduce additional noise and affect the effectiveness of feature extraction. At the same time, graph convolution-based interpolation methods often have over-smoothing problems in feature propagation, resulting in the loss of diversity between different sensor nodes. In addition, most methods lack a dynamic adjustment mechanism and cannot adaptively adjust the repair path according to the sparsity and quality of the data.
[0006] In summary, the sensor data repair problem has evolved from simple missing imputation to a complex problem involving missing modeling, spatio-temporal feature extraction, mask constraint mechanism and dynamic information fusion. In order to improve the accuracy, robustness and generalizability of the repair, it is necessary to introduce a new mask-aware spatio-temporal modeling framework, to realize efficient and accurate repair of large-scale sensor data through adaptive modeling of missing positions and differentiated processing of spatio-temporal dependencies, so as to provide a solid data foundation for the high-quality development of smart Internet of Things and industrial systems. SUMMARY
[0007] The technical problem to be solved by the present application is to provide a sensor data repair method based on mask-aware spatio-temporal modeling, which is used to improve the integrity and reliability of large-scale spatio-temporal data of Internet of Things and industrial sensing system, and solves the problems of insufficient robustness and limited repair accuracy of existing methods in high missing rate, heterogeneous distribution and dynamic topology scenarios, and provides high-quality data support for environmental monitoring, industrial operation and maintenance, and smart grid sensing.
[0008] The present application provides a sensor data repair method based on mask-aware spatio-temporal modeling, comprising the following steps:
[0009] S1, obtaining a sensor-time two-dimensional observation matrix with missing values and its corresponding mask matrix, wherein the mask matrix is used to indicate the observation position and the missing position;
[0010] S2, modeling the missing position as a trainable latent vector representation, and mapping the observation value to a feature representation, and then fusing to obtain an input embedding matrix according to the mask matrix;
[0011] S3, according to the input embedding matrix, calculating the mask-aware attention in the time dimension and the space dimension respectively to obtain a spatio-temporal feature representation; wherein the sensor adjacency matrix is used when calculating the attention in the space dimension;
[0012] S4, combining the spatial convolution and the multi-scale gated temporal convolution to aggregate the spatio-temporal feature representation to obtain an aggregated spatio-temporal feature;
[0013] S5, predicting the missing value according to the aggregated spatio-temporal feature to obtain a complete sensor data matrix, and taking a L1 / L2 hybrid loss function constrained by the mask matrix as an optimization objective for model training.
[0014] Further, in step S2, is a sensor-time two-dimensional observation matrix with missing values, is its corresponding mask matrix, then the input embedding matrix obtained in step S2 is represented as:
[0015] ,
[0016] wherein, is a trainable missing embedding vector, is a feature representation of the observation mapping, wherein denotes a position is an observation, denotes a missing; the missing embedding vector is constantly updated during the training process, with the same feature dimension, to achieve adaptive modeling of missing data.
[0017] Further, step S3 calculates the mask-aware attention in the time dimension and the space dimension respectively to obtain a spatio-temporal feature representation:
[0018] ,
[0019] wherein A is a sensor adjacency matrix, M is a binary mask matrix, Q, K are the linear transformation results of query and key respectively, V is a value matrix, d is a scaling factor, and represents element-wise multiplication.
[0020] wherein the spatial attention weight is dynamically normalized under the joint constraint of the mask matrix and the adjacency matrix, so as to realize that the missing position does not participate in the neighborhood feature aggregation.
[0021] Further, in step S4, the feature is updated by combining the spatial convolution and the multi-scale gated temporal convolution, specifically:
[0022] ,
[0023] wherein GCN represents a graph convolution unit, S is a multi-scale set, and TCN represents a time convolution unit of different receptive fields, is an input feature representation, and A is a sensor adjacency matrix.
[0024] wherein the convolution kernel size set of the multi-scale gated temporal convolution is S={3, 5, 7}, which is used to capture feature dependencies at different time granularities.
[0025] Further, in step S5, the final prediction matrix of the missing value is:
[0026]
[0027] The mask-constrained L1 / L2 hybrid loss at the observation position is taken as the optimization objective, specifically:
[0028] ,
[0029] wherein is an observation position set, is an observation, is a predicted missing value, Is with The corresponding mask matrix, where α and β are the coefficients of the loss function, is dynamically adjusted based on the performance on the validation set.
[0030] This invention also proposes a sensor data recovery system based on mask-aware spatiotemporal modeling, comprising:
[0031] The data preprocessing module is used to obtain the sensor-time two-dimensional observation matrix with missing values and its corresponding mask matrix, wherein the mask matrix is used to indicate the observation location and the missing location;
[0032] An adaptive missing representation module is used to model missing locations as trainable latent vector representations and map observations to feature representations, and then fuse them according to the mask matrix to obtain the input embedding matrix;
[0033] The missing perceptual spatiotemporal decoding module is used to calculate mask-aware attention in the temporal and spatial dimensions based on the input embedding matrix to obtain spatiotemporal feature representations; wherein, the sensor adjacency matrix is used when calculating attention in the spatial dimension.
[0034] The spatiotemporal dual-channel feature aggregation unit is used to combine spatial convolution and multi-scale gated temporal convolution to aggregate spatiotemporal feature representations and obtain aggregated spatiotemporal features.
[0035] The output recovery unit is used to predict missing values based on the aggregated spatiotemporal features, obtain the complete sensor data matrix, and train the model using the L1 / L2 hybrid loss function constrained by the mask matrix as the optimization objective.
[0036] Furthermore, the present invention proposes an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed, it implements the steps of the method of the present invention.
[0037] Finally, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method of the present invention.
[0038] The technical advantages of this invention compared to existing technologies are as follows:
[0039] This invention effectively avoids noise interference caused by traditional pre-filling by introducing an adaptive missing representation mechanism. Through spatiotemporal decoding with mask constraints and dual-channel feature aggregation, it addresses the problems of excessive smoothing and insufficient spatiotemporal dependency modeling in existing methods. This method is applicable to large-scale heterogeneous sensor networks without relying on fixed topology or prior graph structures, exhibiting stronger robustness and generalization ability. Compared to traditional interpolation, low-rank decomposition, and static graph modeling methods, this invention offers efficient training, flexible deployment, and wide applicability in scenarios such as environmental monitoring, industrial IoT, and smart grid sensing, demonstrating significant promotional value and industrial adaptability. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] This invention addresses the challenges of high missing rates, strong structural dynamism, and severe noise interference in sensor data. It constructs a deep learning-based data restoration framework based on mask-aware spatiotemporal modeling. Through adaptive missing representation, mask-constrained attention mechanism, and spatiotemporal dual-channel feature aggregation, it effectively solves the limitations of traditional methods, such as noise introduced by pre-filling, feature loss due to excessive smoothing, and reliance on prior topology. Thus, it achieves high-precision and robust data reconstruction in large-scale, heterogeneous sensor scenarios, significantly improving the adaptability and versatility of data restoration.
[0044] As a specific description of the present invention, see reference. Figure 1 As shown, the overall steps of the method of the present invention are as follows:
[0045] (1) Collect multi-source observation data from different locations in the sensor network, construct a three-dimensional data matrix of “sensor × time × feature”, and mark the missing locations with a mask matrix. Only participate in training and loss calculation at the observation values to avoid interference caused by missing values.
[0046] (2) Construct an adaptive missing representation module, which directly represents the missing position through trainable embedding vectors, replacing the traditional zero-filling or mean-filling method, and combines observation embedding for unified input representation, thereby enhancing the ability to model missing patterns;
[0047] (3) Design a missing perception spatiotemporal decoding module, introduce mask-constrained attention mechanism in the time and space dimensions respectively, dynamically suppress noise propagation of missing values, and at the same time retain the dominant role of the observed values in the information interaction process, thereby realizing differentiated processing of observation and missing positions;
[0048] (4) Construct a spatiotemporal dual-channel feature aggregation unit. The spatial channel extracts the spatial correlation between sensor nodes through graph convolution, and the temporal channel models the temporal evolution law through multi-scale gated convolution. The combination of the two achieves comprehensive modeling of complex spatiotemporal dependencies.
[0049] (5) Input the feature of the multi-layer aggregation into the output recovery unit to generate the predicted value of the missing position and obtain the complete repair matrix; during the training process, the L1 / L2 hybrid loss under the mask constraint is used as the optimization target to effectively balance robustness and fitting accuracy.
[0050] (6) The method of the present invention can support parallel computing and batch data processing, and is suitable for efficient repair tasks in large-scale sensor network environments. It can be deployed in various application scenarios such as industrial Internet of Things, environmental monitoring, and smart grid, and has good engineering scalability.
[0051] This implementation aims at sensor data restoration. Based on the overall framework of mask-aware spatiotemporal modeling, it designs a deep learning restoration mechanism that integrates adaptive missing representation, mask-constrained decoding, and dual-channel feature aggregation. (Refer to...) Figure 1 As shown. The method can be deployed on the data processing platform of an Internet of Things or industrial monitoring system to repair high-dimensional, sparse, and highly heterogeneous sensor-time observation data matrix, as referenced. Figure 1 As shown, the specific implementation steps of the method of the present invention are as follows.
[0052] (1) Data preparation and mask construction
[0053] In embodiments of the present invention, multi-source observation data is first collected from different node locations of the sensor network. This data can originate from: environmental monitoring sensors (such as temperature and humidity sensors, gas concentration sensors, and PM2.5 monitors); industrial IoT sensors (such as temperature, current, voltage, and vibration accelerometers); and power system sensing sensors (such as smart meters, power distribution monitoring devices, and edge monitoring terminals). The collected raw data are aligned and summarized according to a unified time step K to form a three-dimensional observation matrix.
[0054] ,
[0055] Where: J is the number of sensor nodes; K is the time series length (e.g., number of sampling points at the hour or minute level); and C is the feature dimension collected by each sensor (e.g., temperature, voltage, current, etc.).
[0056] Because communication packet loss, node disconnection, or data anomalies may occur during sensor data acquisition and transmission, this invention defines a mask matrix with the same dimension as X:
[0057] ,
[0058] in, This indicates that sensor j has a valid observation at time point k; This indicates that the location is missing or anomaly. The mask matrix not only marks missing values but is also used as a constraint on the loss function during subsequent training, ensuring that the model calculates the error only at the observed location.
[0059] The data construction process also includes the following preprocessing steps:
[0060] Normalization: Normalize each sensor feature to ensure that features of different dimensions are within the same range and avoid gradient instability;
[0061] Missing padding initialization: For The position can be placed with zero, mean, or random noise before input, but the final training process depends on the missing embedding module proposed in this invention for adaptive modeling.
[0062] Timestamp encoding: Introducing time location encoding enhances the model's ability to capture periodicity and trends.
[0063] Through this step, the present invention can construct a complete "sensor-time-feature" three-dimensional observation data matrix and corresponding mask matrix, providing basic input for subsequent missing embedding, mask-aware spatiotemporal decoding and repair.
[0064] (2) Construct an adaptive missing representation module
[0065] In an embodiment of the present invention, to address the common problem of missing data in sensor-time-feature three-dimensional data, the original feature matrix is first denoted as... Where N is the number of sensor nodes, T is the time step, and C is the feature dimension; a binary mask matrix is also defined. The system identifies observation and missing locations (1 for observation, 0 for missing), and uses a "missing placeholder" tensor of the same shape as X to represent the missing component. To avoid noise introduced by zero / mean pre-padding, this invention directly learns the "observation component representation" and "missing component representation" at the encoder input using a two-way embedding + mask fusion approach. Specifically, the observations are first linearly projected along the feature dimension to obtain the observation embedding with a hidden dimension of d:
[0066] ,
[0067] Its shape is And configure a trainable missing embedding tensor for each "missing location". This tensor is used to carry the semantic representation of the missing locations during the input phase. The binary mask M is then broadcast along the hidden dimension to... The two embeddings are selectively fused at the position level using element-wise multiplication (Hadamard product) to form a unified input representation:
[0068] ,
[0069] M control uses X only at the observation point. o Learnable U is used at missing locations to achieve differentiated modeling of observations / missings and completely remove pre-filled dependencies.
[0070] Based on this, to enhance the model's temporal location awareness capability, this invention... Overlay learnable temporal position embeddings (rather than fixed sinusoidal position encodings), i.e., for each time index A set of parameterized vectors is assigned and added to the corresponding slices to obtain a latent representation that includes temporal priors. This indicates that the process then proceeds to the subsequent spatiotemporal modeling and decoding.
[0071] The above cascaded design of "observation projection - missing embedding - mask fusion - temporal location embedding" ensures that:
[0072] First, missing positions are no longer replaced by fixed constants, thus avoiding statistical offset and noise input;
[0073] Secondly, the observations and missing values enter the subsequent network in a unified form within the same hidden space, which facilitates end-to-end training.
[0074] Third, the mask plays an explicit constraint role in both the forward and loss stages, ensuring that the gradient is updated only around the reconstruction error at the actual observation point, thus maintaining robust representation quality even in scenarios with high missing rates.
[0075] (3) Spatiotemporal decoding module lacking perception
[0076] In an embodiment of the present invention, a spatiotemporal decoding module for missing value perception is proposed to effectively capture dynamic correlations in sensor networks even when a large number of missing values are present. This module explicitly introduces a mask matrix during the decoding process to differentiate between observed and missing locations, thereby ensuring that attention calculations are not interfered with by missing values. Simultaneously, it progressively enhances feature representations through a multi-layered stacked structure.
[0077] In the time dimension, this invention models the dependencies of node sequences through a multi-head attention mechanism. To prevent the propagation of spurious correlations at missing locations, the mask matrix and the correlation matrix are multiplied element-wise when calculating the attention score, ensuring that effective weights are calculated only at the observation locations. Specifically, for the input feature representation... First, calculate the attention score matrix:
[0078] ,
[0079] Where Q and K are the linear transformation results of the query and the key, respectively, and d is the scaling factor. This represents the residual information from the previous layer. Then, a context representation is obtained using mask constraints:
[0080] ,
[0081] Where V is the value matrix, and ⊙ denotes element-wise multiplication.
[0082] Finally, the updated time representation is formed through linear transformation and residual connection:
[0083] ,
[0084] in Presentation layer normalization operation.
[0085] By setting up a spatiotemporal decoding module that eliminates the need for awareness of missing information, attention results can be accumulated in the temporal direction, preventing information loss during deep propagation.
[0086] In the spatial dimension, this invention further considers the structural dependencies between sensor nodes. Unlike graph convolution methods with a fixed adjacency matrix, this module introduces dynamic spatial weights, which adaptively adjust the contribution of neighboring nodes by calculating the correlation scores between nodes and jointly constraining them with the adjacency matrix. For input features... First, it is projected onto several subspaces to obtain the spatial attention matrix. This is then combined with the adjacency matrix A and the mask matrix M to obtain the corrected adjacency representation. This approach preserves topological constraints in the spatial dimension while dynamically optimizing node relationships through a data-driven attention mechanism.
[0087] The entire spatiotemporal decoding module is composed of multiple stacked "temporal attention-spatial attention" blocks, with each block connected by residual connections and normalization operations to ensure stable information propagation. This stacked structure ensures that the model can progressively enhance its ability to capture spatiotemporal dependencies, maintaining the accuracy and robustness of prediction results even with a high proportion of missing values.
[0088] (4) Spatiotemporal dual-channel feature aggregation
[0089] In embodiments of the present invention, a spatiotemporal dual-channel feature aggregation unit is used to simultaneously model the dependencies between sensors in both spatial and temporal dimensions. The core idea of this module is to introduce graph convolution-based adjacency propagation in the spatial direction and correct the contributions of different neighboring nodes through attention weights; in the temporal direction, a multi-scale gated convolution structure is employed to capture multi-level temporal dynamics.
[0090] In the spatial dimension, we first construct the normalized Laplace matrix:
[0091] ,
[0092] Where A is the adjacency matrix and D is the degree matrix. It is the largest eigenvalue.
[0093] Then, Chebyshev polynomial approximation is used for high-order graph convolution propagation:
[0094] ,
[0095] in It is a Chebyshev polynomial of order k. These are learnable parameters.
[0096] To enhance robustness to missing values, this invention further introduces spatial attention weights into the convolution:
[0097] ,
[0098] in The input features are dynamically calculated and used to adaptively adjust the contributions of different neighboring nodes.
[0099] In the time dimension, multi-scale gated convolution (Gated TCN) is employed. For the input sequence... Parallel convolution using different convolution kernels yields:
[0100] ,
[0101] in , Different convolution kernels, and For tanh and sigmoid activation functions, This is an element-wise multiplication.
[0102] The convolutional outputs from multiple scales are concatenated and then fused with the input via residual connections.
[0103] ,
[0104] in This indicates a splicing operation at the channel level.
[0105] Finally, the spatial aggregation results are jointly updated with the temporal aggregation results:
[0106] ,
[0107] in Layer normalization is implemented. This design ensures stable training results even with multiple stacked layers and effectively integrates spatial and temporal information.
[0108] (5) Output recovery and loss calculation
[0109] In embodiments of the present invention, the high-dimensional latent representation obtained after processing by a multi-layer spatiotemporal feature aggregation unit is input to an output restoration unit to generate a complete restoration matrix. This restoration unit typically employs a fully connected mapping layer to transform the hidden feature space into the dimension of the original observation space, ensuring that the output and input data matrices maintain a consistent shape. For the input representation... The prediction result can be obtained through linear mapping:
[0110]
[0111] in This is the final repaired 3D matrix, with dimensions of... .
[0112] In designing the loss function, this invention introduces a mask matrix to ensure that error calculation only occurs at the locations of the true observations. Missing locations are obtained through latent embedding adaptive learning and do not directly participate in the updating of the supervision signal. To balance robustness and accuracy, the loss function adopts a hybrid form of L1 and L2:
[0113]
[0114] Here, α and β are weighting coefficients, used to adjust the effects of sparsity and smoothness during training, respectively. This loss form is robust when there are large missing values and can improve reconstruction accuracy when there is low noise.
[0115] To further stabilize the training process, this invention dynamically adjusts weights during loss calculation based on validation set performance. For example, when the model exhibits overfitting or jittering on the validation set, the weight α of the L1 term is appropriately increased to enhance robustness against outliers and high-noise scenarios; while in scenarios with relatively stable data distribution, the weight β of the L2 term is increased to improve overall fitting accuracy.
[0116] Finally, the matrix output by the recovery module is... This design not only provides reasonable completion values at missing locations but also maintains consistency with the actual data at the observed locations, thereby effectively improving the integrity and reliability of sensor network data. This design ensures that the invention can achieve high-quality data repair even in environments with multi-source heterogeneity, high missing rates, and dynamic noise, providing a solid data foundation for subsequent tasks such as prediction, monitoring, and anomaly detection.
[0117] Example 1: Validation experiment based on multi-source sensor dataset.
[0118] This embodiment validates the sensor data repair method based on mask-sensing spatiotemporal modeling proposed in this invention using real multi-source sensor network datasets. The experiment employed four typical publicly available sensor datasets: PM2.5 concentration data (D1) for Beijing, carbon monoxide concentration data (D2) for Beijing, NOAA sea surface temperature data (D3), and US EPA carbon monoxide monitoring data (D4). These datasets cover various application scenarios, including air quality, meteorological, oceanographic, and environmental monitoring, and possess high-dimensional spatiotemporal characteristics and diverse missing data patterns, comprehensively verifying the applicability and robustness of the proposed method in multi-source sensor networks.
[0119] To evaluate the recovery effect, the experiment used two mainstream evaluation metrics: RMSE (Root Mean Squared Error) and MAE (Mean Absolute Error). Their definitions are as follows:
[0120] ,
[0121] ,
[0122] Where Ω represents the masked missing position, Reconstruct values for the model. This is the actual value.
[0123] In the experimental procedure, a sensor-time-feature matrix is first constructed from the raw data, and a portion of the observations are randomly masked according to a set ratio to form a missing data mask. The data is then input into the adaptive missing data representation module, the missing data-aware spatiotemporal decoding module, and the dual-channel feature aggregation unit proposed in this invention, outputting the repair result. During training, the model loss function is calculated only at the observation locations, while the missing locations are obtained through adaptive learning of the latent embedding vectors.
[0124] For comparative verification, this embodiment selects five representative benchmark methods: ST-LRMA, BR-TVGS, LRDS, TRSS and TimeMixer++, covering a wide range of mainstream methods from traditional interpolation to graph neural networks and temporal deep learning.
[0125] Table 1. Performance of different methods on wireless sensor datasets.
[0126] Metric ST-LRMA BR-TVGS LRDS TRSS TimeMixer++ The model D1-MAE 12.363 9.82 9.567 8.122 9.13 6.075 D1-RMSE 22.756 18.748 18.032 16.292 13.327 11.992 D2-MAE 0.195 0.166 0.165 0.132 0.176 0.126 D2-RMSE 0.437 0.378 0.373 0.313 0.388 0.232 D3-MAE 0.127 0.173 0.126 0.174 0.316 0.102 D3-RMSE 0.175 0.244 0.174 0.244 0.433 0.139 D4-MAE 0.098 0.092 0.115 0.092 0.122 0.066 D4-RMSE 0.192 0.159 0.149 0.148 0.176 0.14
[0127] The experimental results are shown in Table 1. On the four datasets D1–D4, the method of this invention achieves the best performance in all metrics, with a significant average improvement. For example, on D1, the MAE of this method is reduced by 33.4% compared to the best baseline method, and the RMSE is also improved by about 10.0% compared to M5. On D3, this method achieves the minimum MAE and RMSE, fully verifying its superiority in dealing with complex spatiotemporal dependencies and heterogeneous missing patterns. At the same time, the method of this invention maintains stable recovery accuracy in high-noise environments, showing stronger anti-interference ability compared to traditional methods.
[0128] In summary, this embodiment demonstrates that the sensor data repair method based on mask-aware spatiotemporal modeling proposed in this invention significantly outperforms existing methods in various real-world scenarios, exhibiting strong generalization and robustness. This method effectively improves the integrity and reliability of sensor network data, providing high-quality data foundation support for subsequent tasks such as prediction, anomaly detection, and environmental modeling.
[0129] Example 2: To further illustrate the actual operating mechanism of the method of the present invention, the complete calculation process from input construction to output recovery is introduced using data from a single node in a sensor network as an example. Assume that the sensor number is j=105, and that approximately 40% of its observation sequence over a continuous period of T=720 time points is missing, i.e., approximately 288 time points are unobserved. The original input vector of this sensor can be expressed as:
[0130] ,
[0131] ,
[0132] ,
[0133] This forms a complete input sequence.
[0134] The sequence first enters the missing-point-aware temporal attention module, where a mask constraint is introduced into the attention score calculation to reduce interference from missing locations and dynamically allocate weights to neighboring time steps. Next, the sequence is input into a spatial convolutional unit, where the dependency between the sensors is modeled using a normalized adjacency matrix and data-driven attention coefficients. Subsequently, the output is further fed into a multi-scale gated convolution to extract features at different time scales in parallel, simultaneously capturing both short-term fluctuations and long-term trends.
[0135] In the output stage, the aggregated features The predicted sequence is obtained by restoring the original dimensions through a fully connected layer. During training, the loss function is calculated only at the observation locations:
[0136] ,
[0137] Through this process, the present invention can adaptively recover sensor data in scenarios with high missing rates. It can not only effectively repair individual nodes, but also process data in parallel across the entire network, thereby ensuring the applicability and robustness of the method in large-scale sensor networks.
[0138] Example 3: This example proposes an electronic system, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method steps of the present invention.
[0139] Example 4: This example proposes a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the steps of the method described in this invention, which will not be repeated here.
[0140] It should be noted that the processing flow of embodiments 2-4 corresponds to the specific steps of the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0141] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0142] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0143] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solutions based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.
Claims
1. A sensor data recovery method based on mask-aware spatiotemporal modeling, characterized in that, Includes the following steps: S1. Obtain the sensor-time two-dimensional observation matrix with missing values and its corresponding mask matrix, where the mask matrix is used to indicate the observation location and the missing location; S2. Model the missing positions as trainable latent vector representations and map the observations as feature representations. Then, fuse them according to the mask matrix to obtain the input embedding matrix. S3. Based on the input embedding matrix, calculate the mask-aware attention in the time and spatial dimensions respectively to obtain the spatiotemporal feature representation; where the sensor adjacency matrix is used when calculating the attention in the spatial dimension. S4. Combine spatial convolution and multi-scale gated temporal convolution to perform feature aggregation on the spatiotemporal feature representation to obtain the aggregated spatiotemporal features; S5. Based on the aggregated spatiotemporal features, predict the missing values to obtain the complete sensor data matrix, and train the model using the L1 / L2 hybrid loss function constrained by the mask matrix as the optimization objective.
2. The method according to claim 1, characterized in that, make It is a sensor-time two-dimensional observation matrix with missing values. It is its corresponding mask matrix, and the input embedding matrix obtained in step S2 is represented as: , in, For trainable missing embedding vectors, It is a feature representation of the observation value mapping, where Indicates position For the observed values, Indicates missing; the missing embedding vector It is continuously updated during training, with the same feature dimensions, to achieve adaptive modeling of missing data.
3. The method according to claim 1, characterized in that, Step S3 involves calculating mask-aware attention in both the temporal and spatial dimensions to obtain spatiotemporal feature representations. , Where A is the sensor adjacency matrix, M is the binary mask matrix, Q and K are the linear transformation results of the query and key, respectively, V is the value matrix, d is the scaling factor, and ⊙ represents element-wise multiplication.
4. The method according to claim 3, characterized in that, The spatial attention weights are dynamically normalized under the joint constraints of the mask matrix and the adjacency matrix to ensure that missing positions do not participate in neighborhood feature aggregation.
5. The method according to claim 3, characterized in that, In step S4, spatial convolution and multi-scale gated temporal convolution are combined to update the features, specifically as follows: , Where GCN stands for Graph Convolutional Unit, S is a multi-scale set, and TCNs represent temporal convolutional units with different receptive fields. It is the input feature representation, and A is the sensor adjacency matrix.
6. The method according to claim 5, characterized in that, The set of kernel sizes for the multi-scale gated temporal convolution in step S4 is S={3,5,7}, which is used to capture feature dependencies at different temporal granularities.
7. The method according to claim 1, characterized in that, In step S5, the final prediction matrix for predicting missing values is: , The optimization objective is to use the mask-constrained L1 / L2 mixed loss at the observed value as the optimization goal, specifically: , in For the set of observation locations, These are observed values. To predict missing values, Is with The corresponding mask matrix, where α and β are the coefficients of the loss function, is dynamically adjusted based on the performance on the validation set.
8. A sensor data recovery system based on mask-aware spatiotemporal modeling, characterized in that, include: The data preprocessing module is used to obtain the sensor-time two-dimensional observation matrix with missing values and its corresponding mask matrix, wherein the mask matrix is used to indicate the observation location and the missing location; An adaptive missing representation module is used to model missing locations as trainable latent vector representations and map observations to feature representations, and then fuse them according to the mask matrix to obtain the input embedding matrix; The missing perceptual spatiotemporal decoding module is used to calculate mask-aware attention in the temporal and spatial dimensions based on the input embedding matrix to obtain spatiotemporal feature representations; wherein, the sensor adjacency matrix is used when calculating attention in the spatial dimension. The spatiotemporal dual-channel feature aggregation unit is used to combine spatial convolution and multi-scale gated temporal convolution to aggregate spatiotemporal feature representations and obtain aggregated spatiotemporal features. The output recovery unit is used to predict missing values based on the aggregated spatiotemporal features, obtain the complete sensor data matrix, and train the model using the L1 / L2 hybrid loss function constrained by the mask matrix as the optimization objective.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed, it implements the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.
Citation Information
Cited By
Continuous DOA estimation method based on plural Transformers and mask reconstruction
CN121955867A
A continuous DOA estimation method based on complex transformer and mask reconstruction
CN121955867B