A self-supervised based mamba non-intrusive event detection method

CN122925969APending Publication Date: 2026-10-16HANGZHOU GONGSHU DISTRICT EDGE INTELLIGENCE INNOVATION RESEARCH INSTITUTE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611144597.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

现有事件检测方法存在以下局限性:一是传统的统计方法(如CUSUM、GLR)假设信号在事件前后服从不同的固定分布,而真实多设备聚合信号具有强烈非平稳性,该假设在复杂场景下容易失效,导致误报率极高;二是基于深度学习的有监督方法虽然性能较好,但高度依赖精确到毫秒级的人工标注标签,不仅标注成本高昂、存在人为标签噪声,而且面对极端不平衡的正负样本分布,其泛化能力在未见设备类型下会急剧衰减

Benefits of technology

[0033]本发明的有益效果是: 本发明提出了一种基于Mamba的轻量化自监督事件检测框架,在去噪和预训练阶段完全去除了对人工打标签的依赖。 本发明提供的方法利用Mamba状态空间的选择性遗忘与保留能力,在仅7万级别的参数量下实现了针对时间序列的长距离关系建模,可直接部署在边缘计算网关。通过多通道Z-score与多尺度自适应阈值的混合算法机制,在多电器并发的高噪声家庭环境中能够极大限度地抑制虚假触发,精确匹配电器切换的真实时间点。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

The application discloses a kind of Mamba non-intrusive event detection methods based on self-supervision, belong to non-intrusive load monitoring field.The method is in view of the problem that existing event detection technology highly depends on artificial label and weak anti-noise ability, proposes a kind of self-supervision causal prediction paradigm of “predict steady state→capture exception”.Method first to the high-frequency aggregated power grid signal collected is down-sampling and multi-channel power feature extraction, constructs only containing steady-state operation data self-supervision training set;Then construct the selective prediction model based on Mamba, learn the physical evolution law of power grid steady state;Inference is carried out to the future step prediction of full sequence, and the mixed prediction error sequence is extracted;Finally, design the post-processing algorithm of fusion multi-scale Z-score and dynamic adaptive threshold, accurately locate event time.This application does not need event label, realizes high-precision time series modeling with very small parameter amount, effectively suppresses the steady-state background noise interference in multi-device concurrent scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of non-intrusive load monitoring (NILM) and time-series data anomaly detection technology, and more specifically, to a self-supervised Mamba non-intrusive event detection method. Background Technology

[0002] Non-intrusive load monitoring (NILM) systems collect aggregated power signals through smart meters installed in the household distribution box to identify the operating status of each electrical appliance. Load event detection is a fundamental step in accurately extracting the precise moment of appliance startup or shutdown, and its accuracy determines the quality of subsequent classification. Existing event detection methods have the following limitations: First, traditional statistical methods (such as CUSUM and GLR) assume that the signal follows a different fixed distribution before and after the event, while real multi-device aggregated signals have strong non-stationarity. This assumption is prone to failure in complex scenarios, leading to a very high false alarm rate. Second, although supervised methods based on deep learning have good performance, they are highly dependent on manually labeled with millisecond-level precision. This not only results in high labeling costs and the presence of human label noise, but also leads to a sharp decline in generalization ability when faced with extremely imbalanced positive and negative sample distributions and without seeing the device type. Summary of the Invention

[0003] The purpose of this invention is to address the shortcomings of existing technologies by proposing a self-supervised, non-intrusive Mamba event detection method. Through a self-supervised causal prediction paradigm of "predicting steady state → capturing anomalies," it eliminates the dependence on event labels and achieves high-precision time series modeling and steady-state anomaly detection with a minimal number of parameters.

[0004] A self-supervised, non-intrusive Mamba event detection method is provided, including:

[0005] Step 1: Collect the aggregated power signal at the main distribution box of the smart meter in the target scenario, and perform cross-frequency band physical downsampling to obtain the active power, apparent power, reactive power and power factor in each cycle, forming a multi-channel feature sequence;

[0006] Step 2: Extract steady-state intervals from the multi-channel feature sequence, extract input-target sample pairs using a sliding window method, and construct a self-supervised training set;

[0007] Step 3: Construct a self-supervised prediction model including an input embedding layer, a Mamba feature extraction layer, and a prediction head. Train the model using the self-supervised training set to enable the model to learn the steady-state time series pattern of the power grid signal. Step 4: Input the aggregated sequence to be tested into the trained prediction model to obtain the prediction error sequence. The prediction error sequence is obtained by weighted fusion of the model prediction error and the step error.

[0008] Step 5: Perform multi-scale Z-score calculation on the predicted error sequence, and combine dynamic adaptive thresholding and non-maximum suppression (NMS) algorithm to locate the error peak position, and take the error peak position as the time when the load event occurs.

[0009] Preferably, step 1, extracting the multi-channel feature sequence specifically includes: using the power frequency cycle of the power grid base frequency as the basic unit, extracting the active power after periodic moving average. Apparent power obtained by multiplying the effective value of voltage and the effective value of current. Reactive power calculated based on the power triangle And the power factor, which is the ratio of active power to apparent power. .

[0010] Preferably, step 2 includes: Step 2.1.1: Using known event labels or threshold conditions, set buffers before and after the event in the original sequence to exclude non-steady-state data points that may be contaminated by transition effects falling into the buffers; Step 2.1.2: In the buffered and filtered segments, calculate the coefficient of variation of the active power channel, and retain segments whose length exceeds a set duration (e.g., more than 36 downsampling points) and whose coefficient of variation is lower than a set threshold (e.g., 0.05) as pure steady-state intervals; Step 2.1.3: Using a dense sliding window strategy, truncate the first segment from the selected steady-state intervals. The features at each time step are used as input, and then... The features of each time step are used as the regression prediction target to construct a self-supervised regression pair; Step 2.1.4: Use standardization (StandardScaler) to perform global standardization on the multi-channel features to eliminate the differences in dimensions and scales, so that the model gives equal learning attention to each channel of P, Q, and PF.

[0011] Preferably, in step 3, the core of the self-supervised prediction model is a Selective State-Space Model (SSM). The model's establishment and training include: Step 3.1.1, zero-order preserved (ZOH) discretization of the continuous-time state-space model. The discretization parameter transformation formula is:

[0012]

[0013]

[0014] Step 3.1.2: Introduce a Mamba selectivity mechanism to make parameters... , and step length Become dependent on input Functions:

[0015]

[0016]

[0017]

[0018] This mechanism enables dynamic writing, reading, and forgetting control of important features; Step 3.1.3: The prediction model includes two Mamba Layers. Each layer separates the input features into an SSM branch and a gated branch. The SSM branch captures short-range and long-range sequence dependencies, and then merges with the gated branch; Step 3.1.4: During the model training phase, the mean square error (MSE) of the predicted steady-state sequence in future steps is used as the loss function. The AdamW optimizer is used to update the parameters, enabling the model to grasp the temporal evolution of the power grid under normal operating conditions.

[0019] Preferably, in step 4, the calculation process of the prediction error sequence includes: Step 4.1.1, calculating the single-step prediction error for the input window. and the instantaneous step error relative to the previous observation. Perform mixed weighted fusion:

[0020]

[0021] Step 4.1.2: Assign weights to the errors of each channel according to their physical importance. , , Taking into account the influence of different physical characteristics, the total prediction error is calculated as follows:

[0022]

[0023] Step 4.1.3: Take the average of the mean and maximum errors from multiple steps and multiple channels to obtain the final one-dimensional error scalar sequence.

[0024]

[0025] Preferably, in step 5, the event localization process includes: Step 5.1.1, using a robust statistic based on median absolute deviation (MAD) instead of the traditional mean and standard deviation to calculate the Z-score:

[0026]

[0027]

[0028] Step 5.1.2: Calculate the robust Z-score for short, medium, and long local window widths, and then extract the median using a majority voting mechanism for fusion.

[0029]

[0030] Step 5.1.3: Automatically adjust the dynamic detection threshold based on the ratio of the current local noise level to the global noise level.

[0031]

[0032] Step 5.1.4, Judgment Score exceeding dynamic threshold The peak points are used as candidate events. Finally, redundant candidate points in a short period of time are removed by non-maximum suppression based on error score (Score-Aware NMS), and the highest score is retained as the exact occurrence time of the load event.

[0033] The beneficial effects of this invention are as follows: This invention proposes a lightweight self-supervised event detection framework based on Mamba, completely eliminating the reliance on manual labeling during the denoising and pre-training stages. The method provided by this invention utilizes the selective forgetting and retention capabilities of the Mamba state space to achieve long-distance relationship modeling for time series with only 70,000 parameters, and can be directly deployed on edge computing gateways. Through a hybrid algorithm mechanism of multi-channel Z-score and multi-scale adaptive thresholding, it can significantly suppress false triggers and accurately match the actual time points of appliance switching in high-noise home environments with multiple concurrent appliances. Attached Figure Description

[0034] Figure 1 The present invention provides an overall flowchart of a load event detection method based on Mamba.

[0035] Figure 2 This is a schematic diagram of the steady-state segment extraction and data preprocessing pipeline in an embodiment of the present invention.

[0036] Figure 3 This is a diagram illustrating the overall architecture of the end-to-end steady-state causal prediction model in an embodiment of the present invention.

[0037] Figure 4 This is a flowchart of the adaptive dynamic residual event detection algorithm that integrates multi-scale Z-score and NMS in an embodiment of the present invention. Detailed Implementation

[0038] The present invention will be further described below with reference to embodiments. The descriptions of the embodiments below are merely for the purpose of helping to understand the present invention. It should be noted that those skilled in the art can make various modifications to the present invention without departing from its principles, and these modifications and improvements also fall within the scope of protection of the claims of the present invention. The algorithm flow is as follows: Figure 1As shown. Example 1: This application embodiment addresses the problem of aggregated power event detection in a real home environment, aiming to extract the on / off times of appliances from the total power of the incoming electricity meter. The data to be processed typically consists of high-frequency (e.g., 30kHz) current and voltage signals.

[0039] Step 1: Input the raw signal collected by the meter, perform cross-frequency band physical downsampling and extract features to obtain the active power, apparent power, reactive power and power factor in each cycle.

[0040] Step 2: Extract steady-state intervals to construct the training set. To avoid contamination from event transition effects, a data buffer of 0.17 seconds is set before and after the transition. MAD is used to remove abnormal states, and aggregated segments containing only pure steady states are extracted. The training input-output feature pairs are then truncated using a sliding method.

[0041] Step 3: Perform autoregressive pre-training using an improved Mamba prediction model. The model includes RMSnorm normalization and a Pre-Norm residual structure, and performs ultra-fast scanning on a GPU to forward propagate the steady-state sequence and approximate the steady-state evolution trajectory.

[0042] Step 4: When the complete time series is input into the model, output the prediction error series. Combining multi-dimensional channels , , The error performance is proportionally combined.

[0043] Step 5: Integrate multi-scale Z-score calculation with dynamic adaptive judgment. For example, in noisy scenes, adaptively reduce sensitivity to capture... If the score exceeds the set peak value, Score-Aware NMS is used to remove duplicates from overlapping candidates that are very close to each other (e.g., within 40 sampling points) and output the final device switching time (event occurrence time).

Claims

1. A self-supervised, non-intrusive Mamba event detection method, characterized in that, Includes the following steps: Step S1: Collect the aggregated power signal at the main distribution box of the smart meter in the target scenario, and perform cross-frequency band physical downsampling to extract the active power, apparent power, reactive power and power factor in each cycle to form a multi-channel feature sequence; Step S2: Extract steady-state intervals from the multi-channel feature sequence, extract input-target sample pairs using a sliding window method, and construct a self-supervised training set; Step S3: Construct a self-supervised prediction model that includes an input embedding layer, a Mamba feature extraction layer, and a prediction head. Use the self-supervised training set to train the model so that it learns the steady-state time-series patterns of the power grid signal. Step S4: Input the aggregated sequence to be tested into the trained prediction model to obtain the prediction error sequence, which is obtained by weighted fusion of the model prediction error and the step error; Step S5: Perform multi-scale Z-score calculation on the predicted error sequence, combine dynamic adaptive thresholding and non-maximum suppression (NMS) algorithm to locate the error peak position, and take the error peak position as the time when the load event occurs.

2. The method according to claim 1, characterized in that, In step S1, downsampling and feature extraction specifically include: taking the power frequency cycle of the power grid base frequency as the basic unit, extracting the active power, apparent power, reactive power after periodic moving average, as well as the power factor of the ratio of active power to apparent power, and applying median filtering to eliminate noise pulses.

3. The method according to claim 1, characterized in that, In step S2, the process of extracting the steady-state interval includes: setting a buffer based on known labeled events or prior knowledge to exclude non-steady-state data points, and retaining steady-state interval segments whose duration and variance meet the set threshold.

4. The method according to claim 1, characterized in that, In step S3, the Mamba feature extraction layer of the prediction model adopts a gated fusion mechanism, which multiplies the output of the selective state space model (SSM) with the gated branch element by element to achieve selective retention of feature components of different input information.

5. The method according to claim 1, characterized in that, In step S4, when calculating the total error, the active power, reactive power and power factor channels are weighted and summed according to a preset physical importance ratio.

6. The method according to claim 1, characterized in that, In step S5, the multi-scale Z-score calculation includes: calculating the robust Z-score of the prediction error in local windows of three different time scales (short, medium, and long), and taking the median of the Z-scores at the three scales as the fusion anomaly score.

7. The method according to claim 1 or 6, characterized in that, In step S5, when determining the abnormal score, a dynamic adaptive threshold mechanism based on the local noise level is adopted, and the error of the candidate time point is required to meet the local extreme value constraint and the change ratio test. Finally, the NMS algorithm based on the error score is used to remove duplicate points within the time distance.