A method and system for deep lossless compression of high-frequency power data

By designing a T-Transformer model based on Transformer and a power data compression method combining Gaussian prior module, relative position coding and multi-head self-attention mechanism, the lossless compression problem of power data in the existing technology is solved, efficient power data compression and decompression is achieved, and hardware resource requirements are reduced.

CN115913247BActive Publication Date: 2025-05-13STATE GRID JIANGSU ELECTRIC POWER CO LTD NANJING POWER SUPPLY COMPANY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211275331.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-18
Publication Date
2025-05-13
Estimated Expiration
2042-10-18

AI Technical Summary

Technical Problem

The existing deep compression perception algorithm is not suitable for lossless compression of power data, especially when facing massive home users' electricity data, commonly used deep learning methods will increase model training time and data processing time, and have high requirements for hardware resources, making it difficult to meet the deployment of data acquisition and transmission equipment.

Method used

A deep lossless compression method for high-frequency power data is designed, and the T-Transformer model based on Transformer is adopted, combining Gaussian prior module, relative position coding and multi-head self-attention mechanism to extract the characteristics of power data, and lossless compression is performed through arithmetic coding and bit coding.

Benefits of technology

Lossless compression of power data is realized, the performance of compression algorithm is improved, the problems of sparse data, difficulty in identifying complex patterns, and inability to utilize data semantic correlation are solved, and the model training time and hardware resource requirements are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115913247B_ABST
    Figure CN115913247B_ABST
Patent Text Reader

Abstract

A method and system for deep lossless compression of high-frequency power data, which uses self-attention to mine local information of data to design a new T-Transformer model, adds Gaussian priors, and strengthens the correlation of data; uses an arithmetic encoder to compress the model output probability; finally, bit encoding is used for the encoded interval to further improve the compression performance, save data storage space, and achieve efficient lossless compression of power data. Traditional power compression algorithms can only be limited to sinusoidal frequency data, such as wavelet transform, and the compression performance of physical parameter data such as amperes and volts in the measured electricity consumption of household areas is significantly reduced. The present invention proposes a deep lossless compression scheme, which provides a deep model that can solve the problem of difficulty in segmenting the feature space of power data from a semantic perspective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, relates to the compression of electric power data, and is a deep lossless compression method for high-frequency electric power data. Background Art

[0002] Compression plays a vital role in information transmission. Compared with Nyquist sampling, compressed sensing has lower requirements for sampling conditions. Its special sampling method breaks the limitations of Nyquist sampling theorem and has higher computational efficiency. In traditional power compression algorithms, the reconstruction effect is poor when the data segment is in an unstable state, and it is difficult to analyze changes in signal frequency. Different from the data measured by synchronous vectors, minute-level power data is measured and transmitted in real-time data. The compression and recovery of residential electricity consumption data in power grid statistics has become an urgent need for relevant departments.

[0003] In recent years, the demand for electricity supply for household users has increased. The electricity meter needs to transmit the electricity consumption value of each household in the living area, and the storage and transmission work has become very important. On the one hand, the electric meter in the living area cannot completely collect all continuous power data, but a set of discrete time series. The measured values ​​are not continuous and there are null values. Moreover, the electricity consumption data of different users are different and there is no obvious correlation between them. The classic compression algorithm of the existing technology is difficult to compress and analyze such data. On the other hand, the classic lossy compression will cause great data loss on such a large amount of household user data, affecting the accuracy of electricity data collection. With the development of computer artificial intelligence technology, deep learning methods have provided great help to data modeling. There have been some studies on deep compressed sensing solutions. However, in the face of massive electricity consumption data and the requirements for data losslessness and accuracy, the commonly used method of improving the depth of the network to improve performance will increase the model training time and data processing time, increase the hardware resource requirements for data processing equipment, and is not conducive to the deployment of data collection and transmission equipment. Summary of the invention

[0004] The technical problem to be solved by the present invention is that the existing deep compressed sensing algorithm is not suitable for compressing power data, and it is necessary to provide a solution that can achieve lossless compression of power data.

[0005] The technical solution of the present invention is: a method for deep lossless compression of high-frequency power data, which performs lossless compression on collected residential power consumption data, comprising the following steps:

[0006] 1) Designing a power data feature extraction model T-Transformer, which is based on the Transformer model and adds Gaussian prior modules to the Encoder and Decoder. The T-Transformer model is trained with historical residential electricity consumption data to learn the features of residential electricity consumption data;

[0007] 2) Input the power data to be compressed into the T-Transformer model, output the attention features of the power data, and obtain the output vector through the linear transformation layer;

[0008] 3) Encode the output vector by arithmetic coding to obtain the probability interval;

[0009] 4) Bit encoding is performed on the probability interval obtained by encoding to complete data compression;

[0010] 5) Use a decoder to decompress the compressed data.

[0011] The present invention also provides a high-frequency power data deep lossless compression system, which is configured with a computer storage medium, and the computer-readable storage medium stores a computer program, and when the computer program is executed, the above method is implemented.

[0012] The present invention designs a T-Transformer model as a training network. Compared with the strong correlation between words in text data, the sequence structure of power data and the weak correlation between each floating-point number lead to difficulties in semantic segmentation. The present invention uses the Self-Attention structure to extract features to avoid the loss of transmitted information due to long-term dependence in the case of data loss, and instead mines local information of the data.

[0013] Furthermore, when processing power data, the present invention uses relative position coding instead of absolute position coding to extract data position features and construct data vectors. Considering the instability of local data information and the difficulty in distinguishing the association between data, a Gaussian prior module is added to improve the correlation of dimensional information and enhance the ability of self-attention to capture local features.

[0014] After constructing the data dictionary through relative position coding, the power data will be converted into coordinate vectors and input into the T-Transformer network to obtain data features. After data learning, the multi-dimensional data features will be converted into one-dimensional interval codes through full connection. Each dimension represents the degree of relationship with the data at that position in the dictionary. Finally, the probability of the data that may appear in the next position is obtained through softmax transformation.

[0015] The residential electricity consumption data is minute-level data. Compared with the high-power mode of industrial electricity consumption data, the residential electricity consumption data has a weak periodicity in fluctuation frequency. In particular, considering the efficiency of the transmission end, data collection is often the electricity consumption data of multiple users in the same minute. The periodicity of this data in the time domain and frequency domain can be basically ignored. The measured value of household electricity consumption is the real-time standard electricity consumption, including voltage, current, and power. There are cases of unstable data fluctuation domain and drastic changes in a certain section of the data, which makes the commonly used compression methods in the prior art, such as wavelet transform, etc., have a considerable loss in the reconstruction results in this case. Therefore, the data type and data transmission mode targeted by the present invention are both unique.

[0016] The high-frequency power data deep lossless compression method of the present invention has the following beneficial effects:

[0017] 1. Introducing the Transformer-based model In the field of lossless compression of power data, the Transformer-based multi-head attention mechanism is not subject to long-term dependence and does not lose position information. It effectively solves the impact of the instability of power data on feature extraction and reduces the potential search space during data training.

[0018] 2. Considering that high-frequency power data has weak semantic features, dense data distribution, and difficulty in capturing features through self-attention, the present invention designs a T-Transformer model, which combines relative position encoding, multi-head self-attention, and Gaussian prior modules to comprehensively improve data training speed and training effect.

[0019] 3. The deep model is combined with arithmetic coding to effectively improve the performance of the compression algorithm; it solves the problems of data sparsity, difficulty in identifying complex patterns, and inability to utilize data semantic correlation that exist in most power compression algorithms. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a flow chart of the present invention.

[0021] Figure 2 This is a network model diagram in the present invention.

[0022] Figure 3 A diagram of the method steps in the present invention.

[0023] Figure 4 This is the arithmetic coding algorithm structure of the present invention.

[0024] Figure 5 It is a schematic diagram of the bit encoding structure of the present invention.

[0025] Figure 6 It is a schematic diagram of the data decompression result diagram of the present invention. DETAILED DESCRIPTION

[0026] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0027] like Figure 1 As shown, the present invention proposes a high-frequency power data deep lossless compression method, comprising the following steps:

[0028] (1) Design the T-Transformer model to learn the characteristics of power data;

[0029] (2) Input the power data to be compressed into the training model, output the attention features of the power data, and obtain the output vector through the linear transformation layer;

[0030] (3) Encode the output vector by arithmetic coding to obtain the probability interval;

[0031] (4) bit encoding the probability interval obtained by encoding to complete data compression;

[0032] (5) The decoder decompresses the compressed data after the communication process.

[0033] Among them, T-Transformer is designed as a pre-trained model. Due to the instability and weak semantics of high-frequency power data, relative position coding and Gaussian prior modules are added to the network to enhance the extraction of data features and the learning ability of different sequence power data, such as power, voltage, and current. Arithmetic coding and bit coding algorithms are used to encode probability intervals to obtain compressed data and improve compression efficiency.

[0034] The high-frequency power data deep lossless compression method of the present invention is implemented by a computer program, and mainly includes three modules: a generation module, a compression module and a decompression module. The present invention is specifically implemented as follows.

[0035] (1) Model training

[0036] In order to make the network more capable of learning the sequence characteristics of high-frequency power data, the present invention designs a T-Transformer network as a training model. High-frequency power data is densely distributed and unstable, and semantic feature extraction is difficult. It is a floating point number, while the multi-head attention mechanism of T-Transformer is not subject to long-term dependence and directly calculates the correlation between each word. There is no loss of past information. The Gaussian prior module can improve the feature expression of adjacent data. Figure 2 As shown, a structural diagram of the T-Transformer model of the present invention is shown.

[0037] (2) Generate module

[0038] T-Transformer consists of two parts: Encoder and Decoder. The present invention first preprocesses the input data, in which the relative position encoding of each data is calculated. This allows the model to adapt to data of different lengths and saves calculations. The formula is:

[0039]

[0040] In formula (1), sine and cosine functions are used for calculation because they are periodic. At even positions, sine coding is used, and at odd positions, cosine coding is used. Where ps is the absolute position of the data, i is the i-th dimension of the data vector, and dm is the dimension of the data vector.

[0041] The attention vectors at each attention calculation in the multi-head attention mechanism in the Encoder are concatenated to obtain the Encoder features, which expands the model's ability to focus on different positions. The present invention adds a Gaussian prior module before inputting the attention mechanism. The correlation between each floating-point number in the power data is not strong, and it is difficult to refer to the semantic space of the corresponding word in the data. Features can only be found in time. In addition, affected by the data collection conditions, there is a loss of about 20% in the residential electricity consumption data itself. The T-Transformer model designed by the present invention uses self-attention to analyze data features, and increases the weights of close positions through the designed Gaussian prior module to improve the correlation of data dimensions, strengthen the ability of self-attention to capture local features, and improve the training effect on non-periodic data. Figure 2 As shown, the input data first passes through the Gaussian prior module to obtain the new i-th data vector X i :

[0042]

[0043] Position encoding is to find the position vector of a data and use it as the input of the model. Formula (2) of the present invention is to optimize the input vector. In formula (2), w is the weight, b is the deviation, and x is the i Indicates the central data currently being processed, x j represents other data, d is the distance formula, and x is obtained i and x j distance.

[0044] The data vector after Gaussian prior is passed into multi-head attention, and the multi-head attention formula is expressed as:

[0045] MultiHead(Q,K,V)=Concat(H1,H2)W O (3)

[0046] In formula (3), H1 and H2 are two self-attention modules of multi-head attention, W O is the weight. Among them, self-attention H i The calculation formula is:

[0047]

[0048] In formula (4), Attention is self-attention, Q is the query matrix, K is the content to be paid attention to, QK T It is a dot product operation, the purpose of which is to calculate the attention weight of Q on V; It is the scaling of the dot product. After layer normalization, the output feature vector is calculated using the feedforward network layer. The calculation formula is:

[0049] FFN(x)=Dense2(Relu(Dense1(x))) (5)

[0050] Formula (5) uses two layers of Dense and one layer of Relu activation function. Each sublayer of the Encoder module is followed by a residual calculation, and FFN is a feedforward network. The structure of the Decoder is similar to that of the Encoder. This module receives the output of the Encoder and finally outputs a predicted feature vector, which is then output through the softmax function to output the output vector of the next predicted data.

[0051] (3) Compression module

[0052] like Figure 3 As shown, the overall steps of the method of the present invention are to call the model to obtain the power characteristics of the collected residential power consumption data, and compress them through a coding method. The coding method used in the embodiment of the present invention is arithmetic coding, and finally output the compressed bit code.

[0053] The power data to be compressed is a multi-digit number. After each data is processed by the T-Transformer model, an output vector corresponding to the multi-digit number is obtained, such as Figure 4 As shown, arithmetic coding is a lossless data compression method. The idea is to input a data, output the probability interval of the next data, and update the probability interval. The embodiment in the figure is to represent the probability of 4 numbers of four-bit voltage data in a probability interval. First, according to the output vector calculated by the softmax function, the probability interval of the first digit is found in the interval [0,1], and the interval range is updated. Then, the probability interval that the second digit may appear is found, and so on. Finally, the probability interval that can represent the simultaneous appearance of four digits is obtained.

[0054] Bit encoding is Figure 5 As shown, in Figure 4After obtaining the updated probability interval, use low to represent the left boundary of the interval and high to represent the right boundary of the interval. Since the probability is within [0,1], the decimal parts of the two edge values ​​are converted into binary representation. The two binary data are compared bit by bit, and the data is intercepted at the first different position. The data after that is discarded, and the same binary data result is retained as the final bit stream result, so as to further save the precision length of the encoding result.

[0055] (4) Decompression module

[0056] like Figure 6 As shown in an example, minute-level power data of 200 electric meters are selected and decompressed using the corresponding compressed decompressor of the present invention. (a) is the original data, and (b) is the decompressed result, wherein the horizontal axis represents the user and the vertical axis represents the power value.

[0057] In summary, the deep lossless compression method for high-frequency power data described in the present invention fully combines the knowledge of deep learning and compressed sensing to realize the method of lossless compression of high-frequency power data; considering that the semantic features of high-frequency power data are weak and the data distribution is dense and unstable, the T-Transformer model is designed to learn the features of power data, so that the school effect on non-periodic data is improved; arithmetic coding combined with improved bit coding is used to compress the quantized power features, which effectively improves the compression efficiency; finally, a decoder is used to decompress the compressed data after communication transmission to decompress the original data, thereby realizing deep lossless compression of high-frequency power data.

Claims

1. A high-frequency power data deep lossless compression method, characterized in that: The collected residential electricity consumption data is losslessly compressed, including the following steps: 1) Designing a power data feature extraction model T-Transformer, which is based on the Transformer model and adds Gaussian prior modules to the Encoder and Decoder. The T-Transformer model is trained with historical residential electricity consumption data to learn the features of residential electricity consumption data; The T-Transformer model is based on the Transformer model. Gaussian prior is added before the Encoder and Decoder. The input power consumption data is first preprocessed to calculate the relative position encoding of each data. The formula is: Using sine and cosine functions to calculate, at even positions, use sine encoding to get the even position encoding PE ps,2i , at odd positions, use cosine coding to get odd position coding PE ps,2i+1 , where ps is the absolute position of the data, i is the i-th dimension of the data vector, and dm is the dimension of the data vector; Among them, the attention vector is extracted by the multi-head attention mechanism in the Encoder, and the Encoder feature is obtained after splicing. Before the attention processing, a Gaussian prior module is added to strengthen the structure of self-attention to capture local features, and the new i-th data vector X is obtained. i : In formula (2), w is the position weight, b is the deviation, and x i Represents the current center data, x j represents other data, d is the distance formula, and the data vector after Gaussian prior is obtained through multi-head self-attention. After layer normalization, the feedforward network layer is used to obtain the output feature vector of the Encoder: FFN(x)=Dense2(Relu(Dense1(x))) (5) Formula (5) uses two layers of Dense function and one layer of Relu activation function. Each sublayer of the Encoder is followed by a residual calculation. FFN is a feedforward network. The structure of Decoder corresponds to that of Encoder, receiving the output of Encoder and outputting the predicted feature vector; 2) Input the power data to be compressed into the T-Transformer model, output the attention features of the power data, and obtain the output vector through the linear transformation layer; 3) Encode the output vector through arithmetic coding to obtain the probability interval; First, process the power data to be compressed according to the T-Transformer model to obtain the corresponding output vector, find the probability interval of the first digit in the interval [0,1] according to the number of bits of the power data to be compressed, and update the interval range, then find the probability interval where the second digit may appear, and so on, and finally obtain the probability interval representing the simultaneous appearance of all digits of the power data; 4) Bit encoding is performed on the probability interval obtained by encoding to complete data compression; after obtaining the final probability interval, low is used to represent the left boundary of the interval, and high is used to represent the right boundary of the interval, and the decimal parts of the two side values ​​are converted into binary representation, and the two binary data are compared bit by bit, and the first different positions are intercepted, and the subsequent data are discarded, and the same binary data results are retained as the final bit stream results to complete the compression; 5) Use a decoder to decompress the compressed data.

2. The high-frequency power data deep lossless compression method according to claim 1, characterized in that: The process of the decoder decompressing the compressed data after the communication process includes: The compressed data after communication is input into the decoder, and the original data is decompressed by the decoder.

3. A high-frequency power data deep lossless compression system, characterized in that: A computer storage medium is configured, and a computer program is stored on the computer readable storage medium. When the computer program is executed, the method described in claim 1 or 2 is implemented.

Citation Information

Patent Citations

  • Multi-level image compression method using Transform

    CN113709455A

  • Data compression method and device, electronic equipment and storage medium

    CN114722774A