A gas use behavior identification method and system based on temperature time series data and an LSTM network
By using an LSTM network method based on temperature time-series data, and leveraging multi-scale feature encoding and an adaptive gated attention layer, the problems of misjudgment and interference in gas consumption behavior recognition in existing technologies are solved, achieving high-precision, low-cost, and privacy-friendly gas consumption behavior recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI ZHIBO PHOTOELECTRIC TECHNOLOGY CO LTD
- Filing Date
- 2026-06-04
- Publication Date
- 2026-07-03
AI Technical Summary
In existing smart kitchen systems, gas usage behavior recognition methods based on threshold judgment have insufficient recognition capabilities when facing complex kitchen environments. They are prone to misjudgment, cannot distinguish complex behaviors, have poor anti-interference capabilities, resulting in a limited number of recognition types and the need for frequent calibration.
A recognition method based on temperature time series data and LSTM network is adopted. Data is collected by a single temperature sensor, and after preprocessing, an LSTM network model is constructed. Multi-scale feature encoding and adaptive gating attention layer are used to extract gas consumption behavior features to achieve fine-grained recognition.
It achieves high-precision identification of various gas usage behaviors in complex kitchen environments, reduces hardware costs, protects user privacy, and reduces post-deployment calibration work.
Smart Images

Figure CN122332874A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent detection and pattern recognition technology for combustible gases, and in particular to a method and system for recognizing gas consumption behavior based on temperature time-series data and LSTM networks. Background Technology
[0002] In smart kitchen systems, the automatic and precise identification of gas usage behavior to control appliances such as range hoods and cooktops is the core foundation for achieving seamless intelligent interaction and safe, energy-saving management. However, how to achieve stable identification of various fine-grained gas usage behaviors under the stringent constraints of fully protecting user privacy and relying solely on extremely low-cost sensors has always been a bottleneck restricting the large-scale adoption of this technology in the home improvement aftermarket.
[0003] Currently, in scenarios where temperature data is used to sense the status of gas usage, the industry generally adopts a technical solution based on threshold judgment and temperature curve feature analysis. The typical workflow of this solution is as follows: First, a single temperature sensor collects temperature values above the stove or at the bottom of the pot at a fixed frequency; then, the collected temperature sequence undergoes basic smoothing and noise reduction; next, based on a set of pre-set absolute temperature thresholds or temperature difference change rate thresholds, segments in the temperature curve that meet specific conditions are determined to be in states such as "on" or "off". For example, when the temperature value exceeds a preset start-up threshold and continues to rise, it is determined as an "on" event.
[0004] However, the threshold-based scheme described above suffers from fundamental technical flaws in its recognition capabilities and robustness under the complex conditions of a real home kitchen. First, the identification of gas usage behavior essentially relies on the "pattern" of temperature changes, rather than a specific "temperature value." Different cookware materials, food quantities, stove power levels, and even the season can all cause significant overall shifts in the absolute value and slope of the temperature curve. Fixed threshold rules are highly susceptible to errors such as missing "starting the stove" detection or misidentifying "oil heating" as "starting the stove" when faced with such changes. This necessitates frequent manual recalibration when deploying the system across different scenarios, essentially rendering it useless. Furthermore, because the feature extraction rules upon which this scheme relies are entirely explicitly defined manually, they can only respond to a few single events where the temperature exceeds a fixed limit, and are completely unable to distinguish complex behaviors with highly similar temperature curve shapes but drastically different underlying mechanisms. For the actions of "adding ingredients" and "adding water," both manifest as sudden drops in local temperature on the temperature curve. Relying solely on the temperature difference threshold at a single moment and the subsequent temperature rise slope, these actions are easily confused due to the dynamic differences in the impact of ingredients and water volume on temperature. Furthermore, the rule-based approach completely fails to distinguish between the high-frequency, low-amplitude fluctuations of "stir-frying" and the long-term, gradual, stable state of "simmering over low heat."
[0005] The root cause of these shortcomings lies in the threshold-based judgment mechanism's lack of ability to model the long- and short-term contextual dependencies in temperature time-series data. Essentially, it relies on a memoryless, single-point or short-window discrimination logic, failing to capture the temporal evolution characteristics that constitute the essence of behavior. Simultaneously, this scheme is highly sensitive to noise in the temperature signal. Random fluctuations caused by sensor background noise and local thermal convection, combined with the high-frequency, low-amplitude fluctuations of the stirring motion, create aliasing at the feature level, further exacerbating the risk of misjudgment. This structural deficiency makes the threshold-based scheme, when faced with non-stationary, noisy, and multi-modal overlapping temperature signals in real cooking processes, extremely limited in its ability to identify different types of signals and poor in its anti-interference capabilities—a significant technical hurdle that is difficult to overcome. Summary of the Invention
[0006] To address the aforementioned issues, this invention provides a method and system for recognizing gas consumption behavior based on temperature time-series data and an LSTM network. This invention utilizes one or more temperature sensors to collect temperature time-series data during gas consumption, preprocesses the temperature time-series data (including sliding window segmentation and normalization), constructs and trains an LSTM network model, and inputs the preprocessed temperature time-series data into the trained LSTM network model to output the cooking behavior category corresponding to the current moment. This invention requires only a single type of sensor (temperature sensor), eliminating the need for multimodal sensors such as cameras and microphones, significantly reducing hardware deployment costs and system complexity. By using an LSTM network to model the long-term and short-term dependencies of temperature time-series data, it can automatically learn the temperature change pattern features corresponding to different cooking behaviors, achieving fine-grained, multi-category cooking behavior recognition. It does not use visual sensors, fully protecting user privacy. This invention achieves online real-time recognition of continuous temperature flow through sliding window segmentation, achieving the technical effects of low cost, high accuracy, privacy friendliness, and fine-grained recognition.
[0007] To achieve the above objectives, the technical solution adopted by this invention is: a method for identifying gas consumption behavior based on temperature time-series data and an LSTM network, comprising the following steps: S1: Acquire continuous time-series temperature data from the cooking area; S2: Preprocess the temperature time series data to obtain multiple temperature time series data segments; S3: Construct an LSTM network model, which includes a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. The multi-scale feature encoding layer encodes the temperature time series data segments into short-window temperature sequences and long-window temperature sequences, and then inputs them into the parameter-sharing first LSTM layer and second LSTM layer respectively to extract their respective hidden state vector sequences. The adaptive gated attention layer dynamically weights the hidden state vector sequences through a gating mechanism to suppress noise time steps, obtaining a first weighted feature vector and a second weighted feature vector. The feature fusion layer concatenates the first weighted feature vector, the second weighted feature vector, and a preset temperature time series engineering feature vector to obtain a fused feature. S4: Input the fused features into the fully connected layer and the Softmax output layer, and output the gas consumption behavior category corresponding to the current moment.
[0008] Preferably, the first LSTM layer contains 64 LSTM units and outputs a forward and backward hidden state concatenation vector for each time step to capture local temperature dynamics.
[0009] Preferably, the second LSTM layer contains 32 LSTM units to extract higher-order temporal dependencies and retain the time step dimension, providing sequence features for the adaptive gated attention layer.
[0010] Preferably, the gating mechanism satisfies the following relationship: Attention weight α t : ; Gating value g t : ; Among them, W g b g For learnable parameters, S For the Sigmoid function; e t For time step t Attention score; h t For LSTM layers at time steps t The output hidden state vector; e j For the first j Attention score at each time step; g j Indicates the first j The gating value for each time step.
[0011] Preferably, the preprocessing includes segmenting by a sliding window and independently performing Z-score normalization on each window.
[0012] Preferably, the preprocessing further includes smoothing filtering, and a moving average filter is used to remove high-frequency noise in the temperature time series data.
[0013] Preferably, the Z-score normalization includes: calculating the mean value of the temperature values within the current window μ and the sample standard deviation σ , the normalized value , when σ approaches 0, the normalized value within this window is set to 0.
[0014] Preferably, the window length N of the sliding window segmentation is 60 to 300 sampling points, the sliding step size M is 10 to 50 sampling points, and M < N, and there is an overlapping area between adjacent windows.
[0015] Preferably, the temperature time series data is collected by a temperature sensor at a sampling frequency of 1 Hz to 50 Hz.
[0016] Preferably, the time length of the short-window temperature sequence is 5 seconds; the time length of the long-window temperature sequence is 30 seconds.
[0017] Preferably, the preset temperature time series engineering feature vector includes statistical features and key event features; the statistical features include mean, variance, range, skewness, and kurtosis; the key event features include the number of temperature mutations, heating rate, cooling rate, and the zero-crossing rate of the first-order difference of temperature.
[0018] Preferably, the calculation process of the LSTM units in the first LSTM layer and the second LSTM layer satisfies the following relational expressions: The output of the forget gate f t : The output of the input gate i t : The candidate cell state : The cell state at the current moment C t : The output of the output gate o t : The hidden state at the current moment h t: ; in, x t The temperature value entered at the current moment. h t-1 This is the hidden state from the previous moment. C t-1 This represents the cell state at the previous moment. S It is the Sigmoid activation function. W f , W i , W c and W o These are the weight matrices corresponding to the forget gate, input gate, candidate cell state, and output gate, respectively. b f , b i , b c and b o These correspond to the bias vectors of the forget gate, input gate, candidate cell state, and output gate, respectively.
[0019] A gas consumption behavior recognition system is used to execute the above-mentioned gas consumption behavior recognition method, including: a data acquisition module for acquiring continuous temperature time-series data collected in the cooking area; The data preprocessing module is used to preprocess the temperature time series data to obtain multiple temperature time series data segments; the preprocessing includes sliding window segmentation and performing Z-score normalization independently on each window; The LSTM network model includes a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. The multi-scale feature encoding layer encodes the temperature time-series data segment into short-window and long-window temperature sequences, which are then input into the parameter-sharing first and second LSTM layers to extract their respective hidden state vector sequences. The adaptive gated attention layer dynamically weights the hidden state vector sequences using a gating mechanism to suppress noise time steps, obtaining a first weighted feature vector and a second weighted feature vector. The feature fusion layer concatenates the first weighted feature vector, the second weighted feature vector, and a preset temperature time-series engineering feature vector to obtain a fused feature. The identification output module is used to input the fused features into the fully connected layer and the Softmax output layer, and output the gas consumption behavior category corresponding to the current moment.
[0020] An application control module, connected to the identification output module, is used to receive the gas consumption behavior category and send control commands to one or more kitchen devices according to the gas consumption behavior category.
[0021] By adopting the above technical solution, the present invention has the following beneficial effects.
[0022] (1) This invention solves the problems of low accuracy and susceptibility to noise interference in recognizing various types of gas consumption behaviors under non-stationary temperature signals by combining multi-scale temperature time-series feature encoding with an adaptive gated attention mechanism. The preprocessed temperature time-series data segments are encoded in parallel into short-window temperature sequences and long-window temperature sequences, which are respectively fed into the first LSTM layer and the second LSTM layer with shared parameters to extract instantaneous change features and macroscopic trend features simultaneously. The adaptive gated attention layer performs gated modulation on the attention score, so that the contribution of stationary time steps unrelated to gas consumption behavior is suppressed to near zero. The recognition results are no longer sensitive to the gradual change of kitchen ambient temperature and the background noise of the sensor, and the robustness of recognition in real kitchen scenarios is fundamentally improved.
[0023] (2) The gating value and attention score of this invention are calculated in the same forward propagation flow, forming an end-to-end joint optimization. During the training of the LSTM network model, the temporal dependency modeling of the forget gate, input gate, and output gate control in the first and second LSTM layers is mutually fed back and converged collaboratively with the temporal weighting process of the adaptive gating attention layer control. While preserving the complete temporal context, the network automatically focuses on time steps that are highly correlated with key gas consumption behaviors, such as temperature cliff drops and high-frequency fluctuations, without the need for manual threshold setting or keyframe annotation. This achieves self-extraction of complex gas consumption behavior features using only a single temperature sensor.
[0024] (3) This invention solves the problems of low accuracy and susceptibility to noise interference in recognizing various types of gas consumption behaviors under non-stationary temperature signals by combining multi-scale temperature time-series feature encoding with an adaptive gated attention mechanism. The preprocessed temperature time-series data segments are encoded in parallel into short-window temperature sequences and long-window temperature sequences, which are respectively fed into the first LSTM layer and the second LSTM layer with shared parameters to extract instantaneous mutation features and macroscopic trend features simultaneously. The weighted feature vector purified by gated attention in this invention is concatenated with the temperature time-series engineering feature vector containing statistical features and key event features such as mean, variance, range, number of temperature mutations, and heating rate at the feature fusion layer to form an enhanced architecture that complements physical priors and data-driven approaches. Engineering features are explicitly injected with inductive biases that have clear physical meanings. Fusion occurs after invalid time steps are filtered out. The deep feature vectors involved in fusion are condensed representations that retain the core behavioral semantic information. They can describe complex cooking state spaces with lower feature dimensions, reduce the computational burden of downstream classification layers, and allow the trained model to be directly transferred under different cookware materials, fire levels, and ambient temperatures, reducing the need for secondary calibration after deployment.
[0025] (4) This invention performs Z-score normalization independently on each temperature time series data segment, and sets all normalized values in the window to 0 when the standard deviation of the temperature value in the window approaches zero, providing support for high-discrimination identification of low-dynamic gas consumption behavior. The temperature sequences in the stable stage of "simmering over low heat" and the natural cooling stage after "turning off the heat" may show a slow change trend in the local window, but the behavioral meanings are different. Conventional global normalization is difficult to distinguish whether the small fluctuations are real behavioral changes or measurement noise. When the temperature fluctuation is extremely small, the window is actively zeroed. A data-driven adaptive behavior differentiation mechanism is constructed in the preprocessing stage. After the zeroed window enters the LSTM network, it does not activate the dynamic time series response. The network can distinguish it from the dynamic event window based on the all-zero input feature, thereby focusing the parameter capacity on the identification of high-dynamic and high-confusion behavior categories, and improving both the identification accuracy and computational efficiency.
[0026] (5) This invention collects time-series temperature data during the gas consumption process using one or more temperature sensors, preprocesses the temperature time-series data (including sliding window segmentation, normalization, etc.), constructs and trains an LSTM network model, inputs the preprocessed temperature time-series data into the trained LSTM network model, and outputs the cooking behavior category corresponding to the current moment. This invention only requires a single type of sensor (temperature sensor), eliminating the need for multimodal sensors such as cameras and microphones, greatly reducing hardware deployment costs and system complexity; by using an LSTM network to model the long-term and short-term dependencies of temperature time-series data, it can automatically learn the temperature change pattern features corresponding to different cooking behaviors, achieving fine-grained, multi-category cooking behavior recognition; it does not use visual sensors, fully protecting user privacy; this invention achieves online real-time recognition of continuous temperature flow through sliding window segmentation, achieving the technical effects of low cost, high precision, privacy-friendly, and fine-grained recognition. Attached Figure Description
[0027] The following provides a detailed discussion of the manufacture and application of preferred embodiments of the present invention. However, it should be understood that the present invention provides many applicable inventive concepts that can be embodied in various specific environments. The specific embodiments discussed are merely illustrative of specific ways of manufacturing and using the present invention and do not limit the scope of the invention. For those skilled in the art, other drawings can be obtained from these drawings without any creative effort.
[0028] Figure 1 This is a diagram of the overall system structure of the present invention.
[0029] Figure 2 This is a flowchart of the cooking behavior recognition method in this invention.
[0030] Figure 3 This is a structural diagram of the LSTM network model in this invention.
[0031] Figure 4 A schematic diagram of temperature time series curves corresponding to different gas consumption behaviors.
[0032] Among them, 1-non-contact temperature sensor; 2-contact temperature sensor; 3-cookware; 4-stove; 5-range hood. Detailed Implementation
[0033] The following provides a detailed discussion of the manufacture and application of preferred embodiments of the present invention. However, it should be understood that the present invention provides many applicable inventive concepts that can be embodied in various specific environments. The specific embodiments discussed are merely illustrative of specific ways of manufacturing and using the invention and do not limit the scope of the invention.
[0034] The following is in conjunction with the appendix Figure 1-4This invention provides a gas consumption behavior recognition method based on temperature time-series data and an LSTM network. The main inventive concept is to use only one or more temperature sensors of a single type to collect temperature time-series data from the cooking area. A specific preprocessing procedure transforms the raw temperature signal into standardized input samples, and an LSTM network model is constructed, comprising a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. This model automatically extracts deep temporal features across multiple time scales and fuses them with physical prior engineering features, ultimately outputting a fine-grained gas consumption behavior category corresponding to the current moment. This method, while fully protecting user privacy and relying solely on extremely low-cost hardware, solves the fundamental technical problems of existing threshold-based judgment methods, such as limited recognition categories and poor anti-interference capabilities. Figure 2 The following is a flowchart of the method of the present invention in a complete processing cycle. The method specifically includes the following steps: Step S1: Acquire the temperature time series data continuously collected in the cooking area.
[0035] In this step, temperature time-series data during the gas consumption process is continuously collected at a predetermined sampling frequency using a temperature sensor deployed in the cooking area. This temperature sensor can be a contact temperature sensor 2 or a non-contact temperature sensor 1. In a specific deployment example, the contact temperature sensor 2 uses a MAX6675 thermocouple module, which is connected to a... K This type of thermocouple has a temperature measurement range of 0℃ to 1024℃ and a measurement accuracy of ±1.5℃. K The temperature-sensing end of the thermocouple is attached to the bottom of the cookware 3 using thermally conductive silicone adhesive to directly measure the bottom temperature of the cookware. In another specific deployment example, the non-contact temperature sensor 1 uses an infrared temperature sensor, which is suspended and installed above the range hood 5 above the stove 4 to measure the surface temperature of the cookware 3 in a non-contact manner. Both deployment methods can be used individually or simultaneously. The temperature sensor is connected to the microcontroller via an I²C bus. The microcontroller uploads the collected raw temperature data to a cloud server or local processing unit via a network transmission module for subsequent data processing and model inference. In this embodiment, the sampling frequency is preferably set to 1Hz, i.e., one temperature data point is collected per second. In another embodiment, the sampling frequency can also be selected within the range of 1Hz to 50Hz to meet the deployment requirements of hardware with different accuracy and cost levels.
[0036] Step S2: Preprocess the temperature time series data to obtain multiple temperature time series data segments; the preprocessing includes sliding window segmentation and performing Z-score normalization independently on each window.
[0037] In this step, a data preprocessing module receives the raw temperature time series data from step S1 and sequentially performs missing value imputation, smoothing filtering, sliding window segmentation, and Z-score normalization.
[0038] Specifically, the data preprocessing module first handles missing values in the received temperature time-series data. Since communication interruptions or sensor malfunctions may cause missing temperature data, a linear interpolation method is used to fill in the missing values. Let the effective temperature values before and after the missing location be T1 and T2, separated by k sampling points, then the... i The temperature values of the missing points were calculated using a linear interpolation formula.
[0039] Then, the temperature time series data, after missing value processing and completion, is smoothed and filtered. In this embodiment, a moving average filter is used to smooth the completed temperature time series data, with the window length of the moving average filter set to 5 sampling points. For the temperature data after moving average filtering, a Savitzky-Golay filter is further used for polynomial fitting smoothing, simultaneously removing high-frequency noise and preserving the steep edge features of temperature changes (such as the sudden temperature drop during cooking). After moving average filtering, the jagged noise in the temperature signal is effectively suppressed, while the overall trend of temperature changes and key edge features are well preserved.
[0040] For sliding window segmentation, this embodiment uses a fixed-length sliding window to divide the smoothed and filtered continuous temperature time series data into a series of time segments with fixed lengths. Window length N and sliding step size M These are two key parameters. Under the 1Hz sampling frequency deployment condition of this embodiment, the window length... N Set to 60 sampling points, corresponding to a physical time length of 60 seconds; sliding step size. M The sampling points are set to 10, corresponding to a physical time length of 10 seconds. Due to the sliding step size... M Less than window length N There is an overlap of 50 sampling points between two adjacent windows. This window overlap strategy can effectively improve the temporal smoothness and continuity of behavior recognition results, and avoid behavior state jumps caused by window boundary cutting. In another embodiment, the window length... N The value range is from 60 to 300 sampling points, and the sliding step size is... M The value ranges from 10 to 50 sampling points, and always satisfies M < N conditions.
[0041] For Z-score normalization, this embodiment performs standardization independently on the temperature time series data within each sliding window. Let the current window contain... N Temperature value t 1, t 2,..., t N First, calculate the arithmetic mean of all temperature values within the window. μ and sample standard deviation σ Arithmetic mean μ The calculation formula is: Sample standard deviation σ The calculation formula is: Then for each temperature value in that window. t i Perform a standardization transformation to obtain the corresponding normalized value. z i ,satisfy By using this window-by-window independent normalization method, the differences in the absolute temperature range and dimensions caused by different cookware materials, different ambient temperatures, and different stove power levels are effectively eliminated. This allows the LSTM network model to focus on learning the relative patterns of temperature changes within a window, thereby improving the model's generalization ability.
[0042] Furthermore, when the temperature fluctuation within a certain window is extremely small, it leads to a decrease in the calculated sample standard deviation. σ When the temperature approaches zero, this embodiment assigns a uniform value of 0 to the normalized result of all temperature values within the window, instead of performing the conventional normalized division operation. The deeper technical significance of this strategy lies in the fact that during the stable "slow-cooking" phase of gas consumption or the later stage of natural cooling after "turning off," the temperature remains almost constant within a local time window. The minute temperature fluctuations almost entirely originate from the sensor's inherent measurement noise. If conventional Z-score normalization is forcibly performed, this physically meaningless measurement noise will be incorrectly amplified by the division operation into a characteristic signal of the same magnitude as the actual behavioral fluctuations, thus seriously misleading the subsequent LSTM network. By uniformly setting the low dynamic window to zero, this step essentially constructs an adaptive behavioral segmentation mechanism at the data preprocessing level.
[0043] Step S3: Construct an LSTM network model, which includes a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. The multi-scale feature encoding layer encodes the temperature time series data segment into a short-window temperature sequence and a long-window temperature sequence, and then inputs them into the parameter-sharing first LSTM layer and the second LSTM layer to extract their respective hidden state vector sequences. The adaptive gated attention layer dynamically weights the hidden state vector sequences through a gating mechanism to suppress noise time steps, obtaining a first weighted feature vector and a second weighted feature vector. The feature fusion layer concatenates the first weighted feature vector, the second weighted feature vector, and a preset temperature time series engineering feature vector to obtain a fused feature.
[0044] This step constitutes the core identification step of the technical solution of this invention. Figure 3 This describes the specific architecture of the LSTM network model constructed in this embodiment. The following sections will elaborate on each component layer of this model.
[0045] The multi-scale feature encoding layer is the input processing layer of this model. Unlike the single-window-length sequence input method commonly used in existing technologies, the multi-scale feature encoding layer in this embodiment encodes each temperature time-series data segment generated in step S2 into two temperature sequences with different time scales: a short-window temperature sequence and a long-window temperature sequence. In this embodiment, the short-window temperature sequence has a duration of 5 seconds, which translates to 5 sampling points at a sampling frequency of 1Hz; the long-window temperature sequence has a duration of 30 seconds, which translates to 30 sampling points at a sampling frequency of 1Hz. Due to its extremely short time span, the short-window temperature sequence can almost completely preserve the transient details during temperature abrupt changes, and is specifically used to capture the temperature drop at the moment of "adding food" or the high-frequency sawtooth fluctuations in temperature during "stir-frying". The long-window temperature sequence covers a longer cooking stage and can effectively characterize the macroscopic thermodynamic trends of the gas consumption process, such as the continuous monotonic rise in temperature after "starting the fire" or the long-term stability of temperature during the "simmering" stage. After generation, the short-window and long-window temperature sequences are fed into two parallel LSTM processing branches with shared parameters. This parameter-sharing design ensures that feature extraction at both time scales follows a unified principle, avoiding a doubling of the number of parameters.
[0046] The first and second LSTM layers constitute the core of the temporal feature extraction in this model. Each LSTM processing branch is composed of a stack of sequentially connected first and second LSTM layers. In this embodiment, the first LSTM layer contains 64 LSTM units, which perform operations on each time step of the input sequence and output a concatenated vector of forward and backward hidden states (dimension 128) for each time step, used to capture local temperature dynamics. The second LSTM layer contains 32 LSTM units, which extract higher-order temporal dependencies and retain the time step dimension, providing complete sequence features for the subsequent adaptive gating attention layer.
[0047] The internal computation processes of the LSTM cells in the first LSTM layer and the second LSTM layer satisfy the following relationship: Output of the Forgot Gate f t : Input gate output i t : Candidate cell state : Current cell state C t : Output gate output o t : Current hidden state h t : ; in, x t The temperature value entered at the current moment. h t-1 This is the hidden state from the previous moment. C t-1 This represents the cell state at the previous moment. S It is the Sigmoid activation function. W f , W i , W c and W o These are the weight matrices corresponding to the forget gate, input gate, candidate cell state, and output gate, respectively. b f , b i , b c andb o These correspond to the bias vectors for the forget gate, input gate, candidate cell state, and output gate, respectively. The forget gate determines the bias vector from the cell state at the previous time step. C t-1 The input gate determines which old information to discard from the candidate unit state. The output gates are based on the updated cell states, taking into account the new information adopted in the input. C t It determines what information to export.
[0048] The adaptive gated attention layer is a crucial component in this embodiment. While conventional attention mechanisms can weight the importance of different time steps in a sequence, they assign a non-zero weight to each time step. Even if some time steps correspond to temperature ranges that belong to stationary background noise completely unrelated to gas consumption behavior, these noisy time steps will still be mixed into the final feature representation with low weights. To completely solve this problem, this embodiment introduces a parallel gating network in the calculation of attention weights. The specific computational mechanism of this adaptive gated attention layer is as follows: Where v, W, b, W g b g For learnable parameters, S For the Sigmoid function, the gate value g t It can dynamically filter out stable temperature ranges unrelated to cooking, increasing the attention weight given to key actions. e t For time step t Attention score h t For LSTM layers at time steps t The output hidden state vector, α t The attention weights are after gating modulation and normalization. H att The feature vector obtained after weighted summation of attention. e j Indicates the first j Attention score at each time step g j Indicates the first j The gating value for each time step.
[0049] The above calculation process involves gate values. g tThe "dynamic switch" role it plays: For a steady temperature time step independent of gas consumption behavior, the Sigmoid activation function will cause its corresponding gate value to... g t If the value approaches 0, the contribution of that time step will be almost completely cleared during the final weighted summation; conversely, for time steps containing key behavioral information, the sigmoid activation function will output a gating value approaching 1. g t The attention mechanism will assign it a higher weight normally.
[0050] The function of the feature fusion layer is to integrate the deep temporal abstract features refined through gated attention with engineering features that have clear physical meaning. In this embodiment, for each temperature time-series data segment, the corresponding temperature time-series engineering feature vector is calculated beforehand. This engineering feature vector includes two main categories: statistical features and key event features. Statistical features include the mean, variance, range, skewness, and kurtosis of temperature values within the window; key event features include the number of temperature abrupt changes, heating rate, cooling rate, and the first-order difference zero-crossing rate. The feature fusion layer then calculates the first weighted feature vectors obtained from the short window branch and the long window branch respectively. Second weighted eigenvector The temperature time series engineering feature vector mentioned above F eng The concatenation operation is performed along the feature dimension to generate the final fused feature vector. F fuse : Here, Concat represents concatenating multiple vectors end-to-end along a single dimension. This fusion does not occur at the original input level, but rather after the deep features have been highly refined by an adaptive gating attention layer and the engineered features have been standardized, thus achieving complementary enhancement between data-driven abstract semantics and physical prior knowledge.
[0051] Step S4: Input the fused features into the fully connected layer and the Softmax output layer, and output the gas consumption behavior category corresponding to the current moment.
[0052] In this step, the fused feature vector generated in step S3 is sequentially fed into a fully connected layer and a softmax output layer. The fully connected layer (64-dimensional, ReLU activation) performs a non-linear transformation on the fused features to further extract the feature combination with the strongest discriminative power for classification, obtaining the final classification features. In this embodiment, a Dropout layer with a dropout rate of 0.5 is added after the fully connected layer to prevent overfitting. The feature vector output by the fully connected layer has a dimension of... K dimension, KThis represents the total number of gas consumption behavior categories. K The 1D feature vector is mapped to a probability distribution vector through the Softmax output layer. Each element in the vector represents the probability that the current temperature window belongs to the corresponding behavior category. The model takes the category corresponding to the maximum probability as the final output gas usage behavior category. In this embodiment, the identifiable gas usage behavior categories include turning on the stove, turning off the stove, adding food, stir-frying, adding water, and simmering over low heat.
[0053] This embodiment establishes a deeply collaborative, end-to-end joint optimization mechanism for temporal information filtering and purification between the adaptive gated attention layer and the first and second LSTM layers. In the first stage, the first and second LSTM layers are responsible for performing comprehensive temporal modeling on the input temperature sequence, and each hidden state vector in their output sequence... h t Both are the first in the input sequence. t The comprehensive encoding of each time step and its context information. However, not all time steps... h t All time steps, especially those in a phase of steady temperature rise or constant temperature maintenance, have equal reference value for the final behavioral judgment. h t The category discrimination information it carries is extremely limited. In the second stage, the parallel gating network inside the adaptive gating attention layer uses each h t As input, it is processed through its dedicated weight matrix W g and bias vector b g Perform a linear transformation and map it using the Sigmoid activation function to independently generate a gate value between 0 and 1 for each time step. g t The saturation property of the Sigmoid function allows the gating network to spontaneously and adaptively learn a stringent set of selection criteria during training: for time steps judged as irrelevant to the behavior category or containing only noise information, it outputs a value close to 0. g t For those time steps deemed crucial to the decision, output a value close to 1. g t In the third stage, this dynamically generated gating value... g t Participating in attention weights in a multiplicative manner α tIn the calculation, the gradient signal of the classification loss function directly and decisively affects the contribution of each time step in the weighted summation process. The gradient signal of the classification loss function simultaneously updates all parameters of the first LSTM layer, the second LSTM layer, and the parameters of the gated network, forcing the LSTM layer and the gated attention layer to adapt to each other and evolve collaboratively, eventually converging to a parameter equilibrium point.
[0054] For training the LSTM network model in this embodiment, a large amount of temperature-time series data labeled with cooking behavior categories was used as the training dataset. The training data covers multiple types of cookware (3 types), multiple stoves (4 power levels), multiple types of ingredients, and multiple cooking methods. Data labeling was done manually, with experimenters recording timestamps and corresponding cooking behaviors while collecting temperature data. The labeled behavior categories include: turning on the heat, turning off the heat, heating the oil, adding ingredients, stir-frying, adding water, simmering over low heat, and serving.
[0055] During training, the training data was divided into training and validation sets in an 8:2 ratio. Cross-entropy loss was used as the loss function. The Adam optimization algorithm was employed for parameter updates, with an initial learning rate of 0.001, which decreased by 10% every 10 epochs. The number of training epochs was set to 100, and an early stopping mechanism was used: training stopped when the validation set loss no longer decreased within 20 consecutive epochs. The weights and bias parameters of the LSTM network were updated using backpropagation to minimize the cross-entropy loss on the training set.
[0056] To make the technical solution of this invention clearer and more specific, a calculation example using specific numerical values is provided below. In this example, it is assumed that the current process is a 5-second short-window temperature sequence labeled as "stir-frying," containing 5 temperature sampling points with values of 152.1℃, 155.8℃, 149.3℃, 157.6℃, and 151.0℃, respectively. First, Z-score normalization preprocessing is performed on the sequence, and the mean of all temperature values within the window is calculated. μ =153.16℃, calculate the sample standard deviation. σ ≈3.47℃. After point-by-point normalization, the normalized sequence is: -0.31, 0.76, -1.11, 1.28, -0.62. Due to the significant temperature fluctuations within this window, the standard deviation... σ The value is significantly higher than the preset threshold, therefore a global zeroing is not performed. This normalized sequence is fed as an input sample into the LSTM network model. Assume that at this point, the attention scores calculated at each time step... e t and gate value g t The following table shows the values for time step 1. e1 is 0.5. g 1 is 0.9; time step 2 is e 2 is 1.2. g 2 is 0.8; time step 3 is e 3 is 0.8. g 3 is 0.95; time step 4 is e 4 is 1.5. g 4 is 0.85; time step 5 e 5 is 0.6. g 5 is 0.9. According to the formula: Perform calculations. For each time step... The values are as follows: approximately 1.48 for time step 1, approximately 2.66 for time step 2, approximately 2.11 for time step 3, approximately 3.81 for time step 4, and approximately 1.64 for time step 5. The total sum of the denominators is approximately 11.70. The final attention weights for each time step are... αt They are respectively: α 1≈0.13, α 2≈0.23, α 3≈0.18, α 4≈0.33, α 5≈0.14. Thus, it can be clearly seen that time step 4, corresponding to the temperature peak of 157.6℃, received the highest attention weight of 0.33, while time step 3, corresponding to the temperature trough of 149.3℃, also received a relatively high weight of 0.18. This embodiment specifically and numerically demonstrates how the gating mechanism, through the dynamic filtering effect of the Sigmoid function, further widens the weight gap between key dynamic time steps and secondary time steps, enabling the final weighted feature vector used for classification to more purely focus on the high-frequency temperature fluctuation pattern representing the core feature of the "stir-frying" behavior.
[0057] In a preferred embodiment, the first LSTM layer contains 64 LSTM units and outputs a concatenated vector of forward and backward hidden states for each time step to capture local temperature dynamics; the second LSTM layer contains 32 LSTM units, extracts higher-order temporal dependencies, and retains the time step dimension to provide sequence features for the adaptive gating attention layer.
[0058] In a preferred embodiment, the window length of the sliding window segment is... N Sampling points range from 60 to 300, with a sliding step size of [missing information]. M The number of sampling points is between 10 and 50. M < N There is an overlapping area between adjacent windows. This parameter range can be adaptively adjusted according to the actual sampling frequency of the temperature sensor.
[0059] In a preferred embodiment, the short window temperature sequence has a duration of 5 seconds, and the long window temperature sequence has a duration of 30 seconds.
[0060] In a preferred embodiment, the preset temperature time series engineering feature vector includes statistical features and key event features. The statistical features include mean, variance, range, skewness, and kurtosis. The key event features include the number of temperature abrupt changes, heating rate, cooling rate, and temperature first-order difference zero-crossing rate.
[0061] As an alternative implementation, the smoothing filter can also use a Savitzky-Golay filter instead of a moving average filter, or the two can be cascaded together.
[0062] In another embodiment of the present invention, a gas consumption behavior recognition system is also provided for performing any of the methods described in the foregoing method embodiments. (Refer to...) Figure 1 The system includes a data acquisition module, a data preprocessing module, an LSTM network model, a recognition output module, and an application control module.
[0063] The data acquisition module is used to acquire continuous temperature time-series data from the cooking area. In actual deployment, this module may include one or more contact temperature sensors 2 or non-contact temperature sensors 1.
[0064] The data preprocessing module is used to preprocess the temperature time series data acquired by the data acquisition module to obtain multiple temperature time series data segments. The preprocessing includes sliding window segmentation and performing Z-score normalization independently on each window.
[0065] The LSTM network model comprises a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. The multi-scale feature encoding layer encodes temperature time-series data segments into short-window and long-window temperature sequences, which are then input into the parameter-sharing first and second LSTM layers to extract their respective hidden state vector sequences. The adaptive gated attention layer dynamically weights the hidden state vector sequences using a gating mechanism to suppress noisy time steps, resulting in a first weighted feature vector and a second weighted feature vector. The feature fusion layer concatenates the first and second weighted feature vectors with a pre-defined temperature time-series engineered feature vector to obtain the fused feature.
[0066] The identification output module is used to input the fused features into the fully connected layer and the Softmax output layer, and output the gas consumption behavior category corresponding to the current moment.
[0067] The application control module, connected to the identification output module, is used to receive gas usage behavior categories and send control commands to one or more kitchen devices based on these categories.
[0068] To verify the technical effectiveness of this invention, an experimental system was deployed in a real home kitchen environment, and a labeled dataset covering three types of cookware, multiple heat levels, and various cooking methods was collected for comparative testing. The test set included six categories of behaviors: turning on the heat, turning off the heat, adding ingredients, stir-frying, adding water, and simmering over low heat, with at least 500 sample windows for each behavior. The comparison included traditional recognition methods based on fixed temperature threshold rules and LSTM models based on standard attention mechanisms. The evaluation metric was the macro-average F1 score of behavior recognition. Experimental results showed that on the same test set, the macro-average F1 score of the traditional fixed threshold rule method was approximately 62.3%, performing particularly poorly in distinguishing between adding ingredients and adding water. The LSTM model with standard attention mechanisms improved the macro-average F1 score to approximately 81.7%, but still showed a significant number of misclassifications in long-term simmering scenarios. In comparison, the LSTM network model using this embodiment of the invention achieves a macro-average F1 score of approximately 93.5%, particularly in the highly confusing behavior categories of simmering over low heat and natural cooling after turning off the heat, where the recognition accuracy is improved by more than 18 percentage points compared to the standard attention model. This comparative result clearly demonstrates that the present invention, through the synergistic combination of adaptive gating attention mechanism and multi-scale feature encoding, achieves a significant improvement over existing technologies.
[0069] Figure 4 This is a schematic diagram of temperature time-series curves corresponding to different gas consumption behaviors in this embodiment. Taking the temperature time-series data collected by the non-contact temperature sensor 1 at a sampling frequency of 1Hz as an example, the temperature change patterns corresponding to different cooking behaviors are as follows.
[0070] (1) Firing: The temperature starts from the ambient temperature and continues to rise. The first derivative of the temperature with time is >0 and basically constant or increases with the increase of firepower.
[0071] (2) Adding food: The temperature drops sharply in an instant, and the first derivative of the temperature shows a significant negative peak, which then begins to rise.
[0072] (3) Stir-frying: The temperature fluctuates at high frequency and low amplitude, the variance of the temperature curve is large, and the power spectral density is concentrated in the mid-to-high frequency range.
[0073] (4) Add water: The temperature drops rapidly (the temperature drop is usually greater than that of adding food), and then rises slowly. The first derivative of the temperature becomes negative and then returns to a positive value.
[0074] (5) Simmering over low heat: The temperature is stable within a certain range and fluctuates slowly. The first derivative of the temperature curve approaches 0 and the variance is small.
[0075] (6) Turn off the heat: The temperature drops naturally, and the first derivative of the temperature with time is negative and the absolute value gradually decreases.
[0076] LSTM network models can automatically learn and extract the aforementioned feature patterns from raw temperature data through their internal time-series modeling capabilities, without the need for manual design of feature extraction rules.
[0077] Although the specification has provided a detailed description, it should be understood that various changes, substitutions, and modifications can be made without departing from the spirit and scope of the invention as defined by the appended claims. Furthermore, the specific embodiments described are not intended to limit the scope of the invention, and those skilled in the art will readily understand based on this invention that existing or future-developed processes, machines, manufactures, compositions of matter, means, methods, or steps can perform substantially the same functions or achieve substantially the same results as the embodiments of the invention. Therefore, the appended claims are intended to include such processes, machines, manufactures, compositions of matter, means, methods, or steps within their scope.
Claims
1. A method for recognizing gas consumption behavior based on temperature time-series data and an LSTM network, characterized in that: Includes the following steps: S1: Acquire continuous time-series temperature data from the cooking area; S2: Preprocess the temperature time series data to obtain multiple temperature time series data segments; S3: Construct an LSTM network model, which includes a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. The multi-scale feature encoding layer encodes the temperature time series data segments into short-window temperature sequences and long-window temperature sequences, and then inputs them into the parameter-sharing first LSTM layer and second LSTM layer respectively to extract their respective hidden state vector sequences. The adaptive gated attention layer dynamically weights the hidden state vector sequences through a gating mechanism to suppress noise time steps, obtaining a first weighted feature vector and a second weighted feature vector. The feature fusion layer concatenates the first weighted feature vector, the second weighted feature vector, and a preset temperature time series engineering feature vector to obtain a fused feature. S4: Input the fused features into the fully connected layer and the Softmax output layer, and output the gas consumption behavior category corresponding to the current moment.
2. The method as described in claim 1, characterized in that: The first LSTM layer contains 64 LSTM units and outputs a concatenated vector of forward and backward hidden states for each time step to capture local temperature dynamics. The second LSTM layer contains 32 LSTM units, extracts higher-order temporal dependencies, and retains the time step dimension to provide sequence features for the adaptive gated attention layer.
3. The method as described in claim 1, characterized in that: The gating mechanism satisfies the following relationship: Attention weight α t : ; Gating value g t : ; Among them, W g b g For learnable parameters, S For the Sigmoid function; e t For time steps t Attention score; h t For LSTM layers at time steps t The output hidden state vector; e j For the first j Attention score at each time step; g j Indicates the first j The gating value for each time step.
4. The method as described in claim 1, characterized in that: The preprocessing includes sliding window segmentation and performing Z-score normalization independently on each window; the preprocessing also includes smoothing filtering, using moving average filtering to remove high-frequency noise from the temperature time series data; The Z-score normalization includes: calculating the mean of the temperature values within the current window. μ and sample standard deviation σ Normalized value ,when σ When the value approaches 0, the normalized value in the window is set to 0.
5. The method as described in claim 4, characterized in that: The window length of the sliding window segment N Sampling points range from 60 to 300, with a sliding step size of [missing information]. M The number of sampling points is between 10 and 50. M < N There is an overlapping area between adjacent windows.
6. The method as described in claim 1, characterized in that: The temperature time series data is acquired by a temperature sensor at a sampling frequency of 1Hz to 50Hz; the short window temperature sequence has a time length of 5 seconds; and the long window temperature sequence has a time length of 30 seconds.
7. The method according to claim 1, characterized in that, The preset temperature time series engineering feature vector includes statistical features and key event features; the statistical features include mean, variance, range, skewness and kurtosis; the key event features include the number of temperature abrupt changes, heating rate, cooling rate and temperature first-order difference zero-crossing rate.
8. The method as described in claim 2, characterized in that: The computation process of the LSTM cells in the first LSTM layer and the second LSTM layer satisfies the following relationship: Output of the Forgot Gate f t : Input gate output i t : Candidate cell state : Current cell state C t : Output gate output o t : Current hidden state h t : ; in, x t The temperature value entered at the current moment. h t-1 This is the hidden state from the previous moment. C t-1 This represents the cell state at the previous moment. S It is the Sigmoid activation function. W f , W i , W c and W o These are the weight matrices corresponding to the forget gate, input gate, candidate cell state, and output gate, respectively. b f , b i , b c and b o These correspond to the bias vectors of the forget gate, input gate, candidate cell state, and output gate, respectively.
9. A gas consumption behavior recognition system, used to perform the method as described in any one of claims 1-8, characterized in that, include: The data acquisition module is used to acquire continuous temperature time-series data from the cooking area; The data preprocessing module is used to preprocess the temperature time series data to obtain multiple temperature time series data segments; The preprocessing includes sliding window segmentation and performing Z-score normalization independently on each window; The LSTM network model includes a multi-scale feature encoding layer, a first LSTM layer, a second LSTM layer, an adaptive gated attention layer, and a feature fusion layer. The multi-scale feature encoding layer encodes the temperature time-series data segment into short-window and long-window temperature sequences, which are then input into the parameter-sharing first and second LSTM layers to extract their respective hidden state vector sequences. The adaptive gated attention layer dynamically weights the hidden state vector sequences using a gating mechanism to suppress noise time steps, obtaining a first weighted feature vector and a second weighted feature vector. The feature fusion layer concatenates the first weighted feature vector, the second weighted feature vector, and a preset temperature time-series engineering feature vector to obtain a fused feature. The identification output module is used to input the fused features into the fully connected layer and the Softmax output layer, and output the gas consumption behavior category corresponding to the current moment.
10. The system according to claim 9, characterized in that, It also includes an application control module, which is connected to the identification output module and is used to receive the gas consumption behavior category and send control commands to one or more kitchen devices according to the gas consumption behavior category.