Cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism
By constructing a temperature and humidity fluctuation prediction model and anomaly detection and analysis method, the problem of accurately judging and predicting abnormal temperature and humidity fluctuations in cold chain transportation has been solved, improving the timeliness and reliability of detection and ensuring the stability of cargo quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies for detecting abnormal temperature and humidity in cold chain transportation cannot accurately determine historical fluctuations in temperature and humidity, resulting in an inability to effectively predict and identify abnormal temperature and humidity fluctuations, which affects the stability of cargo quality.
By collecting temperature and humidity data from cold chain transport vehicles, performing data preprocessing, constructing a temperature and humidity fluctuation prediction model, and using an LSTM model and attention mechanism for anomaly detection analysis, the temperature and humidity fluctuation threshold and prediction results are obtained.
It enables accurate judgment and prediction of abnormal temperature and humidity fluctuations during cold chain transportation, improves the timeliness and reliability of anomaly detection, and ensures the stability of cargo quality.
Smart Images

Figure CN121744138A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of temperature and humidity anomaly detection technology in cold chain transportation, specifically to a cold chain temperature and humidity anomaly detection and analysis method based on attention mechanisms. Background Technology
[0002] Cold chain transportation temperature and humidity anomaly detection technology refers to a comprehensive technical system that identifies abnormal states in temperature and humidity data that deviate from normal operating patterns in real time through multi-source data collection, time-series feature extraction, and intelligent algorithm analysis throughout the entire cold chain transportation process, and realizes anomaly early warning, root cause location, and full-chain traceability.
[0003] Existing cold chain transportation temperature and humidity anomaly detection technologies often collect real-time temperature and humidity information from the vehicle compartment and determine whether the temperature and humidity exceed the specified range. If they do, an anomaly warning is issued. However, they neglect abnormal fluctuations in temperature and humidity within the specified range. The quality stability of cold chain goods depends not only on the specified temperature and humidity range but also on the stability of the temperature and humidity. For example, even within the specified range, abnormal fluctuations can still disrupt the stability of the storage environment, accelerate quality deterioration, and affect the quality of the goods. For fresh fruits, in particular, high-frequency, small-amplitude fluctuations can stimulate increased cellular respiration, accelerate moisture loss, and promote microbial growth. Goods in the same batch may experience varying degrees of fluctuation during transportation, and goods experiencing abnormal fluctuations often suffer from product quality damage. For example, patent application CN113344151A discloses a fault identification, alarm, and control device and method for adaptive temperature adjustment in cold chain transportation. This scheme determines whether the temperature is abnormal by detecting whether the temperature information exceeds the temperature fault threshold. However, it ignores abnormal temperature fluctuations, making the anomaly detection unreliable. Therefore, existing cold chain transportation temperature and humidity anomaly detection technologies cannot accurately judge abnormal temperature and humidity fluctuations based on historical temperature and humidity fluctuations, nor can they predict and judge temperature and humidity fluctuations. Summary of the Invention
[0004] This invention aims to at least partially solve one of the technical problems in the prior art. It obtains raw temperature and humidity sample data by collecting temperature and humidity change data from cold chain transport vehicles during the cold chain transportation process; performs data preprocessing, conducts temperature and humidity fluctuation analysis to obtain temperature and humidity fluctuation data, and obtains normal temperature and humidity fluctuation thresholds; constructs a temperature and humidity fluctuation prediction model and predicts temperature and humidity fluctuations; and performs anomaly detection analysis to obtain anomaly detection analysis results. This addresses the problem that existing cold chain transportation temperature and humidity anomaly detection technologies cannot accurately judge abnormal temperature and humidity fluctuations based on historical temperature and humidity fluctuations, and simultaneously predict and judge temperature and humidity fluctuations.
[0005] To achieve the above objectives, this application provides a method for detecting and analyzing abnormal temperature and humidity in the cold chain based on an attention mechanism, comprising the following steps:
[0006] During cold chain transportation, data on temperature and humidity changes in cold chain transport vehicles are collected to obtain raw temperature and humidity sample data.
[0007] The original temperature and humidity sample data are preprocessed and temperature and humidity fluctuation analysis is performed to obtain temperature and humidity fluctuation data and the normal temperature and humidity fluctuation threshold is obtained to obtain temperature and humidity fluctuation threshold information.
[0008] A temperature and humidity fluctuation prediction model is constructed based on temperature and humidity fluctuation data. The temperature and humidity of the cold chain transport vehicles collected in real time are analyzed and predicted to obtain fluctuation analysis data and waveform prediction data.
[0009] Anomaly detection and analysis are performed on the fluctuation analysis data and waveform prediction data based on the temperature and humidity fluctuation range information to obtain the temperature and humidity anomaly detection and analysis results.
[0010] Furthermore, during the cold chain transportation process, collecting temperature and humidity change data from cold chain transport vehicles to obtain raw temperature and humidity sample data includes the following sub-steps:
[0011] For any type of goods, the cold chain transportation process is referred to as the first cold chain process, and the cold chain transportation vehicle used in the first cold chain process is referred to as the first cold chain vehicle; the temperature and humidity inside the compartment of the first cold chain vehicle during the first cold chain process are referred to as the transportation temperature and the transportation humidity, respectively.
[0012] Obtain the specified transport temperature range and specified transport humidity range during the first cold transport process, and record them as the specified temperature range and specified humidity range respectively in sequence.
[0013] Furthermore, during the cold chain transportation process, collecting temperature and humidity change data from cold chain transport vehicles to obtain raw temperature and humidity sample data includes the following sub-steps:
[0014] The first normal cold transport process is denoted as the normal cold transport process. For any normal cold transport process, it is denoted as the first normal process. During the first normal process, the transport temperature and transport humidity are collected synchronously at the first time interval and arranged in chronological order, and recorded as the corresponding transport temperature sequence and transport humidity sequence, which are marked as the temperature and humidity change information of the first normal process, where the first time interval is t1.
[0015] The temperature and humidity change information during multiple normal cold chain operations was collected repeatedly and recorded as the original temperature and humidity sample data.
[0016] Furthermore, the original temperature and humidity sample data are preprocessed, and temperature and humidity fluctuation analysis is performed to obtain the normal temperature and humidity fluctuation threshold. The process for obtaining the temperature and humidity fluctuation threshold information includes the following sub-steps:
[0017] For the transport temperature sequence and transport humidity sequence of the first normal process, any temperature in the transport temperature sequence is denoted as ET; the k1 temperatures closest to ET in the transport temperature sequence are obtained and denoted as the adjacent data of ET, and the mean AP and standard deviation AB of the adjacent data are calculated; where k1 is the number of values set.
[0018] If ET is not located in [AP-k2×AB, AP+k2×AB], then ET is marked as abnormal data; otherwise, it is marked as normal data. If ET is abnormal data, then the two temperatures closest to ET are obtained, the average value is calculated, and ET is replaced with the average value. This process is repeated for all temperatures in the transport temperature sequence to obtain the preprocessed sequence corresponding to the transport temperature sequence, which is denoted as the standard temperature sequence. Here, k2 is the set scaling factor.
[0019] Repeatedly acquire the preprocessed sequence corresponding to the transportation humidity sequence, denoted as the standard humidity sequence; repeatedly acquire the standard temperature sequence and standard humidity sequence corresponding to all normal cold transport processes in the original temperature and humidity sample data.
[0020] Furthermore, the original temperature and humidity sample data undergoes data preprocessing and temperature and humidity fluctuation analysis to obtain the normal temperature and humidity fluctuation thresholds. Obtaining the temperature and humidity fluctuation threshold information also includes the following sub-steps:
[0021] Set the sliding window size to k3 and the sliding step size to k4. For the standard temperature sequence and standard humidity sequence of the first normal process, slide synchronously from the starting position of the standard temperature sequence and standard humidity sequence, respectively. For any sliding window, it is denoted as the temperature window and the humidity window, respectively.
[0022] Calculate the absolute difference between the maximum and minimum values in the temperature window, and record it as the range corresponding to the temperature window, labeled as temperature fluctuation index 1. Also, obtain the range corresponding to the humidity window, and label it as humidity fluctuation index 1. Record the collection time of the last data in the temperature window as the time corresponding to temperature fluctuation index 1 and humidity fluctuation index 1.
[0023] Furthermore, the original temperature and humidity sample data undergoes data preprocessing and temperature and humidity fluctuation analysis to obtain the normal temperature and humidity fluctuation thresholds. Obtaining the temperature and humidity fluctuation threshold information also includes the following sub-steps:
[0024] For any two adjacent temperatures within a temperature window, let CT be the temperature value. i and CT i+1 Where i represents the position number, the corresponding adjacent change |CT is calculated. i+1 -CT i | Repeat the calculation of adjacent temperature changes in the temperature window to obtain the set of window changes;
[0025] Obtain the mean and median of the window variation set, and denote them as BP and BE respectively in order; obtain the number of data points in the window variation set that are greater than the mean, and denote them as the number of high variation points DG; denote the total number of data points in the window variation set as AG; calculate the fluctuation index DF corresponding to the temperature window, where DF = (DG / AG) × (BP / BE), and mark it as temperature fluctuation index 2; repeatedly obtain the fluctuation index corresponding to the humidity window, and mark it as humidity fluctuation index 2; and record the collection time of the last data point of the temperature window as the time corresponding to temperature fluctuation index 2 and humidity fluctuation index 2.
[0026] Repeatedly acquire temperature fluctuation index 1, temperature fluctuation index 2, humidity fluctuation index 1, and humidity fluctuation index 2 corresponding to each sliding, and arrange them according to the sliding order, respectively, and record them as temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, which are recorded as the temperature and humidity fluctuation information of the first normal process; repeatedly acquire the temperature and humidity fluctuation information corresponding to all normal cold operation processes to obtain temperature and humidity fluctuation data.
[0027] Furthermore, the original temperature and humidity sample data undergoes data preprocessing and temperature and humidity fluctuation analysis to obtain the normal temperature and humidity fluctuation thresholds. Obtaining the temperature and humidity fluctuation threshold information also includes the following sub-steps:
[0028] For temperature fluctuation index 1, obtain all temperature fluctuation indices 1 in all temperature index sequences 1 and arrange them in ascending order, denoted as the first index sequence; take the middle k5% of the data in the first index sequence, denoted as the core interval, obtain the maximum value MU and the mean value PU in the core interval, as well as the absolute difference between the maximum and minimum values CU; calculate MU + (MU × CU / PU), denoted as the fluctuation threshold corresponding to temperature fluctuation index 1, where k5% is the set ratio;
[0029] Repeatedly obtain the fluctuation thresholds corresponding to temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2 to obtain temperature and humidity fluctuation threshold information.
[0030] Furthermore, a temperature and humidity fluctuation prediction model is constructed based on temperature and humidity fluctuation data. This model analyzes the temperature and humidity fluctuations of the cold chain transport vehicles collected in real time and performs temperature and humidity fluctuation prediction, including the following sub-steps:
[0031] An initial model is built based on LSTM and Attention. The initial model includes an input layer, an attention layer, an LSTM layer, and an output layer. The input of the initial model is set to the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, and the output is the future temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2.
[0032] The initial model was trained using temperature and humidity fluctuation data, resulting in a temperature and humidity fluctuation prediction model.
[0033] Furthermore, the construction of a temperature and humidity fluctuation prediction model based on temperature and humidity fluctuation data, the analysis of temperature and humidity fluctuations in real-time collected data from cold chain transport vehicles, and the prediction of temperature and humidity fluctuations also include the following sub-steps:
[0034] For the current first cold transport process, denoted as the current cold transport process, the transport temperature sequence and transport humidity sequence corresponding to the current cold transport process are collected; if the temperature and humidity in the corresponding transport temperature sequence and transport humidity sequence do not exceed the corresponding specified temperature range and specified humidity range, the corresponding data preprocessing is obtained, and temperature and humidity fluctuation analysis is performed to obtain the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1 and humidity index sequence 2, which are denoted as fluctuation analysis data;
[0035] Input the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2 into the temperature and humidity fluctuation prediction model to obtain the predicted temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, which are denoted as waveform prediction data.
[0036] Furthermore, based on the temperature and humidity fluctuation range information, anomaly detection analysis is performed on the fluctuation analysis data and waveform prediction data to obtain the temperature and humidity anomaly detection analysis results, including the following sub-steps:
[0037] Regarding temperature, if temperature index 1 and temperature index 2 are both greater than the corresponding fluctuation threshold at the same time, then the temperature at the corresponding time is judged to be abnormal; otherwise, the temperature at the corresponding time is judged to be normal.
[0038] Based on the current temperature index sequence 1, temperature index sequence 2, and predicted temperature index sequence 1 and temperature index sequence 2, the temperature at each time point is repeatedly judged.
[0039] If the temperature fluctuates at the current moment and has fluctuated continuously for k6 times, then an abnormal temperature fluctuation is determined and a warning is issued; if the temperature fluctuates at some future moment and has fluctuated continuously for k6 times, then an abnormal temperature fluctuation is determined and a warning is issued; otherwise, the temperature is determined to be fluctuating normally, where k6 is the set number.
[0040] Based on the current humidity index sequence 1 and humidity index sequence 2, as well as the predicted humidity index sequence 1 and humidity index sequence 2, the humidity is repeatedly judged.
[0041] The beneficial effects of this invention are as follows: This invention collects temperature and humidity change data of cold chain transport vehicles during the cold chain transportation process to obtain raw temperature and humidity sample data; it preprocesses the raw temperature and humidity sample data and performs temperature and humidity fluctuation analysis to obtain temperature and humidity fluctuation data, and acquires normal temperature and humidity fluctuation thresholds to obtain temperature and humidity fluctuation threshold information; based on the temperature and humidity fluctuation data, it constructs a temperature and humidity fluctuation prediction model to perform temperature and humidity fluctuation analysis and prediction on the real-time collected temperature and humidity of cold chain transport vehicles, obtaining fluctuation analysis data and waveform prediction data; based on the temperature and humidity fluctuation range information, it performs anomaly detection analysis on the fluctuation analysis data and waveform prediction data to obtain temperature and humidity anomaly detection analysis results; when performing anomaly detection analysis on temperature and humidity during the cold chain transportation process, it can accurately judge abnormal temperature and humidity fluctuations based on historical temperature and humidity fluctuations, and simultaneously predict and judge temperature and humidity fluctuations.
[0042] This invention uses the range of a window as indicator 1 to reflect the instantaneous amplitude within the window; simultaneously, it constructs a fluctuation index based on the proportion of high-change points, the ratio of the mean to the median as indicator 2 to reflect the frequency of fluctuations and the concentration of abnormal changes. The two types of indicators complement each other, improving the sensitivity to abnormal fluctuation judgment. The core interval is selected from all indicators of normal processes, and the maximum value, mean, and difference of the interval are statistically calculated to determine the threshold, avoiding the bias of manually setting the threshold and making the threshold more robust and more representative of the normal fluctuation range. Inputting the real-time collected fluctuation analysis data into the model yields future indicators, which can transform anomaly detection from passive alarm to proactive early warning, allowing for remedial measures to be taken in advance and improving the timeliness of anomaly detection. Attached Figure Description
[0043] Figure 1 This is a flowchart of the steps of the method of the present invention;
[0044] Figure 2 This is a flowchart of the temperature fluctuation index acquisition process of the present invention;
[0045] Figure 3 This is a flowchart of the temperature anomaly detection process of the present invention;
[0046] Figure 4 This is a schematic diagram of the electronic device of the present invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Example 1, please refer to Figure 1 As shown, this application provides a method for detecting and analyzing abnormal temperature and humidity in the cold chain based on an attention mechanism, including the following steps:
[0049] Step S1 involves collecting temperature and humidity change data from the cold chain transport vehicles during the cold chain transportation process to obtain raw temperature and humidity sample data. Step S1 includes the following sub-steps:
[0050] Step S101: For any type of cold chain transportation process, it is referred to as the first cold chain process, and the cold chain transportation vehicle used in the first cold chain process is referred to as the first cold chain vehicle; the temperature and humidity inside the compartment of the first cold chain vehicle in the first cold chain process are referred to as the transportation temperature and transportation humidity, respectively; different goods, different vehicles or different transportation processes may have different temperature and humidity fluctuation characteristics; analysis and processing can be carried out according to the category of goods, vehicle and route, thereby improving the detection accuracy and generalization ability;
[0051] Step S102: Obtain the specified transport temperature range and specified transport humidity range during the first cold transport process, and record them as the specified temperature range and specified humidity range in sequence.
[0052] Step S103: Record the normal first cold transport process as the normal cold transport process. For any normal cold transport process, record it as the first normal process. In the first normal process, collect the transport temperature and transport humidity synchronously at the first time interval, and arrange them in time order to record them as the corresponding transport temperature sequence and transport humidity sequence, which are marked as the temperature and humidity change information of the first normal process. The first time interval is t1. In this embodiment, t1 = 1 second, which can be set flexibly.
[0053] Step S104: Repeatedly collect temperature and humidity change information during multiple normal cold transport processes and record it as the original temperature and humidity sample data.
[0054] In practice, the quality stability of cold chain goods depends not only on the specified temperature and humidity range, but also on the stability of temperature and humidity, especially for pharmaceuticals and high-end fresh produce. Abnormal fluctuations in temperature and humidity within the specified range, even if they do not exceed the safety threshold, can seriously damage the stability of the storage environment and accelerate quality degradation. For example, for pharmaceutical goods such as vaccines and biological agents, frequent fluctuations or sudden increases or decreases within the specified range can lead to protein denaturation and degradation of active ingredients. Even if the temperature remains within the specified range, frequent abnormal fluctuations can directly affect the efficacy of the drug or even cause it to become ineffective.
[0055] Step S2 involves preprocessing the original temperature and humidity sample data, performing temperature and humidity fluctuation analysis to obtain temperature and humidity fluctuation data, and acquiring the normal temperature and humidity fluctuation threshold to obtain temperature and humidity fluctuation threshold information. Step S2 includes the following sub-steps:
[0056] Step S201: For the transport temperature sequence and transport humidity sequence of the first normal process, any temperature in the transport temperature sequence is denoted as ET; the k1 temperatures closest to ET in the transport temperature sequence are obtained, i.e., the ones with the closest collection time, and are denoted as the adjacent data of ET; the average value AP and standard deviation AB of the adjacent data are calculated; where k1 is the number set; in this embodiment, k1=200, which can be flexibly set.
[0057] Step S202: If ET is not located in [AP-k2×AB, AP+k2×AB], then ET is marked as abnormal data; otherwise, it is marked as normal data. If ET is abnormal data, then the two temperatures closest to ET are obtained, the average value is calculated, and ET is replaced with the average value. Replacing abnormal data with the average value of the two closest points can maintain the local continuity of the original sequence and avoid destroying the short-term trend. Repeat the processing of all temperatures in the transport temperature sequence to obtain the preprocessed sequence corresponding to the transport temperature sequence, which is denoted as the standard temperature sequence. Here, k2 is the set scaling factor. In this embodiment, k2=3, which can be flexibly set according to the actual application scenario.
[0058] Temperature and humidity data acquisition relies on sensors. The data collected by the sensors may have single-point jumps or errors, which can seriously affect subsequent fluctuation statistics. By identifying anomalies based on adjacent data and replacing the anomalies, noise can be removed from the sequence, thereby ensuring that subsequent fluctuation indicators reflect the true fluctuations rather than sensor errors.
[0059] Step S203: Repeatedly acquire the preprocessed sequence corresponding to the transportation humidity sequence, denoted as the standard humidity sequence; the processing flow is consistent with that of the standard temperature sequence; repeatedly acquire the standard temperature sequence and standard humidity sequence corresponding to all normal cold transport processes in the original temperature and humidity sample data.
[0060] For step S204, please refer to... Figure 2 As shown, the sliding window size is set to k3, and the sliding step size is k4. For the standard temperature sequence and standard humidity sequence of the first normal process, the sliding is performed synchronously from the starting position of the standard temperature sequence and the standard humidity sequence, respectively. The window corresponding to any sliding is recorded as the temperature window and the humidity window, respectively. In this embodiment, k3=180 and k4=20, which can be flexibly set according to the actual application scenario.
[0061] Step S205: Calculate the absolute difference between the maximum and minimum values in the temperature window, record it as the range corresponding to the temperature window, and label it as temperature fluctuation index 1. Also, obtain the range corresponding to the humidity window and label it as humidity fluctuation index 1. Record the collection time of the last data in the temperature window as the time corresponding to temperature fluctuation index 1 and humidity fluctuation index 1. This ensures that each index corresponds to a specific time during the sliding process, which is convenient for subsequent continuity determination.
[0062] The fluctuation index 1 quantifies the extreme degree of temperature and humidity fluctuations within the sliding window, reflecting whether there are large fluctuations that exceed the normal range; it can immediately reflect whether there are fluctuations that are harmful to the stability of goods in a short period of time.
[0063] Step S206: For any two adjacent temperatures within the temperature window, denoted as CT. i and CT i+1Where i represents the position number, the corresponding adjacent change |CT is calculated. i+1 -CT i | Repeat the calculation of adjacent temperature changes in the temperature window to obtain the set of window changes;
[0064] Step S207: Obtain the mean and median of the window change set, and denote them as BP and BE respectively in order; obtain the number of data points in the window change set that are greater than the mean change, and denote them as the number of high change points DG; denote the total number of data points in the window change set as AG; calculate the fluctuation index DF corresponding to the temperature window, where DF = (DG / AG) × (BP / BE), and mark it as temperature fluctuation index 2; repeatedly obtain the fluctuation index corresponding to the humidity window, and mark it as humidity fluctuation index 2; and record the collection time of the last data point of the temperature window as the time corresponding to temperature fluctuation index 2 and humidity fluctuation index 2.
[0065] For example, if the set of temperature window changes is [0.05, 0.05, 0.10, 0.05], then AG=4, BP=0.0625, BE=0.05, DG=1, then DF=(DG / AG)×(BP / BE)=(1 / 4)×(0.0625 / 0.05)=0.3125, that is, temperature fluctuation index2=0.3125;
[0066] Volatility indicator 1 only focuses on extreme amplitudes, but cannot distinguish between an occasional large fluctuation and frequent small oscillations; Indicator 2 uses DG / AG to represent the proportion of points with changes above the average, and multiplies it with BP / BE to represent the deviation of the average change from the median. This quantifies the frequency of fluctuations and reflects the degree to which the typical amplitude of fluctuations is larger than the central trend.
[0067] Step S208: Repeatedly acquire temperature fluctuation index 1, temperature fluctuation index 2, humidity fluctuation index 1, and humidity fluctuation index 2 corresponding to each sliding, and arrange them according to the sliding order, respectively denoted as temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, which are recorded as the temperature and humidity fluctuation information of the first normal process; Repeatedly acquire the temperature and humidity fluctuation information corresponding to all normal cold operation processes to obtain temperature and humidity fluctuation data, and convert the instantaneous indicators at the window level into time series signals to facilitate subsequent training of the prediction model and acquisition of corresponding thresholds based on historical statistical distribution.
[0068] Step S209: For temperature fluctuation index 1, obtain all temperature fluctuation indices 1 in all temperature index sequences 1, and arrange them in ascending order, denoted as the first index sequence; take the middle k5% of the data in the first index sequence, denoted as the core interval, and obtain the maximum value MU and the mean value PU within the core interval, as well as the absolute difference between the maximum and minimum values CU; calculate MU + (MU × CU / PU), denoted as the fluctuation threshold corresponding to temperature fluctuation index 1, where k5% is a set ratio; in this embodiment, k5 = 40%, which can be flexibly set, generally from 30% to 50%;
[0069] The threshold is generated using MU, PU, and CU, i.e., MU + MU × (CU / PU). When the difference CU within the core region is large or the mean PU is small, the CU / PU is large, which will amplify the compensation for MU, thereby obtaining a higher threshold and reducing the risk of missed detection. Conversely, the threshold is tighter. The more concentrated the normal data, the closer the threshold is to the upper limit of the core region, and the more sensitive the anomaly identification. The more dispersed the normal data, the looser the threshold, avoiding misjudging normal data at the edge.
[0070] For example, if the first indicator sequence is [0.10, 0.12, 0.15, 0.18, 0.21, 0.24, 0.27, 0.30, 0.35, 0.40], then the core interval is [0.18, 0.21, 0.24, 0.27]. Therefore, MU = 0.27, PU = 0.225; CU = 0.27 - 0.18 = 0.09; and MU + (MU × CU / PU) = 0.27 + 0.27 × 0.09 / 0.225 = 0.378.
[0071] Step S210: Repeatedly obtain the fluctuation thresholds corresponding to temperature index sequence 2, humidity index sequence 1 and humidity index sequence 2 to obtain temperature and humidity fluctuation threshold information.
[0072] In the specific implementation process, for the index sequence after sorting from smallest to largest, the extreme distributions at both ends after sorting are discarded, and the middle k5% of the data is taken as the core interval. This can avoid a small number of extreme records in history that are still marked as normal from raising or lowering the threshold, thereby improving the robustness and reliability of the threshold.
[0073] Step S3 involves constructing a temperature and humidity fluctuation prediction model based on the temperature and humidity fluctuation data, performing temperature and humidity fluctuation analysis on the real-time collected data of the cold chain transport vehicles, and predicting the temperature and humidity fluctuations to obtain fluctuation analysis data and waveform prediction data. Step S3 includes the following sub-steps:
[0074] Step S301: Construct an initial model based on the LSTM model and Attention. The initial model includes an input layer, an attention layer, an LSTM layer, and an output layer. The input of the initial model is set to the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, and the output is the future temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2. Attention, or attention mechanism, allows the model to selectively focus on the most informative time points or feature channels in the historical sequence, such as a short peak or a sudden change in a certain index, thereby improving the model's sensitivity to locally important events.
[0075] Step S302: Use temperature and humidity fluctuation data to train the initial model, and obtain the temperature and humidity fluctuation prediction model.
[0076] Step S303: For the current first cold transport process, denoted as the current cold transport process, collect the transport temperature sequence and transport humidity sequence corresponding to the current cold transport process; if the temperature and humidity in the corresponding transport temperature sequence and transport humidity sequence do not exceed the corresponding specified temperature range and specified humidity range, then obtain the corresponding data preprocessing and perform temperature and humidity fluctuation analysis to obtain the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1 and humidity index sequence 2, denoted as fluctuation analysis data;
[0077] Step S304: Input the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1 and humidity index sequence 2 into the temperature and humidity fluctuation prediction model to obtain the predicted temperature index sequence 1, temperature index sequence 2, humidity index sequence 1 and humidity index sequence 2, which are recorded as waveform prediction data.
[0078] In the specific implementation process, if the temperature and humidity in the corresponding transportation temperature sequence and transportation humidity sequence exceed the corresponding specified temperature range and specified humidity range, it means that the transportation temperature and transportation humidity do not comply with the relevant regulations, and an alarm will be issued directly without the need for subsequent abnormal detection and analysis.
[0079] Step S4 involves performing anomaly detection analysis on the fluctuation analysis data and waveform prediction data based on the temperature and humidity fluctuation range information to obtain the temperature and humidity anomaly detection analysis results. Step S4 includes the following sub-steps:
[0080] Step S401: For temperature, if temperature index 1 and temperature index 2 are both greater than the corresponding fluctuation threshold at the same time, then the temperature at the corresponding time is judged to be abnormal; otherwise, the temperature at the corresponding time is judged to be normal. A single index occasionally exceeding the threshold cannot immediately determine the temperature abnormality. Requiring two indices of different nature to exceed the threshold at the same time can filter out many accidental errors caused by noise or occasional short peaks, thus improving the reliability of detection.
[0081] For step S402, please refer to... Figure 3 As shown, the temperature at each time point is repeatedly judged based on the current temperature index sequence 1, temperature index sequence 2, and predicted temperature index sequence 1 and temperature index sequence 2.
[0082] Step S403: If the temperature fluctuates at the current moment and has fluctuated continuously for k6 times, then an abnormal temperature fluctuation is determined and a warning is issued; if the temperature fluctuates at some future moment and has fluctuated continuously for k6 times, then an abnormal temperature fluctuation is determined and a warning is issued; otherwise, the temperature is determined to be fluctuating normally, where k6 is the set number; in this embodiment, k6=3, which can be flexibly set; a single temperature fluctuation may just be instantaneous noise; continuous temperature fluctuations will be a real anomaly, requiring k6 consecutive times rather than a single threshold exceedance, which can filter out noise and occasional jumps while ensuring the accuracy of detection;
[0083] Step S404: Based on the current humidity index sequence 1 and humidity index sequence 2, as well as the predicted humidity index sequence 1 and humidity index sequence 2, repeat the humidity judgment; the judgment process is consistent with the temperature judgment process.
[0084] In the actual implementation process, more advanced detection strategies can also be set according to the actual application scenario. For example, when both temperature and humidity are about to become abnormal, the alarm level can be increased, or the two can be used as a joint trigger condition to activate stronger emergency measures.
[0085] Example 2, please refer to Figure 4 As shown, Figure 4 A schematic diagram of an electronic device is provided, which may include a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The memory stores computer-readable instructions, which the processor can call. When the processor executes a computer-readable instruction, it performs steps such as those in the attention-based cold chain temperature and humidity anomaly detection and analysis method to achieve the following functions: During cold chain transportation, it collects temperature and humidity change data of cold chain transport vehicles to obtain raw temperature and humidity sample data; it preprocesses the raw temperature and humidity sample data and performs temperature and humidity fluctuation analysis to obtain temperature and humidity fluctuation data, and obtains the normal temperature and humidity fluctuation threshold to obtain temperature and humidity fluctuation threshold information; it constructs a temperature and humidity fluctuation prediction model based on the temperature and humidity fluctuation data, performs temperature and humidity fluctuation analysis on the real-time collected temperature and humidity of cold chain transport vehicles, and performs temperature and humidity fluctuation prediction to obtain fluctuation analysis data and waveform prediction data; it performs anomaly detection analysis on the fluctuation analysis data and waveform prediction data based on the temperature and humidity fluctuation range information to obtain the temperature and humidity anomaly detection and analysis results.
[0086] Furthermore, when the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0087] Example 3: This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program performs steps such as those in the attention-based cold chain temperature and humidity anomaly detection and analysis method to achieve the following functions: During cold chain transportation, collecting temperature and humidity change data of cold chain transport vehicles to obtain raw temperature and humidity sample data; performing data preprocessing on the raw temperature and humidity sample data and conducting temperature and humidity fluctuation analysis to obtain temperature and humidity fluctuation data, and acquiring normal temperature and humidity fluctuation thresholds to obtain temperature and humidity fluctuation threshold information; constructing a temperature and humidity fluctuation prediction model based on the temperature and humidity fluctuation data, performing temperature and humidity fluctuation analysis on the real-time collected temperature and humidity of cold chain transport vehicles, and predicting temperature and humidity fluctuations to obtain fluctuation analysis data and waveform prediction data; and performing anomaly detection analysis on the fluctuation analysis data and waveform prediction data based on the temperature and humidity fluctuation range information to obtain temperature and humidity anomaly detection and analysis results.
[0088] Based on the above description of the embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the above technical solutions, in essence or in terms of their contribution to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or certain parts of the embodiments.
[0089] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces. The indirect coupling or communication connection between systems, modules, and units may be electrical, mechanical, or other forms.
[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting and analyzing abnormal temperature and humidity in the cold chain based on an attention mechanism, characterized in that, Includes the following steps: During cold chain transportation, data on temperature and humidity changes in cold chain transport vehicles are collected to obtain raw temperature and humidity sample data. The original temperature and humidity sample data are preprocessed and temperature and humidity fluctuation analysis is performed to obtain temperature and humidity fluctuation data and the normal temperature and humidity fluctuation threshold is obtained to obtain temperature and humidity fluctuation threshold information. A temperature and humidity fluctuation prediction model is constructed based on temperature and humidity fluctuation data. The temperature and humidity of the cold chain transport vehicles collected in real time are analyzed and predicted to obtain fluctuation analysis data and waveform prediction data. Anomaly detection and analysis are performed on the fluctuation analysis data and waveform prediction data based on the temperature and humidity fluctuation range information to obtain the temperature and humidity anomaly detection and analysis results.
2. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 1, characterized in that, During cold chain transportation, collecting temperature and humidity change data from cold chain transport vehicles to obtain raw temperature and humidity sample data includes the following sub-steps: The cold chain transportation process for any type of goods is referred to as the first cold chain process, and the cold chain transportation vehicle used in the first cold chain process is referred to as the first cold chain vehicle. The temperature and humidity inside the compartment of the first cold chain vehicle during the first cold transport process are recorded as transport temperature and transport humidity, respectively. Obtain the specified transport temperature range and specified transport humidity range during the first cold transport process, and record them as the specified temperature range and specified humidity range respectively in sequence.
3. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 2, characterized in that; During cold chain transportation, collecting temperature and humidity change data from cold chain transport vehicles to obtain raw temperature and humidity sample data includes the following sub-steps: The first normal cold transport process is denoted as the normal cold transport process. For any normal cold transport process, it is denoted as the first normal process. During the first normal process, the transport temperature and transport humidity are collected synchronously at the first time interval and arranged in chronological order, and recorded as the corresponding transport temperature sequence and transport humidity sequence, which are marked as the temperature and humidity change information of the first normal process, where the first time interval is t1. The temperature and humidity change information during multiple normal cold chain operations was collected repeatedly and recorded as the original temperature and humidity sample data.
4. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 3, characterized in that, The raw temperature and humidity sample data are preprocessed, and temperature and humidity fluctuation analysis is performed to obtain the normal temperature and humidity fluctuation threshold. The process for obtaining the temperature and humidity fluctuation threshold information includes the following sub-steps: For the transport temperature sequence and transport humidity sequence of the first normal process, any temperature in the transport temperature sequence is denoted as ET; the k1 temperatures closest to ET in the transport temperature sequence are obtained and denoted as the adjacent data of ET, and the mean AP and standard deviation AB of the adjacent data are calculated; where k1 is the number of values set. If ET is not located in [AP-k2×AB, AP+k2×AB], then ET is marked as abnormal data; otherwise, it is marked as normal data. If ET is abnormal data, then the two temperatures closest to ET are obtained, the average value is calculated, and ET is replaced with the average value. This process is repeated for all temperatures in the transport temperature sequence to obtain the preprocessed sequence corresponding to the transport temperature sequence, which is denoted as the standard temperature sequence. Here, k2 is the set scaling factor. Repeatedly acquire the preprocessed sequence corresponding to the transportation humidity sequence, denoted as the standard humidity sequence; repeatedly acquire the standard temperature sequence and standard humidity sequence corresponding to all normal cold transport processes in the original temperature and humidity sample data.
5. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 4, characterized in that, The process of preprocessing the raw temperature and humidity sample data and performing temperature and humidity fluctuation analysis to obtain the normal temperature and humidity fluctuation thresholds includes the following sub-steps: Set the sliding window size to k3 and the sliding step size to k4. For the standard temperature sequence and standard humidity sequence of the first normal process, slide synchronously from the starting position of the standard temperature sequence and standard humidity sequence, respectively. For any sliding window, it is denoted as the temperature window and the humidity window, respectively. Calculate the absolute difference between the maximum and minimum values in the temperature window, and record it as the range corresponding to the temperature window, labeled as temperature fluctuation index 1. Also, obtain the range corresponding to the humidity window, and label it as humidity fluctuation index 1. Record the collection time of the last data in the temperature window as the time corresponding to temperature fluctuation index 1 and humidity fluctuation index 1.
6. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 5, characterized in that, The process of preprocessing the raw temperature and humidity sample data and performing temperature and humidity fluctuation analysis to obtain the normal temperature and humidity fluctuation thresholds includes the following sub-steps: For any two adjacent temperatures within a temperature window, let CT be the temperature value. i and CT i+1 Where i represents the position number, the corresponding adjacent change |CT is calculated. i+1 -CT i | Repeat the calculation of adjacent temperature changes in the temperature window to obtain the set of window changes; Obtain the mean and median of the window variation set, and denote them as BP and BE respectively in order; obtain the number of data points in the window variation set that are greater than the mean, and denote them as the number of high variation points DG; denote the total number of data points in the window variation set as AG; calculate the fluctuation index DF corresponding to the temperature window, where DF = (DG / AG) × (BP / BE), and mark it as temperature fluctuation index 2; repeatedly obtain the fluctuation index corresponding to the humidity window, and mark it as humidity fluctuation index 2; and record the collection time of the last data point of the temperature window as the time corresponding to temperature fluctuation index 2 and humidity fluctuation index 2. Repeatedly acquire temperature fluctuation index 1, temperature fluctuation index 2, humidity fluctuation index 1, and humidity fluctuation index 2 corresponding to each sliding, and arrange them according to the sliding order, respectively, and record them as temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, which are recorded as the temperature and humidity fluctuation information of the first normal process; repeatedly acquire the temperature and humidity fluctuation information corresponding to all normal cold operation processes to obtain temperature and humidity fluctuation data.
7. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 6, characterized in that, The process of preprocessing the raw temperature and humidity sample data and performing temperature and humidity fluctuation analysis to obtain the normal temperature and humidity fluctuation thresholds includes the following sub-steps: For temperature fluctuation index 1, obtain all temperature fluctuation indices 1 in all temperature index sequences 1 and arrange them in ascending order, denoted as the first index sequence; take the middle k5% of the data in the first index sequence, denoted as the core interval, obtain the maximum value MU and the mean value PU in the core interval, as well as the absolute difference between the maximum and minimum values CU; calculate MU + (MU × CU / PU), denoted as the fluctuation threshold corresponding to temperature fluctuation index 1, where k5% is the set ratio; Repeatedly obtain the fluctuation thresholds corresponding to temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2 to obtain temperature and humidity fluctuation threshold information.
8. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 7, characterized in that, A temperature and humidity fluctuation prediction model is constructed based on temperature and humidity fluctuation data. This model analyzes the temperature and humidity fluctuations of cold chain transport vehicles collected in real time and predicts these fluctuations, including the following sub-steps: An initial model is built based on LSTM and Attention. The initial model includes an input layer, an attention layer, an LSTM layer, and an output layer. The input of the initial model is set to the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, and the output is the future temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2. The initial model was trained using temperature and humidity fluctuation data, resulting in a temperature and humidity fluctuation prediction model.
9. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 8, characterized in that, The process of constructing a temperature and humidity fluctuation prediction model based on temperature and humidity fluctuation data, analyzing temperature and humidity fluctuations in real-time collected data from cold chain transport vehicles, and making temperature and humidity fluctuation predictions also includes the following sub-steps: For the current first cold transport process, denoted as the current cold transport process, the transport temperature sequence and transport humidity sequence corresponding to the current cold transport process are collected; if the temperature and humidity in the corresponding transport temperature sequence and transport humidity sequence do not exceed the corresponding specified temperature range and specified humidity range, the corresponding data preprocessing is obtained, and temperature and humidity fluctuation analysis is performed to obtain the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1 and humidity index sequence 2, which are denoted as fluctuation analysis data; Input the current temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2 into the temperature and humidity fluctuation prediction model to obtain the predicted temperature index sequence 1, temperature index sequence 2, humidity index sequence 1, and humidity index sequence 2, which are denoted as waveform prediction data.
10. The cold chain temperature and humidity anomaly detection and analysis method based on attention mechanism according to claim 9, characterized in that, Based on the temperature and humidity fluctuation range information, anomaly detection and analysis are performed on the fluctuation analysis data and waveform prediction data to obtain the temperature and humidity anomaly detection and analysis results, including the following sub-steps: Regarding temperature, if temperature index 1 and temperature index 2 are both greater than the corresponding fluctuation threshold at the same time, then the temperature at the corresponding time is judged to be abnormal; otherwise, the temperature at the corresponding time is judged to be normal. Based on the current temperature index sequence 1, temperature index sequence 2, and predicted temperature index sequence 1 and temperature index sequence 2, the temperature at each time point is repeatedly judged. If the temperature fluctuates at the current moment and has fluctuated k6 times consecutively, it is determined that the temperature is fluctuating abnormally and a warning is issued; if the temperature fluctuates at some future moment and has fluctuated k6 times consecutively, it is determined that the temperature is about to fluctuate abnormally and a warning is issued. Otherwise, the temperature is judged to be fluctuating normally, where k6 is the set number; Based on the current humidity index sequence 1 and humidity index sequence 2, as well as the predicted humidity index sequence 1 and humidity index sequence 2, the humidity is repeatedly judged.
Citation Information
Patent Citations
Fault distinguishing, warning and regulating device and method for adaptive adjustment of cold chain temperature
CN113344151A