Carbon emission metering anomaly detection method and system based on artificial intelligence
By preprocessing the time series data of carbon emissions and extracting multi-scale frequency feature, combined with the reconstruction of the encoder-decoder architecture, the problem of insufficient abnormal detection accuracy of the existing carbon emission measurement method in complex power systems is solved, and high-precision abnormal detection is achieved.
Patent Information
- Application Number
- CN202510152744.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-07-08
AI Technical Summary
When facing complex power systems, existing carbon emission measurement methods have problems such as insufficient abnormal detection accuracy, high false alarm rate and high false alarm rate, especially in the data processing of dynamic changes and nonlinear characteristics.
Using an abnormal detection method of carbon emission measurement based on artificial intelligence, the query vector Q, key matrix K and value vector V are generated after preprocessing the carbon emission time series data, and the dynamic frequency module is used to extract multi-scale frequency features, combine with the memory module to store normal sample features, and reconstruct the data using the encoder-decoder architecture to judge the abnormal state by means of mean square error.
It improves the abnormal detection accuracy of carbon emission measurement, can effectively capture the frequency and time domain characteristics of the data, suppress excessive generalization, and achieve accurate abnormal detection.
Smart Images

Figure CN120277569A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power metering, and in particular to a method and system for detecting abnormal carbon emissions based on artificial intelligence. Background Art
[0002] With the gradual increase in the global control of carbon emissions, the power industry is the main source of energy consumption and carbon dioxide emissions. The carbon emissions measurement in the power system mainly relies on real-time power consumption data and is converted through carbon emission coefficients. However, with the popularization of new power equipment such as smart grids, distributed energy systems, and electric vehicles, the structure of the power system has become more complex, and the carbon emissions measurement process faces the following technical problems: In the power grid and the power consumption side, the measurement of carbon emissions depends on the energy consumption data provided by acquisition devices (such as electro-carbon meters and smart meters). However, due to sensor failures, data transmission delays, or noise interference, abnormal deviations may occur in the carbon emission data, resulting in inaccurate or missing data, affecting the reliability of the overall carbon emission assessment. As typical time series data, carbon emission data has complex time and frequency characteristics and contains a large amount of noise. In actual operation, due to factors such as power equipment failures, user behavior fluctuations, or grid instability, abnormal values may occur in carbon emissions measurement. These abnormal states usually exhibit non-linear characteristics and are difficult to detect and identify through traditional statistical methods. Existing abnormal detection methods, such as neural networks, support vector machines, and random forests, although they can detect abnormal data to a certain extent, often have problems of insufficient detection accuracy, high false alarm rate, and high miss rate when facing data with dynamic changes, high noise, and non-linear characteristics. Summary of the Invention
[0003] In view of this, the present application provides a method for detecting abnormal carbon emissions based on artificial intelligence, which solves the technical problems of insufficient accuracy in detecting abnormal carbon emissions, inability to effectively process non-linear characteristics, and dynamic change data in the prior art.
[0004] According to the first aspect of the present application, a method for detecting abnormal carbon emissions based on artificial intelligence is provided, including: Obtaining time series data of carbon emissions collected by an electricity metering device and performing data preprocessing; Performing a linear transformation on the preprocessed time series data of carbon emissions to generate a query vector Q, a key vector K, and a value vector V, where the dimensions of Q, K, and V are all f×H×L, f is the feature dimension, H is the number of attention heads, and L is the time series length; The query matrix Q and the key matrix K are respectively input into a dynamic frequency module for processing. The dynamic frequency module includes three parallel branches. Among them, the first branch directly performs a fast Fourier transform (FFT); the second branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C¹; the third branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C², where C² is greater than C¹. The FFT output of each branch is input into a memory module for feature storage and reconstruction. Among them, the memory module contains a memory matrix M with a dimension of N×f, which is used to store the frequency feature patterns of N normal samples. Calculate the correlation of the corresponding features of the reconstructed query matrix Q and key matrix K, transform them to the time domain through an inverse transform (IFFT), and generate weight features through an attention mechanism. Perform P time delay operations on the value matrix V, and dynamically synthesize the delayed features with the largest P values in the weight features, where P is a preset positive integer. Reconstruct the synthesized features through an encoder-decoder architecture. The encoder includes a first linear layer and a first group of LSTM units, and the decoder includes a second group of LSTM units and a second linear layer. Calculate the mean square error between the preprocessed carbon emission time series data of the input and the reconstructed samples. When the mean square error is greater than a preset threshold, it is determined to be an abnormal state; otherwise, it is determined to be a normal state.
[0005] According to the second aspect of the present application, an artificial intelligence-based carbon emission measurement anomaly detection system is provided, including: An acquisition module, which is used to acquire the carbon emission time series data collected by an electricity measurement device and perform data preprocessing. A transformation module, which is used to perform a linear transformation on the preprocessed carbon emission time series data to generate a query vector Q, a keyword vector K, and a value vector V, where the dimensions of Q, K, and V are all f×H×L, f is the feature dimension, H is the number of attention heads, and L is the time series length. A processing module, which is used to input the query matrix Q and the key matrix K into a dynamic frequency module for processing respectively. The dynamic frequency module includes three parallel branches. Among them, the first branch directly performs a fast Fourier transform (FFT); the second branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C¹; the third branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C², where C² is greater than C¹. A memory module, which is used to input the FFT output of each branch into the memory module for feature storage and reconstruction. Among them, the memory module contains a memory matrix M with a dimension of N×f, which is used to store the frequency feature patterns of N normal samples. A calculation module, configured to calculate the correlation between the corresponding features of the reconstructed Q and K, transform them to the time domain through the inverse Fourier transform IFFT, and generate weighted features through an attention mechanism; A synthesis module, configured to perform P-time delay operations on the value matrix V, and perform dynamic information synthesis on the delayed features and the largest P values in the weighted features, where P is a preset positive integer; A reconstruction module, configured to reconstruct the synthesized features through an encoder-decoder architecture, where the encoder includes a first linear layer and a first group of LSTM units, and the decoder includes a second group of LSTM units and a second linear layer; A judgment module, configured to calculate the mean square error between the preprocessed carbon emission time series data of the input and the reconstructed samples. When the mean square error is greater than a preset threshold, it is determined to be in an abnormal state, otherwise it is determined to be in a normal state.
[0006] The present invention provides an artificial intelligence-based carbon emission measurement anomaly detection method and system. By performing standardized preprocessing on carbon emission time series data and generating a query matrix Q, a key matrix K, and a value matrix V; inputting Q and K into a dynamic frequency module with three parallel branches, extracting multi-scale frequency features through dynamic convolutions and FFT transforms of different scales, and using a memory matrix to store and reconstruct features; after calculating the feature correlation and converting it back to the time domain, performing a time delay operation on V and performing dynamic information synthesis; reconstructing the synthesized features through an encoder-decoder architecture, and judging the abnormal state based on the reconstruction error. The present invention effectively captures the frequency domain and time domain features of the data, suppresses overgeneralization, and realizes accurate carbon emission measurement anomaly detection.
[0007] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, and to be able to implement it according to the content of the specification, and in order to make the above and other purposes, features, and advantages of the present application more obvious and understandable, the specific embodiments of the present application are specifically given below. Description of the Drawings
[0008] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation of the present application. In the drawings: Figure 1 It shows a schematic diagram of an application scenario of an artificial intelligence-based carbon emission measurement anomaly detection method provided in an embodiment of the present application; Figure 2 It shows a schematic flowchart of an artificial intelligence-based carbon emission measurement anomaly detection method provided in an embodiment of the present application; Figure 3Shows a schematic diagram of the network structure of the carbon emission measurement anomaly detection model based on artificial intelligence provided in the embodiments of the present application; Figure 4 Shows a schematic diagram of the structure of a carbon emission measurement anomaly detection system based on artificial intelligence provided in the embodiments of the present application. Detailed implementation manners
[0009] The detailed implementation manners of the present application will be described in detail below with reference to the drawings and in combination with the embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.
[0010] A carbon emission measurement anomaly detection method based on artificial intelligence provided by an embodiment of the present invention can be applied to a scenario as Figure 1 shown. In this scenario, distributed power equipment (such as industrial equipment, commercial buildings, residential electrical equipment, etc.) collects real-time electricity consumption data through smart meters and calculates carbon emissions based on the electricity consumption. These carbon emission data are transmitted to the cloud server through the Internet of Things, and the method of the present invention deployed on the server monitors the data in real time. When an abnormal state is detected, the system timely issues a warning to the management personnel to help identify abnormal carbon emission situations that may be caused by equipment failures, abnormal electricity consumption behaviors, measurement deviations, etc., providing decision-making support for carbon emission management and energy scheduling. This method is particularly suitable for carbon emission monitoring of large-scale distributed energy systems, capable of timely detecting and handling abnormal conditions, and improving the operation efficiency and reliability of the overall system.
[0011] The embodiments of the present invention have made relevant improvements based on the Auto Encoder. The Auto Encoder in the prior art can automatically learn high-level features from normal data and capture complex and non-linear patterns in the data. When encountering abnormal samples, significant reconstruction errors will be generated, thereby detecting abnormal states. However, the measurement characteristics of the electro-carbon meter are related to time, and its state will change according to the current power consumption pattern, load change, grid carbon emission factor, and the dynamic coefficient of the carbon emission calculation formula. This means that the same electricity measurement value and carbon emission may have different meanings at different time periods. For example, a high power consumption during peak load may be normal, but a similar power consumption characteristic during off-peak hours may indicate abnormal equipment or abnormal line losses. However, this time correlation is often ignored by traditional Auto Encoder methods. In addition, the measurement behavior of the electro-carbon meter usually depends on frequency characteristics. These characteristics are stable during normal grid operation, but in abnormal situations, such as line harmonic interference or aging of electrical equipment, the frequency characteristics may deviate. For example, line harmonics may cause a decrease in measurement accuracy, and aging equipment may show abnormal frequency changes in power consumption. However, the Auto Encoder is not sensitive enough to these frequency correlations. Finally, considering the time series complexity of the electro-carbon meter data (such as non-linear energy consumption patterns and instantaneous load fluctuations), the Auto Encoder usually needs to set a large number of parameters, which results in its over-strong generalization ability, effectively reconstructing some abnormal samples and causing the detection to fail.
[0012] To solve the above problems, the embodiments of the present invention propose a brand-new unsupervised abnormal state detection model (carbon emission measurement abnormal detection model) applicable to the time series of electro-carbon meters. The model includes an input mapping module, a multi-scale frequency feature extraction module, a feature synthesis module, a time series reconstruction module, and a loss function calculation module. The input mapping module is used to map the carbon emission measurement time series data into query Q, key K, and value V. The multi-scale frequency feature extraction module is used to extract the multi-scale frequency features of the carbon emission measurement time series data. The feature synthesis module is used to aggregate the multi-scale frequency features. The time series reconstruction module is used to perform time series reconstruction on the aggregated multi-scale frequency features. The loss function calculation module is used to calculate the reconstruction error. The multi-scale frequency feature extraction module in this model is used to capture the multi-scale frequency features and local correlations hidden in the electro-carbon meter measurement data; the time series reconstruction module models the long-term dependence relationship of the time series.
[0013] The multi-scale frequency feature extraction module combines the advantages of dynamic convolution and fast Fourier transform (FFT), improving the model's ability to capture frequency correlations. Dynamic convolution can adaptively adjust the convolution kernel size, thus more flexibly capturing local and global features in the time domain. The model can detect the frequency patterns of the electro-carbon meter measurement data at various time scales. Through the fast Fourier transform after multi-scale dynamic convolution, the weighted generated frequency features are fed into the memory module. The memory module can memorize the normal electricity consumption patterns and carbon emission data features during the training phase, and reconstruct the input samples based on these memory items, thereby assisting in distinguishing normal and abnormal states.
[0014] The time series reconstruction module (including LSTM layers) receives the frequency correlation features enhanced by the attention mechanism output from the feature synthesis module and further analyzes the evolution of these features. The internal gating mechanism of the LSTM layers in the time series reconstruction module can proficiently filter data and retain important time points, thus ignoring irrelevant data. In this way, the LSTM layers can detect subtle abnormal changes in the electro-carbon meter measurement, such as short-term fluctuations in electricity load or abnormal increases in carbon emissions.
[0015] The embodiment of the present invention proposes a carbon emission measurement anomaly detection model applicable to electro-carbon meter measurement data. This model can efficiently process complex power and carbon emission time series data and is an end-to-end unsupervised model. By introducing dynamic frequency memory, correlation attention mechanism, and LSTM layers, it effectively captures the frequency characteristics and time correlations of electro-carbon meter measurement data, improving the detection accuracy. After the fast Fourier transform FFT, a memory mechanism is added (the memory items are encoded and reorganized according to the similarity of latent representations, encouraging the model to extract global patterns and suppressing the over-generalization problem of the model) to memorize the features of normal samples, thereby reducing the over-generalization problem of the model and improving the robustness of anomaly detection. The performance of this model on the actual operation dataset of electro-carbon meters is significantly better than other representative models and existing technologies, especially having strong detection capabilities in scenarios of non-linear load changes and harmonic interference.
[0016] The anomaly state detection method of the embodiment of the present invention trains a model based on historical data to reconstruct input samples, and compares the reconstruction results with the input samples to detect the anomaly state. This method makes better use of global information and is generally more stable than other methods in the prior art.
[0017] The present invention will be described in detail below through specific embodiments.
[0018] As Figure 2 shown, a carbon emission measurement anomaly detection method based on artificial intelligence provided in the embodiment of the present invention includes: Step 201: Obtain the time series data of carbon emissions collected by the electricity metering device and perform data preprocessing; Among them, n time series data of carbon emissions collected by the electricity metering device are obtained, where the number of feature of the time series data of carbon emissions is f, and the length of the time series of carbon emissions is L; In the preprocessing process, the time series data of carbon emissions in each dimension are normalized through the formula for normalization, is the maximum value of the column where d is located in D, and the minimum value is the minimum value of the column where d is located in D.
[0019] Step 202: Perform a linear transformation on the preprocessed time series data of carbon emissions to generate a query vector Q, a keyword vector K, and a value vector V; Among them, the processed time series data of carbon emissions are mapped to a query vector Q, a keyword vector K, and a value vector V. Among them, the query vector , the keyword vector , the value vector , is the preprocessed time series data of carbon emissions, , and are weight matrices, and the dimensions of the mapped vectors Q, K, and V are all f×H×L, where f is the feature dimension, H is the number of attention heads, and L is the time series length.
[0020] Step 203: Input the query matrix Q and the key matrix K into the dynamic frequency module for processing respectively; Among them, the dynamic frequency module includes three parallel branches. The first branch directly performs a fast Fourier transform (FFT); The second branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C¹; The third branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C², where C² is greater than C¹; The steps of the dynamic convolution in the second branch and the third branch include: Step 203-1: Perform global average pooling on the input x; Among them, the input is the query vector Q and the keyword vector K. After pooling the input features [f, H, L], each feature corresponding to the attention head and the L time points are averaged into one value for each feature of [f, H].
[0021] Step 203-2: Use the ECA-Net model to calculate the kernel attention weight, where the dynamic convolution kernel , represents the parallel convolution kernel with the i-th dimension being , is the weight of the i-th convolution kernel, that is, the attention weight, and g represents the number of parallel convolution kernels. is the number of output channels, is the number of input channels, and C is the number of convolutional kernels; Step 203-3: Perform a convolution operation on the compressed input x to obtain an output feature y, where , is a dynamic convolutional kernel, b is a bias term, and L is the length of the time series.
[0022] Step 204: Input the FFT output of each branch into the memory module for feature storage and reconstruction; Among them, the memory module includes a memory matrix M with dimensions N×f for storing the frequency feature patterns of N normal samples; Step 204 specifically includes: Step 204-1: Initialize the memory matrix using the random initialization method, where the dimensions of the memory matrix are , N is the preset number of memory items, and f is the feature dimension; Step 204-2: Train the memory matrix using normal samples; Step 204-3: Calculate the attention weight and the memory item where, , , is a preset extremely small positive number, is a preset threshold; Step 204-4: Reconstruct and output the frequency features according to the memory item and the attention weight .
[0023] Step 205: Calculate the correlation between the features of the reconstructed query matrix Q and key matrix K, transform them to the time domain through the inverse transform IFFT, and generate weight features through the attention mechanism; Step 205 specifically includes: Step 205-1: Perform a complex multiplication operation on each pair of and to obtain three groups of correlation features in the frequency domain, where i takes integer values from 1 to 3, corresponds to the three outputs of the reconstructed query matrix Q, corresponds to the three outputs of the reconstructed query matrix K, q1 is paired with k1 (corresponding to the first branch), q2 is paired with k2 (corresponding to the second branch), and q3 is paired with k3 (corresponding to the third branch); Step 205-2: Perform an IFFT transform on the three groups of correlation features in the frequency domain to the time domain to obtain three groups of time domain features; Step 205-3: Process and compress the three groups of time-domain features through ECA-Net to obtain , and obtain the normalized attention weights through SoftMax , is the length of the time series, represents the i-th largest value in AttCorr, the i-th largest time index, represents the j-th value in
[0024] Step 206: Perform P time-delay operations on the value matrix V, and perform dynamic information synthesis on the P largest values in the delayed features and the weight features; Among them, Step 206 specifically includes: Step 206-1: Perform P shift operations on the input sequence of the value matrix V to obtain P shifted sequences , where represents moving the time points before in V to the end of the sequence. The sequence length of the input sequence of matrix V is L, where P is a preset positive integer; Step 206-2: Perform dynamic information synthesis on the P shifted sequences after delay and the P largest values in the weight features .
[0025] Step 207: Reconstruct the synthesized features through an encoder-decoder architecture; Among them, the encoder includes a first linear layer and a first LSTM unit, and the decoder includes a second LSTM unit and a second linear layer; on the encoding side, the first linear layer maps the synthesized features to a suitable dimensional space, and then extracts deep temporal features through 4 cascaded first LSTM units. Among them, each LSTM unit contains a forget gate, an input gate, and an output gate; on the decoding side, the temporal information is gradually restored through 4 cascaded second LSTM units. Each LSTM unit is responsible for reconstructing features at different levels. The second LSTM unit controls the information flow through a gating mechanism, gradually converts the abstract features back to specific features, and maps the features back to the original feature space through the second group of linear layers to obtain the reconstructed samples.
[0026] Step 208: Calculate the mean square error between the preprocessed carbon emission time series data of the input and the reconstructed samples. When the mean square error is greater than the preset threshold, it is determined to be in an abnormal state, otherwise it is determined to be in a normal state.
[0027] Through the reconstruction loss function Calculate the preprocessed carbon emission time series data of the input and the reconstructed samples The mean square error between them.
[0028] An embodiment of the present invention proposes an abnormal detection method for carbon emission measurement based on artificial intelligence. The input mapping module is used to map the carbon emission measurement time series data into query Q, key K, and value V. The multi-scale frequency feature extraction module is used to extract the multi-scale frequency features of the carbon emission measurement time series data. The feature synthesis module is used to aggregate the multi-scale frequency features. The time series reconstruction module is used to reconstruct the time series of the aggregated multi-scale frequency features. The loss function calculation module is used to calculate the reconstruction error. The multi-scale frequency feature extraction module in this model is used to capture the multi-scale frequency features and local correlations hidden in the carbon meter measurement data. The long-term dependence relationship of the time series is modeled in the time series reconstruction module.
[0029] Figure 3 It is the network structure of the abnormal detection model for carbon emission measurement based on artificial intelligence provided by the embodiment of the present invention. Among them, the preprocessing module is responsible for preprocessing the carbon emission time series data collected by the electricity measurement device. The preprocessing may include steps such as data cleaning and normalization to ensure the quality and consistency of the input data. The dynamic frequency module receives the preprocessed data and converts it into query matrix Q, key matrix K, and value matrix V. These matrices will be input into the dynamic frequency module, which includes three parallel branches. Each branch processes the data slightly differently. The first branch directly performs the fast Fourier transform (FFT). The second branch performs FFT after using dynamic convolution with a kernel size and stride of C¹. The third branch performs FFT after using dynamic convolution with a kernel size and stride of C², where C² is greater than C¹. The purpose of these branches is to extract multi-scale frequency features to capture different frequency components in the data. The memory module is used to store and reconstruct features. It contains a memory matrix M with a dimension of N×f, which is used to store the frequency feature patterns of N normal samples. By memorizing the features of normal samples, this module helps the model distinguish between normal and abnormal states. 4. The first linear layer receives the output from the memory module and maps it to an appropriate dimensional space to prepare for the subsequent LSTM layer. The first LSTM unit extracts deep time series features. Each LSTM unit contains a forget gate, an input gate, and an output gate. These gating mechanisms help the model learn the long-term dependence relationship in the time series data. The second linear layer and the second group of LSTM units are used to gradually restore the time series information and convert the abstract features back into specific features. The second group of LSTM units controls the information flow through the gating mechanism and is responsible for reconstructing features at different levels. The loss function judgment module calculates the mean square error between the input preprocessed carbon emission time series data and the reconstructed samples. If the mean square error is greater than the preset threshold, it is determined to be in an abnormal state; otherwise, it is determined to be in a normal state. The abnormal alarm module will trigger an abnormal alarm when the system determines an abnormal state, notifying the management personnel for further inspection and processing.
[0030] Further, as Figures 2 to 3 a specific implementation of the method, an embodiment of the present invention provides a carbon emission measurement anomaly detection system based on artificial intelligence, as Figure 4 shown, the system includes: An acquisition module 410, configured to acquire time series data of carbon emissions collected by an electricity measurement device and perform data preprocessing; A transformation module 420, configured to perform a linear transformation on the preprocessed time series data of carbon emissions to generate a query vector Q, a keyword vector K, and a value vector V, where the dimensions of Q, K, and V are all f×H×L, f is the feature dimension, H is the number of attention heads, and L is the time series length; A processing module 430, configured to input the query matrix Q and the key matrix K into a dynamic frequency module for processing respectively. The dynamic frequency module includes three parallel branches. Among them, the first branch directly performs a fast Fourier transform FFT; the second branch performs an FFT after performing a dynamic convolution with a kernel size and a stride of C¹; the third branch performs an FFT after performing a dynamic convolution with a kernel size and a stride of C², and C² is greater than C¹; A memory module 440, configured to input the FFT output of each branch into the memory module for feature storage and reconstruction. The memory module includes a memory matrix M with a dimension of N×f, which is used to store the frequency feature patterns of N normal samples; A calculation module 450, configured to calculate the correlation of the corresponding features of the reconstructed Q and K, transform them to the time domain through an inverse transform IFFT, and generate weight features through an attention mechanism; A synthesis module 460, configured to perform P time delay operations on the value matrix V, and perform dynamic information synthesis on the delayed features and the largest P values in the weight features, where P is a preset positive integer; A reconstruction module 470, configured to reconstruct the synthesized features through an encoder-decoder architecture. The encoder includes a first linear layer and a first group of LSTM units, and the decoder includes a second group of LSTM units and a second linear layer; A judgment module 480, configured to calculate the mean square error between the input preprocessed time series data of carbon emissions and the reconstructed samples. When the mean square error is greater than a preset threshold, it is determined to be in an abnormal state, otherwise it is determined to be in a normal state.
[0031] It should be noted that in the above embodiments, only smart meters are used to illustrate the principles and implementation steps of the embodiments of the present invention. The actual application scenarios are not specifically limited. For example, electric carbon meters, carbon emission monitoring modules in energy management systems (EMS), carbon emission metering devices for power transformers and substations, real-time carbon emission monitoring equipment for power plants, etc. The technical solutions of the present invention can also be applied to the measurement fault prediction of other power grid-related instruments. Regarding the functions or steps that can be achieved by a computer-readable storage medium or a computer device, reference can be made to the foregoing method embodiments correspondingly. To avoid repetition, they will not be described one by one here.
[0032] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0033] Those skilled in the art can clearly understand that for the convenience and brevity of description, only the above division of each functional unit and module is used for illustration. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0034] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. An abnormal detection method for carbon emission measurement based on artificial intelligence, characterized in that, Including: Obtain the time series data of carbon emissions collected by the electricity metering device and perform data preprocessing; Perform a linear transformation on the preprocessed time series data of carbon emissions to generate a query vector Q, a keyword vector K, and a value vector V. Among them, the dimensions of Q, K, and V are all f×H×L, where f is the feature dimension, H is the number of attention heads, and L is the time series length; Input the query matrix Q and the key matrix K into the dynamic frequency module for processing respectively. The dynamic frequency module includes three parallel branches. Among them, the first branch directly performs a fast Fourier transform (FFT); the second branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C¹; the third branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C², and C² is greater than C¹; Input the FFT output of each branch into the memory module for feature storage and reconstruction. Among them, the memory module contains a memory matrix M with a dimension of N×f, which is used to store the frequency feature patterns of N normal samples; Calculate the correlation of the corresponding features of the reconstructed query matrix Q and key matrix K, transform them to the time domain through the inverse transform IFFT, and generate weight features through the attention mechanism; Perform P time delay operations on the value matrix V, and perform dynamic information synthesis on the delayed features and the largest P values in the weight features, where P is a preset positive integer; Reconstruct the synthesized features through an encoder-decoder architecture. The encoder includes a first linear layer and a first group of LSTM units, and the decoder includes a second group of LSTM units and a second linear layer; Calculate the mean square error between the input preprocessed time series data of carbon emissions and the reconstructed samples. When the mean square error is greater than the preset threshold, it is determined to be in an abnormal state, otherwise it is determined to be in a normal state.
2. The method for abnormal detection of carbon emission measurement based on artificial intelligence according to claim 1, wherein, The steps of obtaining the time series data of carbon emissions collected by the electricity metering device and performing data preprocessing include: Obtain n time series data of carbon emissions collected by the electricity metering device. Among them, the number of features of the time series data of carbon emissions is f, and the length of the time series of carbon emissions is L; The time series data of carbon emissions for each dimension is normalized by the formula , where is the maximum value in the column where d is located in D, and the minimum value is the minimum value in the column where d is located in D.
3. The method for detecting abnormal carbon emission measurement based on artificial intelligence according to claim 1, wherein, The steps of performing a linear transformation on the preprocessed time series data of carbon emissions to generate a query vector Q, a keyword vector K, and a value vector V include: The processed carbon emission time series data is mapped into a query vector Q, a keyword vector K, and a value vector V, where the query vector , the keyword vector , the value vector , is the preprocessed carbon emission time series data, , and are weight matrices, and the dimensions of the mapped vectors Q, K, and V are all f×H×L, where f is the feature dimension, H is the number of attention heads, and L is the time series length.
4. The method for abnormal detection of carbon emission measurement based on artificial intelligence according to claim 1, wherein, The steps of dynamic convolution include: Compress the spatial information of the input x through global average pooling; Calculate the kernel attention weight using the ECA-Net model, where the dynamic convolution kernel , represents the i-th parallel convolution kernel with a dimension of , is the weight of the i-th convolution kernel, i.e., the attention weight, g represents the number of parallel convolution kernels, is the number of output channels, is the number of input channels, and C is the number of convolution kernels; Performing a convolution operation on the compressed input x to obtain the output feature y, where, , is a dynamic convolution kernel, b is a bias term, and L is the length of the time series.
5. The method for detecting abnormal carbon emission measurement based on artificial intelligence according to claim 1, wherein The steps of inputting the FFT output of each branch into the memory module for feature storage and reconstruction include: Initialize the memory matrix using a random initialization method, where the dimension of the memory matrix is , N is the preset number of memory items, and f is the feature dimension; Train the memory matrix with normal samples; According to the input frequency feature and the memory item calculate the attention weight , where , is a preset extremely small positive number, is a preset threshold; According to the memory item and the attention weight reconstruct and output the frequency feature.
6. The method for abnormal detection of carbon emission measurement based on artificial intelligence according to claim 1, characterized in that, The steps of calculating the correlation of the corresponding features of the reconstructed query matrix Q and key matrix K, transforming them to the time domain through the inverse transform IFFT, and generating weight features through the attention mechanism include: For each pair and perform complex multiplication operations to obtain three sets of correlation features in the frequency domain, where i takes integer values from 1 to 3, corresponding to the three outputs of the reconstructed query matrix Q, corresponding to the three outputs of the reconstructed query matrix K; Perform an IFFT transformation on the correlation features in the three groups of frequency domains to the time domain to obtain three groups of time domain features; The three groups of time-domain features are processed and compressed by ECA-Net to obtain , and the normalized attention weights are obtained through SoftMax , is the length of the time series, represents the i-th largest value in AttCorr, the i-th largest time index, represents the j-th value in 7. The method for detecting abnormal carbon emission measurement based on artificial intelligence according to claim 6, characterized in that The steps of performing P time delay operations on the value matrix V and performing dynamic information synthesis on the delayed features and the largest P values in the weight features include: Perform P shift operations on the input sequence of the value matrix V to obtain P shifted sequences , where means moving the time point before in V to the end of the sequence, and the sequence length of the input sequence of matrix V is L; Perform dynamic information synthesis on the P shifted sequences after delay and the largest P values in the weight features .
8. The method for detecting abnormal carbon emission measurement based on artificial intelligence according to claim 2, wherein, The steps of reconstructing the synthesized features through an encoder-decoder architecture include: The first set of linear layers maps the synthesized features to an appropriate dimensional space, and then extracts deep temporal features through 4 cascaded first LSTM units. Each LSTM unit contains a forget gate, an input gate, and an output gate; The temporal information is gradually restored through 4 cascaded second LSTM units. Each LSTM unit is responsible for reconstructing features at different levels. The second LSTM unit controls the information flow through a gating mechanism, gradually converting the abstract features back to concrete features, and maps the features back to the original feature space through the second set of linear layers to obtain the reconstructed samples.
9. The method for detecting abnormal carbon emission measurement based on artificial intelligence according to claim 2, wherein The calculation of the mean square error between the preprocessed carbon emission time series data of the input and the reconstructed samples specifically includes: Through the reconstruction loss function Calculate the preprocessed carbon emission time series data of the input And the reconstructed samples The mean square error between them 10. An artificial intelligence-based carbon emission measurement anomaly detection system, characterized in that, It includes: An acquisition module, which is used to acquire the carbon emission time series data collected by the electricity metering device and perform data preprocessing; A transformation module, which is used to perform a linear transformation on the preprocessed carbon emission time series data to generate a query vector Q, a key vector K, and a value vector V. The dimensions of Q, K, and V are all f×H×L, where f is the feature dimension, H is the number of attention heads, and L is the time series length; A processing module, which is used to input the query matrix Q and the key matrix K into the dynamic frequency module for processing respectively. The dynamic frequency module includes three parallel branches. Among them, the first branch directly performs a fast Fourier transform (FFT); the second branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C¹; the third branch performs an FFT after using a dynamic convolution with a kernel size and a stride of C², and C² is greater than C¹; A memory module, which is used to input the FFT output of each branch into the memory module for feature storage and reconstruction. The memory module contains a memory matrix M with a dimension of N×f, which is used to store the frequency feature patterns of N normal samples; A calculation module, which is used to calculate the correlation of the corresponding features of the reconstructed Q and K, transform them to the time domain through an inverse Fourier transform (IFFT), and generate weight features through an attention mechanism; A synthesis module, which is used to perform P time delay operations on the value matrix V, and perform dynamic information synthesis on the delayed features and the largest P values in the weight features, where P is a preset positive integer; A reconstruction module, which is used to reconstruct the synthesized features through an encoder-decoder architecture. The encoder includes a first linear layer and a first set of LSTM units, and the decoder includes a second set of LSTM units and a second linear layer; A judgment module, which is used to calculate the mean square error between the preprocessed carbon emission time series data of the input and the reconstructed samples. When the mean square error is greater than a preset threshold, it is determined to be in an abnormal state, otherwise it is determined to be in a normal state.