Underwater glider anomaly detection method based on data sequence
By preprocessing underwater glider data sequences and training anomaly detection models, and combining correlation differences and predicted output data, the problem of insufficient model representation ability in underwater glider anomaly detection is solved, and the accuracy and robustness of detection are improved.
Patent Information
- Application Number
- CN202411159713.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-08-22
AI Technical Summary
Existing technologies for anomaly detection in underwater gliders suffer from limited representation capabilities and poor robustness of machine learning models, making it difficult to meet the demand for accurate anomaly detection in complex marine environments. Furthermore, deep learning models struggle to determine various data features when data is lost.
By preprocessing the data sequences collected by the underwater glider, including data completion and normalization, using correlation differences, reconstructing sequences and predicting output data, and combining prior correlation and sequence correlation, the anomaly detection results are determined, and the anomaly detection model is trained and adjusted.
It improves the accuracy of anomaly detection, reduces the impact of missing data on detection results, adapts to association difference, reconstruction loss and prediction loss learning tasks, and enhances the accuracy and robustness of detection.
Smart Images

Figure CN119128376B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of artificial intelligence, in particular to an underwater glider anomaly detection method based on data sequences. BACKGROUND
[0002] An underwater glider is a new type of autonomous underwater vehicle driven by buoyancy, which can be used for long-time observation of the marine environment in the target sea area. In order to respond to various abnormal states of the glider in a timely manner, professional personnel usually monitor the data sent by the underwater glider to the shore-based control center after each emergence. Due to the limited detection accuracy of manual monitoring methods, the operating cost is too high, and as the scale of the underwater glider formation is expanded and the duration of the voyage is extended, manual monitoring cannot cover the entire voyage. With the development of machine learning and deep learning, methods for detecting the state of the underwater glider using machine learning and deep learning have emerged.
[0003] When using machine learning to detect the state of the underwater glider, traditional machine learning models such as isolation forest, one-class support vector machine, and local outlier factor are usually used to automatically detect anomalies in the multivariate time series data corresponding to the underwater glider. The anomaly detection method based on traditional machine learning reduces the labor cost to some extent, but the representation ability of the above models is limited, and the robustness to noise signals is poor, making it difficult to meet the precise anomaly detection requirements in complex marine environments.
[0004] Compared with the method of using machine learning to detect the state of the underwater glider, the method of using deep learning to detect the state of the underwater glider has better representation ability for non-linear complex time series features. Multivariate time series data anomaly detection methods based on deep learning can be roughly divided into reconstruction-based methods, prediction-based methods, and correlation difference-based methods.
[0005] In the implementation of the present disclosure, the inventors found that the existing technology at least has the following problems: using machine learning models for state monitoring reduces labor costs, but the representation ability of machine learning models is limited and the robustness is poor, so it is difficult to meet the accuracy requirements of anomaly detection. Using deep learning models for state monitoring requires a large amount of observation data for calculation, but the data sent by the underwater glider may be lost due to unstable sensors and other reasons, in addition, the deep learning model is difficult to determine the state of the underwater glider by using multiple data features determined based on observation data, so it is also difficult to meet the accuracy requirements of anomaly detection. SUMMARY
[0006] In view of the above problems, the present disclosure provides an underwater glider anomaly detection method based on data sequences.
[0007] According to a first aspect of the present disclosure, a data sequence-based underwater glider anomaly detection method is provided, comprising: preprocessing a data sequence collected by an underwater glider to obtain a to-be-detected data sequence, wherein the to-be-detected data sequence includes a training sequence and a label sequence, the training sequence includes data sequences with a length of W in the to-be-detected data sequence, the label sequence has a length of P and includes P-1 data sequences after the training data as prediction input data, and one data after the training data in the to-be-detected data sequence as reference output data; determining the correlation difference of the data corresponding to the time point in the training sequence, wherein the correlation difference represents the correlation degree between the data and the data corresponding to other time points in the training sequence; obtaining a reconstruction sequence based on the training sequence and the correlation difference; predicting the sequence based on the prediction input data in the label sequence to obtain prediction output data; and determining an anomaly detection result of the underwater glider based on the correlation difference, the reconstruction sequence, the prediction output data, and the reference output data.
[0008] According to an embodiment of the present disclosure, preprocessing a data sequence collected by an underwater glider to obtain a to-be-detected data sequence comprises: performing data completion on the data sequence to obtain a data completion result; normalizing the data completion result to obtain a normalized data sequence; and determining a training sequence and a label sequence based on the normalized data sequence.
[0009] According to an embodiment of the present disclosure, the data sequence includes a multi-element data sequence collected by one or more sensors of the underwater glider; performing data completion on the data sequence to obtain a data completion result comprises: determining a start time and an end time of each data sequence in the data sequence; in the case that the data sequence is a multi-element data sequence, determining a start collection time and an end collection time of the data sequence based on the plurality of start times and the plurality of end times; determining a plurality of resampling time stamps within a collection time interval, wherein the collection time interval is determined according to the start collection time and the end collection time; dividing the collection time interval into a plurality of interpolation windows using a first sliding window, wherein the preset window length and the sliding step of the first sliding window are both a first preset length; and performing interpolation at the resampling time stamps in each interpolation window using a linear interpolation method to obtain the data completion result.
[0010] According to an embodiment of the present disclosure, the data sequence-based underwater glider anomaly detection method further comprises: dividing the to-be-detected time series data multiple times to obtain a training sequence corresponding to each time point; determining a label sequence corresponding to the time point of the training sequence in the to-be-detected time series data based on each training sequence; determining an anomaly detection result of the underwater glider at the time point based on the training sequence and the label sequence of each time point; and determining an anomaly situation of the underwater glider based on the plurality of anomaly detection results.
[0011] According to an embodiment of the present disclosure, determining the correlation difference of the data corresponding to the time point in the training sequence comprises: inputting the training sequence into a first embedding layer of the anomaly detection model to obtain first embedding data; fusing the first embedding data and first position encoding of the data sequence to obtain first fusion data; and inputting the first fusion data into an encoder to obtain the correlation difference of the data corresponding to the time point in the training sequence, wherein the correlation difference comprises prior correlation and sequence correlation, the prior correlation represents a degree of correlation between the data corresponding to the time point and the training sequence calculated by using a first weight, and the sequence correlation represents a degree of correlation between the data corresponding to the time point and the training sequence calculated by using a second weight, wherein the first weight assigns a weight value to the data corresponding to other time points far away from the time point, which is lower than a weight value assigned to the data corresponding to other time points far away from the time point by the second weight.
[0012] According to an embodiment of the present disclosure, determining the anomaly detection result of the underwater glider based on the correlation difference, the reconstructed sequence, the predicted output data and the reference output data comprises: determining a reconstruction loss based on the reconstructed sequence and the training sequence; determining a prediction loss based on the predicted output data and the reference output data; determining the correlation difference based on the prior correlation and the sequence correlation; determining an anomaly score of the to-be-detected time series data based on the correlation difference, the reconstruction loss and the prediction loss; and determining the anomaly detection result of the underwater glider based on the anomaly score.
[0013] According to an embodiment of the present disclosure, determining the anomaly detection result of the underwater glider based on the anomaly score comprises: comparing the anomaly score with a preset anomaly threshold to determine a comparison result; and determining that the anomaly detection result of the underwater glider is state anomaly in a case where the comparison result represents that the anomaly score is greater than the anomaly threshold.
[0014] According to an embodiment of the present disclosure, obtaining the reconstructed sequence based on the training sequence and the correlation difference comprises: determining the correlation difference corresponding to the data in the training sequence; and reconstructing the training sequence based on the data and the correlation difference to obtain the reconstructed sequence.
[0015] According to an embodiment of the present disclosure, the training method of the anomaly detection model comprises: preprocessing a sample data sequence to obtain a to-be-detected sample data sequence, wherein the sample data sequence is obtained from a sample data sequence set, the sample data sequence set comprises historical readings of one or more sensors of the underwater glider changing over time, and the to-be-detected sample data sequence comprises a sample training sequence and a sample label sequence; inputting the to-be-detected sample data sequence into an initial anomaly detection model to obtain a sample correlation difference of the sample training sequence, a sample reconstruction sequence, and a sample predicted output data determined based on the sample label sequence; determining a loss function of the initial anomaly detection model based on the sample correlation difference, the sample reconstruction sequence, and the sample predicted output data; and adjusting model parameters of the initial anomaly detection model based on the loss function until a loss value determined based on the loss function is minimum.
[0016] According to an embodiment of the present disclosure, adjusting the model parameters of the initial anomaly detection model based on the loss function comprises: determining a size relationship between the prior correlation and the sequence correlation; in a case where the sample sequence correlation in the loss function is fixed, adjusting the prior correlation based on a minimum strategy and the size relationship to obtain an adjusted prior correlation; in a case where the sample prior correlation in the loss function is fixed, maximizing the sequence correlation based on a maximum strategy to obtain an adjusted sequence correlation; and adjusting the model parameters of the initial anomaly detection model based on the adjusted prior correlation and the adjusted sequence correlation.
[0017] The second aspect of the present disclosure provides an underwater glider anomaly detection device based on data sequences, comprising:
[0018] The data preprocessing module is configured to preprocess a data sequence collected by the underwater glider to obtain a to-be-detected data sequence, wherein the to-be-detected data sequence comprises a training sequence and a label sequence, the training sequence comprises a data sequence with a length of W in the to-be-detected data sequence, the label sequence has a length of P, and comprises P-1 data sequences after the training data as predicted input data, and one data after the training data in the to-be-detected data sequence as reference output data;
[0019] The correlation difference determination module is configured to determine a correlation difference of data corresponding to a time point in the training sequence, wherein the correlation difference represents a correlation degree between the data and data corresponding to other time points in the training sequence;
[0020] The sequence reconstruction module is configured to obtain a reconstruction sequence based on the training sequence and the correlation difference;
[0021] The sequence prediction module is configured to predict the sequence based on the predicted input data in the label sequence to obtain predicted output data; and
[0022] A result determination module is configured to determine an anomaly detection result of the underwater glider based on the correlation difference, the reconstructed sequence, the predicted output data, and the reference output data.
[0023] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method.
[0024] A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon a computer program or instructions, which, when executed by a processor, implement the steps of the method.
[0025] A fifth aspect of the present disclosure also provides a computer program product comprising a computer program or instructions, which, when executed by a processor, implement the steps of the method.
[0026] According to the embodiments of the present disclosure, the data sequence collected by the underwater glider is preprocessed to obtain the to-be-detected data sequence, which reduces the influence of missing data and data corresponding to abnormal time points on the detection result and improves the availability of the data. Based on the training sequence in the to-be-detected data sequence, the correlation difference and the reconstruction result are determined, and the correlation difference and the reconstruction loss are further determined. Based on the label sequence in the to-be-detected data sequence, the predicted output data is determined, and the prediction loss is further determined. Based on the correlation difference, the reconstruction loss, and the prediction loss, the anomaly detection result of the underwater glider is determined, so that the anomaly detection process can adapt to the correlation difference learning task, the reconstruction loss learning task, and the prediction loss learning task at the same time. Therefore, the features learned through different learning tasks can better represent the data, thereby improving the accuracy of the anomaly detection result. BRIEF DESCRIPTION OF DRAWINGS
[0027] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure, taken in conjunction with the accompanying drawings, in which:
[0028] Figure 1 An application scenario diagram of the underwater glider anomaly detection method, device, equipment, medium, and program product based on data sequences according to embodiments of the present disclosure is schematically shown;
[0029] Figure 2 A flowchart of the underwater glider anomaly detection method based on data sequences according to embodiments of the present disclosure is schematically shown;
[0030] Figure 3 A structure diagram of an anomaly detection model of the underwater glider anomaly detection based on data sequences according to embodiments of the present disclosure is schematically shown;
[0031] Figure 4 A bar chart of indexes of detection of the data sequence based underwater glider anomaly detection method and a comparative algorithm according to the embodiments of the present disclosure on a real world data set is schematically shown;
[0032] Figure 5 A waveform chart of anomaly detection of the data sequence based underwater glider anomaly detection method according to the embodiments of the present disclosure on an underwater glider actual data set is schematically shown;
[0033] Figure 6 A structure block diagram of the data sequence based underwater glider anomaly detection apparatus according to the embodiments of the present disclosure is schematically shown; and
[0034] Figure 7 A block diagram of an electronic device adapted to implement the data sequence based underwater glider anomaly detection method according to the embodiments of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0035] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it is to be understood that the following description is merely exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description of the embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it will be apparent to one skilled in the art that the embodiments of the present disclosure can be practiced without these specific details. In other instances, well-known structures and techniques have been omitted in order to avoid obscuring the concepts of the present disclosure.
[0036] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present disclosure. The terms "include", "comprise" and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0037] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present specification, and should not be interpreted in an idealized or excessively formal manner.
[0038] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include at least one of the items enumerated, but not limited to the items enumerated (e.g., "a system having at least one of A, B, and C" should include a system having A alone, a system having B alone, a system having C alone, a system having A and B together, a system having A and C together, a system having B and C together, and / or a system having A, B, and C together, etc.).
[0039] In the technical solutions of the present disclosure, the user information (including but not limited to user personal information, user image information, user equipment information such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards, take necessary security measures, do not violate public order and good customs, and provide corresponding operation portal for user selection authorization or refusal.
[0040] In the scenario of making automatic decisions by using personal information, the method, device and system provided by the embodiments of the present disclosure all provide corresponding operation portal for the user to select to agree or refuse the automatic decision result; if the user chooses to refuse, the expert decision process is entered. The expression "automatic decision" here refers to the activity of automatically analyzing, evaluating the behavior habits, interests and hobbies or economic, health and credit conditions of a person by a computer program and making decisions. The expression "expert decision" here refers to the activity of making decisions by personnel who are engaged in a certain field, have special experience, knowledge and skills and reach a certain professional level.
[0041] The embodiment of the present disclosure provides an underwater glider anomaly detection method based on a data sequence, comprising: preprocessing a data sequence collected by an underwater glider to obtain a to-be-detected data sequence, wherein the to-be-detected data sequence includes a training sequence and a label sequence, the training sequence includes a data sequence with a length of W in the to-be-detected data sequence, the label sequence has a length of P and includes P-1 data sequences after the training data as prediction input data, and one data after the training data in the to-be-detected data sequence as reference output data; determining the correlation difference of the data corresponding to the time point in the training sequence, wherein the correlation difference represents the correlation degree between the data and the data corresponding to other time points in the training sequence; obtaining a reconstruction sequence based on the training sequence and the correlation difference; predicting the sequence based on the prediction input data in the label sequence to obtain prediction output data; and determining an anomaly detection result of the underwater glider based on the correlation difference, the reconstruction sequence, the prediction output data and the reference output data.
[0042] Figure 1 The application scenario diagram of the underwater glider anomaly detection method, device, equipment, medium and program product based on a data sequence according to the embodiments of the present disclosure is schematically shown.
[0043] As Figure 1As shown, the application scenario 100 according to this embodiment can include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or fiber optic cables, and the like.
[0044] A user can use the first terminal device 101, the second terminal device 102, the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, and the like. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, and the like (only as examples).
[0045] The first terminal device 101, the second terminal device 102, the third terminal device 103 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, and the like.
[0046] The server 105 can be a server providing various services, such as a background management server providing support for a website browsed by a user using the first terminal device 101, the second terminal device 102, the third terminal device 103 (only as an example). The background management server can analyze and process received user requests and the like, and feed back the processing results (such as a webpage, information, or data, and the like obtained or generated according to a user request) to the terminal device.
[0047] It should be noted that the data sequence-based underwater glider anomaly detection method provided by the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the data sequence-based underwater glider anomaly detection apparatus provided by the embodiments of the present disclosure can generally be disposed in the server 105. The data sequence-based underwater glider anomaly detection method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Accordingly, the data sequence-based underwater glider anomaly detection apparatus provided by the embodiments of the present disclosure can also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.
[0048] It should be understood that, Figure 1The number of terminal devices, networks and servers in the figure is only illustrative. Any number of terminal devices, networks and servers can be provided according to implementation needs.
[0049] The following will be based on Figure 1 The described scenario, by Figures 2-5 The data sequence-based underwater glider anomaly detection method of the embodiments of the present disclosure is described in detail.
[0050] Figure 2 The flowchart of the data sequence-based underwater glider anomaly detection method according to the embodiments of the present disclosure is schematically shown.
[0051] As Figure 2 The data sequence-based underwater glider anomaly detection method of the embodiments includes operations S210-S250.
[0052] In operation S210, the data sequence collected by the underwater glider is preprocessed to obtain a to-be-detected data sequence, wherein the to-be-detected data sequence includes a training sequence and a label sequence.
[0053] According to the embodiments of the present disclosure, the training sequence includes data sequences of length W in the to-be-detected data sequence, and the label sequence has a length P, the label sequence includes the last P-1 data sequences in the training data and one data after the training data in the to-be-detected data sequence, wherein the last P-1 data sequences in the training data are the predicted input data in the label sequence, and the one data after the training data in the to-be-detected data sequence is the reference output data in the label sequence.
[0054] In operation S220, the correlation difference of the data corresponding to the time point in the training sequence is determined.
[0055] According to the embodiments of the present disclosure, in the case that abnormal data occurs at one or more time points in the training sequence, the data at the one or more time points has low correlation with other data in the training sequence, and the time point is an abnormal time point. Due to the scarcity of the above-mentioned abnormal time point, the abnormal time point itself is only good at establishing correlation with the data corresponding to the local time points near it, and it is difficult to establish correlation with the data corresponding to the distant time points.
[0056] In operation S230, the reconstruction sequence is obtained based on the training sequence and the correlation difference.
[0057] According to the embodiments of the present disclosure, the correlation difference can be used to represent the distribution characteristics of the plurality of data in the training sequence, and the training sequence is reconstructed based on the correlation difference and the data of the time point corresponding to the correlation difference in the training sequence to obtain the reconstruction sequence.
[0058] At operation S240, the sequence is predicted based on the predicted input data in the label sequence to obtain predicted output data.
[0059] According to an embodiment of the present disclosure, since the predicted input data in the label sequence is the previous sequence data of the reference output data, the reference output data can be predicted according to the predicted input data to obtain the predicted output data.
[0060] At operation S250, based on the correlation difference, the reconstructed sequence, the predicted output data and the reference output data, an anomaly detection result of the underwater glider is determined.
[0061] According to an embodiment of the present disclosure, based on the correlation difference, the reconstructed sequence, the predicted output data and the reference output data, an index for representing the anomaly severity of the underwater glider can be determined, wherein the index value comprehensively considers the loss when reconstructing the training sequence, the loss when predicting the label sequence and the loss determined according to the correlation difference.
[0062] According to an embodiment of the present disclosure, in the case that the index value is not greater than a preset threshold, the anomaly detection result represents that the underwater glider is normal, and in the case that the index value is greater than the preset threshold, the anomaly detection result represents that the underwater glider is abnormal.
[0063] According to an embodiment of the present disclosure, the data sequence collected by the underwater glider is preprocessed to obtain the to-be-detected data sequence, which reduces the influence of missing data and data corresponding to abnormal time points on the detection result, and improves the availability of the data. Based on the training sequence in the to-be-detected data sequence, the correlation difference and the reconstruction result are determined, and the correlation difference and the reconstruction loss are further determined, based on the label sequence in the to-be-detected data sequence, the predicted output data is determined, and the prediction loss is further determined, based on the correlation difference, the reconstruction loss and the prediction loss, the anomaly detection result of the underwater glider is determined, so that the anomaly detection process can adapt to the correlation difference learning task, the reconstruction loss learning task and the prediction loss learning task at the same time, therefore, the features learned through different learning tasks can better represent the data, thereby improving the accuracy of the anomaly detection result.
[0064] According to an embodiment of the present disclosure, the data sequence collected by the underwater glider is preprocessed to obtain the to-be-detected data sequence, including: performing data completion on the data sequence to obtain a data completion result; performing normalization on the data completion result to obtain a normalized data sequence; and determining the training sequence and the label sequence based on the normalized data sequence.
[0065] According to an embodiment of the present disclosure, since the data sequence is collected by the sensor of the underwater glider, data loss at some time points in the data sequence may occur due to sensor instability and the like, and therefore the data sequence can be completed by an interpolation method to obtain a data completion result.
[0066] According to an embodiment of the present disclosure, the data completion result is normalized to obtain a normalized data sequence, and the data normalization method includes but is not limited to minimum-maximum normalization, Z-score normalization, and fraction scaling normalization. The normalized data sequence is divided by using a sliding window method to determine a training sequence and a label sequence.
[0067] According to an embodiment of the present disclosure, data completion and normalization of the data sequence can improve the usability of the data, thereby improving the abnormality detection effect. Dividing the data to determine the training sequence and the label sequence can make the data meet the input format requirements of the model and improve the abnormality detection efficiency.
[0068] According to an embodiment of the present disclosure, the data sequence includes a multi-element data sequence collected by one or more sensors of the underwater glider. The data completion of the data sequence obtains a data completion result, including: determining a start time and an end time of each data sequence in the data sequence; in the case that the data sequence is a multi-element data sequence, determining a start collection time and an end collection time of the data sequence based on the plurality of start times and the plurality of end times; determining a plurality of resampling time stamps within a collection time interval, wherein the collection time interval is determined according to the start collection time and the end collection time; dividing the collection time interval into a plurality of interpolation windows by using a first sliding window, wherein the preset window length and the sliding step of the first sliding window are both a first preset length; and performing interpolation at the resampling time stamps in each interpolation window by using a linear interpolation method to obtain the data completion result.
[0069] According to an embodiment of the present disclosure, the data sequence includes a multi-element data sequence collected by one or more sensors of the underwater glider, and the data sequences collected by the plurality of sensors respectively include a depth data sequence, a roll angle data sequence, a pitch angle data sequence, a heading angle data sequence, a data sequence representing the change of the position of the battery pack over time, and the like.
[0070] According to an embodiment of the present disclosure, in the case that the data sequence is a multi-element data sequence, the data sequence is a multi-element data sequence collected by a plurality of sensors of the underwater glider, and the running time, sampling interval and other parameters of each of the plurality of sensors may be different, and therefore the working time of the plurality of sensors can be aligned by the data completion method.
[0071] According to an embodiment of the present disclosure, the start time and the end time of the data sequence collected by each sensor in the multi-dimensional data sequence are determined, wherein the start time represents the time when the sensor starts to work, and the end time represents the time when the sensor stops working.
[0072] According to an embodiment of the present disclosure, the start collection time and the end collection time of the data sequence are determined based on the start time and the end time of the data sequence collected by each sensor. As shown in formulas (1) and (2):
[0073] (1)
[0074] (2)
[0075] wherein, represents the start time of the data sequence collected by the jth sensor,
[0076] represents the end time of the data sequence collected by the jth sensor, the start collection time represents the start time of the sensor that starts to collect data earliest, and the end collection time represents the end time of the sensor that stops to collect data latest.
[0077] According to an embodiment of the present disclosure, the collection time interval is determined based on the start collection time and the end collection time, and a plurality of resampling time stamps are determined in the collection time interval. As shown in formula (3):
[0078] (3)
[0079] wherein q is a resampling interval.
[0080] According to an embodiment of the present disclosure, the collection time interval is divided into a plurality of interpolation windows by using a first sliding window, wherein the preset window length and the sliding step of the first sliding window are both a first preset length, wherein for the interpolation window including the resampling time stamp, a complete value at the resampling time stamp in each interpolation window is determined by using a linear interpolation method, the complete value is inserted into the position of the resampling time stamp, the data completion is completed, and a data completion result is obtained, wherein the complete value is calculated according to the data of each dimension in the multi-dimensional data sequence.
[0081] According to an embodiment of the present disclosure, the data sequence is completed, the time of the data collected by each sensor can be aligned, the input data features are more comprehensive, and the problem of prediction error caused by missing sensor data is avoided.
[0082] According to an embodiment of the present disclosure, after obtaining the data completion result, the average value and the standard deviation of the data completion result corresponding to the data collected by the jth sensor are calculated respectively and the standard deviation as shown in formulas (4) and (5)
[0083] (4)
[0084] (5)
[0085] wherein T represents the number of data, Z ij represents the value of the jth sensor at the ith time point.
[0086] According to an embodiment of the present disclosure, the data completion result corresponding to the data collected by the jth sensor is normalized based on the average value and the standard deviation as shown in formula (6)
[0087] (6)
[0088] wherein X ij represents the normalized result of the value of the jth sensor at the ith time point.
[0089] According to an embodiment of the present disclosure, the underwater glider anomaly detection method based on the data sequence further comprises: dividing the to-be-detected time series data multiple times to obtain training sequences corresponding to multiple time points; determining a label sequence corresponding to the time point of the training sequence in the to-be-detected time series data based on each training sequence; determining an anomaly detection result of the underwater glider at the time point based on the training sequence and the label sequence of each time point; and determining the abnormal situation of the underwater glider based on multiple anomaly detection results.
[0090] According to an embodiment of the present disclosure, the to-be-detected time series data is divided multiple times to obtain training sequences corresponding to multiple time points, wherein the division can be performed in a sliding window manner. For example, the to-be-detected time series data is divided into training sequences corresponding to multiple time points by using a second sliding window, wherein the time point of the training sequence can be determined according to the starting time point of the multiple data in each training sequence, the length of the second sliding window is W, and the sliding step is less than W, so as to ensure that the data of each time point in the to-be-detected time series data belongs to at least one training sequence after multiple divisions, and preferably, the sliding step can be 1.
[0091] According to an embodiment of the present disclosure, based on each training sequence, a label sequence corresponding to a time point of the training sequence is determined in the to-be-detected timing data, wherein the length of the label sequence is P, and P is less than W. For example, in the case that the time point corresponding to the last data of the training sequence is k, the data corresponding to the k-P+2th time point to the k+1th time point in the to-be-detected timing data is intercepted as the label sequence by using a third sliding window with a length of P, wherein the length of the data corresponding to the k-P+2th time point to the kth time point is P-1, which is the predicted input data in the label sequence, and the length of the data corresponding to the k+1th time point is 1, which is the reference output data in the label sequence.
[0092] According to an embodiment of the present disclosure, based on the training sequence and the label sequence of each time point, the associated difference, the reconstructed sequence, the predicted output data and the reference output data are determined, and the anomaly detection result of the underwater glider at the time point is determined, wherein the label sequence corresponding to the training sequence of a certain time point is the label sequence of the time point. Based on the plurality of anomaly detection results, the abnormal situation of the underwater glider is determined, in the case that all the plurality of anomaly detection results represent that the underwater glider is normal, the abnormal situation of the underwater glider represents that the underwater glider is working normally and is normal, and in the case that there is an anomaly detection result representing that the underwater glider is abnormal in the plurality of anomaly detection results, the abnormal situation of the underwater glider represents that the underwater glider is abnormal.
[0093] According to an embodiment of the present disclosure, the to-be-detected timing data is divided multiple times, so that the divided multiple windows cover all the data in the to-be-detected timing data, thereby ensuring that the state of the underwater glider at each time point in the to-be-detected timing data is detected, and ensuring the accuracy and comprehensiveness of the detection.
[0094] According to an embodiment of the present disclosure, the associated difference of the data corresponding to the time point in the training sequence is determined by: inputting the training sequence into a first embedding layer of the anomaly detection model to obtain first embedding data; fusing the first embedding data and the first position encoding of the data sequence to obtain first fusion data; and inputting the first fusion data into an encoder to obtain the associated difference of the data corresponding to the time point in the training sequence, wherein the associated difference includes prior association and sequence association, the prior association represents the degree of association between the data corresponding to the time point and the training sequence calculated by using a first weight, and the sequence association represents the degree of association between the data corresponding to the time point and the training sequence calculated by using a second weight, wherein the weight value allocated by the first weight to the data corresponding to other time points far away from the time point is lower than the weight value allocated by the second weight to the data corresponding to other time points far away from the time point.
[0095] According to an embodiment of the present disclosure, the training sequence is input into a first embedding layer of the anomaly detection model to obtain first embedding data, wherein the first embedding layer can be used to convert the input data into a data format that can be processed by the anomaly detection model, that is, the first embedding data is a data format that can be processed by the anomaly detection model, the input channel of the first embedding layer can be N, and the output channel can be The first embedding layer can include a convolutional layer with a convolution kernel size of 3.
[0096] According to an embodiment of the present disclosure, based on the position information of each of the plurality of data in the data sequence, a first position encoding of each of the plurality of data is determined, and the first embedding data is fused with the first position encoding to obtain first fusion data. Wherein the first position encoding The first position encoding can be determined according to formula (7):
[0097] (7)
[0098] Wherein, represents the data corresponding to one time point in the training sequence.
[0099] According to an embodiment of the present disclosure, the first fusion data is input into an encoder to obtain the correlation difference of the data corresponding to the time point in the training sequence, wherein the correlation difference includes prior correlation and sequence correlation, the prior correlation represents the correlation degree between the data corresponding to the time point and the training sequence calculated by using the first weight, and the sequence correlation represents the correlation degree between the data corresponding to the time point and the training sequence calculated by using the second weight, wherein the weight value allocated by the first weight to the data corresponding to other time points far away from the time point is lower than the weight value allocated by the second weight to the data corresponding to other time points far away from the time point, the first weight can be calculated by a learnable Gaussian kernel function, and the sequence correlation represents the correlation degree between the data corresponding to the time point and the training sequence, including the correlation weight distribution between the data of each time point and the entire training sequence, and the second weight can be calculated by self-attention in the transformer model.
[0100] Figure 3 The structure diagram of the anomaly detection model for anomaly detection of the underwater glider based on the data sequence according to an embodiment of the present disclosure is schematically shown.
[0101] As Figure 3 shown, the model structure includes two parts, wherein the first embedding layer, the encoder and the first decoder are used for processing the training sequence, and the second embedding layer and the second decoder are used for processing the label sequence.
[0102] Preferably, the encoder comprises L layers, each layer comprising an abnormal multi-head attention, a first layer normalization, a feed-forward layer, and a second layer normalization in sequence, wherein a residual connection is provided before the first layer normalization and the second layer normalization, the feed-forward layer comprises two convolution layers with a kernel size of 1 connected in series, the input channel of the first convolution layer is , the output channel is , the input channel of the second convolution layer is , and the output channel is .
[0103] According to an embodiment of the present disclosure, after the training sequence is combined with the first position encoding to obtain first fusion data, the first fusion data is input into the encoder, and the multi-element time series data output by the (l-1)th layer of the encoder is denoted as .
[0104] According to an embodiment of the present disclosure, the abnormal multi-head attention mechanism in the encoder is used to calculate the prior correlation and sequence correlation of the first fusion data.
[0105] According to an embodiment of the present disclosure, the multi-element time series data output by the (l-1)th layer of the encoder is processed by using the abnormal multi-head attention mechanism of the lth layer of the encoder to determine the prior correlation which can be calculated according to formula (8):
[0106] (8)
[0107] wherein, represents a kernel parameter matrix in a Gaussian distribution kernel function, and is obtained by mapping each time series data in the multi-element time series data output by the (l-1)th layer of the encoder by using a learnable Gaussian kernel parameter weight matrix . represents a Gaussian kernel parameter corresponding to the i-th time point in the first fusion data, i and j represent different time points, and by modifying the values of i and j, the prior correlation between the time series data at different time points can be determined, represents that the Gaussian distribution is normalized to the range of [0, 1].
[0108] According to an embodiment of the present disclosure, the multi-element time series data output by the (l-1)th layer of the encoder is processed by using the abnormal multi-head attention mechanism of the lth layer of the encoder to determine the sequence correlation which can be calculated according to formula (9):
[0109] (9)
[0110] wherein, Q and K are parameter matrices, and is obtained by mapping each time series data in the multi-element time series data output by the (l-1)th layer of the encoder by using a learnable weight matrix is mapped.
[0111] According to an embodiment of the present disclosure, each of the multiple time series data output by the (l-1)-th layer of the encoder is input into the l-th layer of the encoder, and the abnormal multi-head attention mechanism utilizes a learnable weight matrix to map a parameter matrix V, and utilizes V to calculate the reconstruction result of the sequence correlation through the abnormal multi-head attention mechanism As shown in equation (16):
[0112] (10)
[0113] According to an embodiment of the present disclosure, each of the multiple time series data output by the (l-1)-th layer of the encoder is input into the l-th layer of the encoder, and the abnormal multi-head attention mechanism utilizes a learnable weight matrix and its reconstruction result is connected in residual, and layer normalization is performed by using the first layer normalization to obtain the hidden representation of the l-th layer As shown in equation (11):
[0114] (11)
[0115] wherein, LayerNorm(·) represents layer normalization, and + represents residual connection.
[0116] According to an embodiment of the present disclosure, the hidden representation of the l-th layer is input into the feedforward layer for processing, and the processing result is connected in residual with is connected in residual, and layer normalization is performed by using the second layer normalization to obtain the time series data output by the l-th layer of the encoder As shown in equation (12):
[0117] (12)
[0118] wherein, FeedForward(·) represents the feedforward layer.
[0119] According to an embodiment of the present disclosure, the output of the L-th layer of the encoder is input into the decoder to obtain the reconstruction result of the training sequence, i.e., the reconstructed sequence .
[0120] According to an embodiment of the present disclosure, based on the training sequence, a correlation difference is determined, since the prior correlation reflects the inductive bias in the adjacent set at each time point, that is, the abnormal time point is more difficult to establish a strong correlation with the entire sequence, and is more inclined to establish a correlation with the adjacent time point, while the sequence correlation can provide a rich description of the temporal context, reflecting the dynamic pattern of the time series data, such as periodicity or trend, etc., and thus the change rule of the correlation difference can improve the accuracy of distinguishing normal and abnormal time points.
[0121] According to an embodiment of the present disclosure, based on the predicted input data in the label sequence, the sequence is predicted to obtain predicted output data, including: inputting the predicted input data into the second embedding layer of the anomaly detection model to obtain second embedding data, fusing the second embedding data and the second position encoding of the label sequence to obtain second fusion data, and inputting the second fusion data into the second decoder to obtain the predicted output data.
[0122] Preferably, the second embedding layer includes a convolution layer with a convolution kernel size of 3, an input channel of N, and an output channel of d model .
[0123] The second decoder includes L layers, each of which includes, in sequence, a masked multi-head self-attention mechanism, a third layer normalization, a multi-head self-attention mechanism, a fourth layer normalization, a feedforward layer, and a fifth layer normalization, wherein a residual connection is provided before each of the third layer normalization, the fourth layer normalization, and the fifth layer normalization, and the feedforward layer includes two convolution layers with a convolution kernel size of 1 connected in series, an input channel of , an output channel of , an input channel of , and an output channel of .
[0124] According to an embodiment of the present disclosure, the second decoder first uses the masked multi-head self-attention mechanism to extract the time series features of the input label sequence, and the masked multi-head self-attention mechanism uses the masking mechanism to process the learnable weight matrix, to ensure that only past information can be used when predicting the next element, but future information cannot be used, and secondly uses the multi-head self-attention mechanism to extract the time series features again in combination with the semantic information of the training sequence and the label sequence.
[0125] According to an embodiment of the present disclosure, the label sequence is fused with the second position encoding to obtain second fusion data, and the second fusion data is input into the second decoder, and the l-th layer of the second decoder determines a time series feature extraction result , as shown in equation (13).
[0126] (13)
[0127] According to an embodiment of the present disclosure, each time series data in the multi-dimensional time series data output by the second decoder l-1 layer is mapped to a tensor q and the time series feature extraction result after the mask multi-head self-attention mechanism The residual connection is performed, and the layer normalization processing is performed by using the third layer normalization to obtain the first hidden representation of the l-th layer .
[0128] According to an embodiment of the present disclosure, the hidden representation of the l-th layer of the second decoder is obtained by the learnable weight matrix W of the multi-head self-attention mechanism q mapping to obtain the tensor q, and the time series data output by the L-th layer of the encoder the learnable weight matrix W of the multi-head self-attention mechanism k , W v obtain the tensors k and v, and calculate the time series feature extraction result after the multi-head self-attention mechanism by using formula (14) :
[0129] (14)
[0130] According to an embodiment of the present disclosure, the time series feature extraction result after the multi-head self-attention mechanism of the l-th layer of the second decoder is obtained by and the first hidden representation of the l-th layer After the residual connection, the layer normalization processing is performed by using the fourth layer normalization to obtain the second hidden representation of the l-th layer, and the second hidden representation of the l-th layer is fed through the feedforward layer and is connected with the second hidden representation of the l-th layer after the residual connection. The layer normalization processing is performed by using the fifth layer normalization to obtain the time series data output by the l-th layer of the second decoder .
[0131] According to an embodiment of the present disclosure, the second decoder can include a linear layer with an input channel of and an output channel of N, and the time series data output by the L-th layer of the second decoder is mapped to the predicted output data corresponding to the label sequence by the linear layer , as shown in formula (15)
[0132] (15)
[0133] According to an embodiment of the present disclosure, the anomaly detection result of the underwater glider is determined based on the association difference, the reconstruction sequence, the prediction output data and the reference output data, including: determining a reconstruction loss based on the reconstruction sequence and the training sequence; determining a prediction loss based on the prediction output data and the reference output data; determining the association difference based on the prior association and the sequence association; and determining an anomaly score of the to-be-detected time series data based on the association difference, the reconstruction loss and the prediction loss; and determining the anomaly detection result of the underwater glider based on the anomaly score.
[0134] According to an embodiment of the present disclosure, the association difference is determined based on the prior association and the sequence association in the association difference As shown in formula (16):
[0135] (16)
[0136] wherein, AssDis(·) represents an association difference function, represents the first fusion data of a time window, L represents the number of layers of the encoder, KL(·||·) represents the KL divergence, and W represents the window length of the second sliding window, represents the prior association between the data corresponding to the i th time point in the input data of the l th layer of the encoder and the input data of the l th layer of the encoder, represents the sequence association between the data corresponding to the i th time point in the input data of the l th layer of the encoder and the input data of the l th layer of the encoder.
[0137] According to an embodiment of the present disclosure, the reconstruction loss is determined based on the reconstruction sequence and the training sequence As shown in formula (17):
[0138] (17)
[0139] wherein, L recon represents a reconstruction loss function, represents the data of a time window in the reconstruction result, represents the data of a time window in the training sequence, represents a data vector corresponding to the i th time point, represents a data vector corresponding to the i th time point.
[0140] According to an embodiment of the present disclosure, the prediction loss is determined based on the prediction output data and the reference output data As shown in formula (18):
[0141] (18)
[0142] wherein, L pre (·) represents a prediction loss function, represents the prediction output data of a time window, represents the label sequence of the same time window, represents the label sequence of the same time window, represents the data vector corresponding to the last time point, represents the reference output data of represents the reference output data of
[0143] According to an embodiment of the present disclosure, based on the correlation difference, the reconstruction loss and the prediction loss, an anomaly score of the to-be-detected time series data is determined, and based on the anomaly score, an anomaly detection result of the underwater glider is determined, as shown in formula (19):
[0144] (19)
[0145] wherein, β is a weight hyperparameter, which can be empirically taken.
[0146] According to an embodiment of the present disclosure, since the change rule of the correlation difference can improve the accuracy of distinguishing normal and abnormal time points, the determination of the anomaly score based on the correlation difference, the reconstruction loss and the prediction loss can comprehensively determine whether the time series data is abnormal, and further improve the detection accuracy of the underwater glider anomaly detection method based on the data sequence.
[0147] According to an embodiment of the present disclosure, based on the anomaly score, the anomaly detection result of the underwater glider is determined, including: comparing the anomaly score with a preset anomaly threshold to determine a comparison result; and in the case that the comparison result represents that the anomaly score is greater than the anomaly threshold, determining that the anomaly detection result of the underwater glider is state anomaly.
[0148] According to an embodiment of the present disclosure, based on the data in the training sequence, the correlation difference corresponding to the data is determined, and the time series data output by the encoder is determined by formula (12) , the time series data output by the encoder is input into the decoder to obtain the reconstruction result of the training sequence, i.e. the reconstruction sequence , as shown in formula (20):
[0149] (20)
[0150] wherein, Linear(·) represents a linear layer.
[0151] According to an embodiment of the present disclosure, the training method of the anomaly detection model comprises: preprocessing a sample data sequence to obtain a to-be-detected sample data sequence, wherein the sample data sequence is obtained from a sample data sequence set, the sample data sequence set comprises historical readings of one or more sensors of an underwater glider changing over time, and the to-be-detected sample data sequence comprises a sample training sequence and a sample label sequence; inputting the to-be-detected sample data sequence into an initial anomaly detection model to obtain a sample correlation difference of the sample training sequence, a sample reconstruction sequence, and a sample predicted output data determined based on the sample label sequence; determining a loss function of the initial anomaly detection model based on the sample correlation difference, the sample reconstruction sequence, and the sample predicted output data; and adjusting model parameters of the initial anomaly detection model based on the loss function until a loss value determined based on the loss function is minimum.
[0152] According to an embodiment of the present disclosure, the sample data sequence is processed by using a similar processing method as that for the data sequence, and after the sample correlation difference, the sample reconstruction loss, and the sample prediction loss corresponding to the sample data sequence are obtained respectively, the loss function of the initial anomaly detection model is determined based on the sample correlation difference, the sample reconstruction loss, and the sample prediction loss As shown in formula (21):
[0153] (21)
[0154] wherein k is a weight hyperparameter, which can be determined according to experience, and ||·||1 represents an L1 regularization loss.
[0155] According to an embodiment of the present disclosure, after the model parameters of the initial anomaly detection model are adjusted based on the loss function until the loss value determined based on the loss function is minimum, the current network parameters are fixed, and the anomaly detection model is obtained.
[0156] According to an embodiment of the present disclosure, the initial anomaly detection model is trained by using the sample time sequence data, and the model parameters of the initial anomaly detection model are adjusted, so as to improve the accuracy and robustness of the anomaly detection model after the adjustment in processing the time sequence data.
[0157] According to an embodiment of the present disclosure, the adjustment of the model parameters of the initial anomaly detection model based on the loss function comprises: determining a size relationship between the prior correlation and the sequence correlation; in the case that the sample sequence correlation in the loss function is fixed, adjusting the prior correlation based on a minimum strategy and the size relationship to obtain an adjusted prior correlation; in the case that the sample prior correlation in the loss function is fixed, maximizing the sequence correlation based on a maximum strategy to obtain an adjusted sequence correlation; and adjusting the model parameters of the initial anomaly detection model based on the adjusted prior correlation and the adjusted sequence correlation.
[0158] According to an embodiment of the present disclosure, the size relationship between the prior correlation and the sequence correlation is determined. In the case that the data at a certain time point in the sample data sequence is abnormal data, the abnormal data can have a higher correlation degree between the data at adjacent time points, but a lower correlation degree between the other data in the entire data sequence, so that the difference between the prior correlation and the sequence correlation of the abnormal data is small, and thus the correlation difference of the abnormal data is small. For the time point of normal data, since the correlation degree between the normal data and all the data in the entire data sequence is high, the difference between the prior correlation and the sequence correlation of the normal data is large, and thus the correlation difference of the normal data is large.
[0159] According to an embodiment of the present disclosure, in the model training stage, the learning goal is the data distribution rule and data characteristics of the time point corresponding to the normal data, so it is necessary to maximize the correlation difference. Since directly maximizing the correlation difference can cause the model to be excessively sensitive to the noise and abnormal values in the sample data sequence, and can cause the Gaussian kernel parameter in the prior correlation to be too small, resulting in subsequent optimization difficulties, the model parameters can be adjusted through an alternating minimization and maximization process by combining the max-min strategy.
[0160] According to an embodiment of the present disclosure, in the case that the sample sequence correlation in the loss function is fixed, the prior correlation is adjusted based on the min strategy and the size relationship by using the back propagation method, and the adjusted prior correlation is as shown in formula (22):
[0161] (22)
[0162] wherein, represents the sequence correlation The back propagation calculation is not performed, and the optimization goal of formula (22) is to reduce the difference between the adjusted prior correlation and the sequence correlation. In the case that the prior correlation is less than the sequence correlation, the prior correlation is enlarged, and in the case that the prior correlation is greater than the sequence correlation, the prior correlation is reduced.
[0163] According to an embodiment of the present disclosure, in the case that the sample prior correlation in the loss function is fixed, the sequence correlation is maximized based on the max strategy by using the back propagation method, and the adjusted sequence correlation is obtained, and the optimization goal of the second solution is as shown in formula (23):
[0164] (23)
[0165] wherein, represents the prior correlation The back propagation calculation is not performed.
[0166] According to an embodiment of the present disclosure, the loss function calculation result calculated by the max-min strategy is used to adjust the model parameters of the initial anomaly detection model, and the above back propagation and parameter adjustment process is repeatedly performed by using the max-min strategy until the value of the loss function is minimized, and the adjustment of the model parameters is completed.
[0167] According to an embodiment of the present disclosure, by using the max-min strategy, the learning process of the prior correlation can be additionally constrained, and the robustness of the training process and the accuracy of the anomaly detection can be improved.
[0168] According to an embodiment of the present disclosure, the data sequence-based underwater glider anomaly detection method is used to perform experiments on 5 authoritative real-world data sets representing the diversity of multi-dimensional time series data and 1 underwater glider actual data set. The data sets used are Mars Science Laboratory (MSL), Pooled Server Metrics (PSM), Soil Moisture Active Passive (SMAP), Server Machine Dataset (SMD), and Secure Water Treatment (SWaT). The real-world data set parameters are shown in Table 1.
[0169] Table 1
[0170]
[0171] Among them, Entities represents the number of entities, Dimensions represents the attribute dimension, Train and Test represent the number of training set and test set respectively, and Anomaly Rate represents the proportion of abnormal data in the total data of the data set.
[0172] According to an embodiment of the present disclosure, the effect of the data sequence-based underwater glider anomaly detection method can be reflected by comparative experiments with 7 more advanced models on the above 5 actual data sets, as shown in Table 2.
[0173] Table 2
[0174]
[0175] Among them, P is the accuracy (Precision), R is the recall (Recall), and F1 is the F1 score (F1 Score). According to Table 2, it can be determined that the data sequence-based underwater glider anomaly detection method achieves the best or second-best result among the 8 models in most indicators in most data sets.
[0176] In the underwater glider anomaly detection method based on data sequences, the length of the second sliding window of the training sequence is set to 100, the length of the label sequence is set to 10, and 512, the number of layers of the encoder and the second decoder is set to 3, the number of heads of the multi-head anomaly attention mechanism, the masked multi-head self-attention mechanism and the multi-head self-attention mechanism is set to 8, the weight hyperparameter k in the underwater glider anomaly detection loss function is set to 0.7, β is set to 0.6, and the data batch size is 1024. Five data sets are divided into training sets and validation sets in the ratio of 8:2, the maximum training round is set to 10, the Adam optimizer with learning rate and weight decay of 1e-4 is used to train the model, the training is stopped when the reconstruction loss on the validation set does not decrease for 5 consecutive rounds, and the model with the lowest reconstruction loss on the validation set is retained.
[0177] Figure 4 The bar chart of the indicators of the underwater glider anomaly detection method based on data sequences and the comparative algorithm for detection on real-world data sets is schematically shown.
[0178] As Figure 4 shown, the height of the bar chart is the average indicator of the 8 models on the 5 different data sets, and it can be determined that the three indicators of the underwater glider anomaly detection method based on data sequences, i.e., the average accuracy, the average recall rate and the average F1 score, are higher than those of other comparative algorithms.
[0179] According to the embodiment of the present disclosure, the specific characteristics of the underwater glider actual data set are shown in Table 3:
[0180] Table 3
[0181]
[0182] Among them, the underwater glider data with serial number 1 maintained a healthy running state throughout the process from deployment to the ocean to salvage on shore, and the underwater glider data with serial number 2 lost the right wing after deployment to the ocean for a period of time, and then maintained this abnormal state until salvaged on shore. Among them, the underwater glider data with serial number 1 is used to train the anomaly detection model, and the underwater glider data with serial number 2 is used to test the detection effect of the anomaly detection model.
[0183] Figure 5 The waveform diagram of the underwater glider anomaly detection method based on data sequences for anomaly detection on the underwater glider actual data set is schematically shown.
[0184] As Figure 5As shown, the waveform chart is used to represent, from top to bottom, depth data, roll angle data, pitch angle data of the underwater glider, position data representing the battery pack, heading angle data, and anomaly score. According to the waveform chart, it can be determined that the anomaly score suddenly exceeds the preset anomaly threshold when the timestamp is between 150000 and 175000, so the underwater glider is in an abnormal operating state after this time point. By analyzing a plurality of waveform charts, it can be determined that the roll angle of the underwater glider suddenly changes, and it is thus determined that the right wing of the underwater glider is lost after this time point.
[0185] Based on the above data sequence-based underwater glider anomaly detection method, the present disclosure further provides a data sequence-based underwater glider anomaly detection device. The following will be described in detail in combination with Figure 6 The device is described in detail.
[0186] Figure 6 The structure block diagram of the data sequence-based underwater glider anomaly detection device according to the embodiment of the present disclosure is schematically shown.
[0187] As Figure 6 shown, the data sequence-based underwater glider anomaly detection device 600 of this embodiment includes a data preprocessing module 610, a correlation difference determination module 620, a sequence reconstruction module 630, a sequence prediction module 640, and a result determination module 650.
[0188] The data preprocessing module 610 is configured to preprocess the data sequence collected by the underwater glider to obtain a to-be-detected data sequence, wherein the to-be-detected data sequence includes a training sequence and a label sequence, the training sequence includes data sequences with a length of W in the to-be-detected data sequence, the label sequence has a length of P, and includes the last P-1 data sequences in the training data as the prediction input data, and one data after the training data in the to-be-detected data sequence as the reference output data. In an embodiment, the data preprocessing module 610 can be configured to perform the operation S210 described above, and details are not repeated here.
[0189] The correlation difference determination module 620 is configured to determine the correlation difference of the data corresponding to the time point in the training sequence, wherein the correlation difference represents the degree of correlation between the data and the data corresponding to other time points in the training sequence. In an embodiment, the correlation difference determination module 620 can be configured to perform the operation S220 described above, and details are not repeated here.
[0190] The sequence reconstruction module 630 is configured to obtain a reconstructed sequence based on the training sequence and the correlation difference. In an embodiment, the sequence reconstruction module 630 can be configured to perform the operation S230 described above, and details are not repeated here.
[0191] The sequence prediction module 640 is configured to predict the sequence based on the predicted input data in the label sequence to obtain predicted output data. In an embodiment, the sequence prediction module 640 can be configured to perform the operation S240 described above, and details are not repeated here.
[0192] The result determination module 650 is configured to determine the anomaly detection result of the underwater glider based on the correlation difference, the reconstructed sequence, the predicted output data, and the reference output data. In an embodiment, the result determination module 650 can be configured to perform the operation S250 described above, and details are not repeated here.
[0193] According to an embodiment of the present disclosure, the data preprocessing module 610 includes a data completion sub-module, a data normalization sub-module, and a sequence determination sub-module.
[0194] The data completion sub-module is configured to complete the data sequence to obtain a data completion result.
[0195] The data normalization sub-module is configured to normalize the data completion result to obtain a normalized data sequence.
[0196] The sequence determination sub-module is configured to determine the training sequence and the label sequence based on the normalized data sequence.
[0197] According to an embodiment of the present disclosure, the data completion sub-module includes a sub-time determination unit, a time determination unit, a timestamp determination unit, a window determination unit, and a linear interpolation unit.
[0198] The sub-time determination unit is configured to determine a start time and an end time of each data sequence in the data sequence.
[0199] The time determination unit is configured to determine a start collection time and an end collection time of the data sequence based on the plurality of start times and the plurality of end times in a case where the data sequence is a multivariate data sequence.
[0200] The timestamp determination unit is configured to determine a plurality of resampling time stamps in a collection time interval, wherein the collection time interval is determined according to the start collection time and the end collection time.
[0201] The window determination unit is configured to divide the collection time interval into a plurality of interpolation windows by using a first sliding window, wherein a preset window length and a sliding step of the first sliding window are both a first preset length.
[0202] The linear interpolation unit is configured to perform interpolation at the resampling time stamps in each interpolation window by using a linear interpolation method to obtain the data completion result.
[0203] According to an embodiment of the present disclosure, the underwater glider anomaly detection device 600 based on the data sequence further comprises a data division module, a label determination module, a detection result determination module and an anomaly determination module.
[0204] The data division module is configured to divide the to-be-detected time series data multiple times to obtain training sequences corresponding to multiple time points.
[0205] The label determination module is configured to determine, based on each training sequence, a label sequence corresponding to the time point of the training sequence in the to-be-detected time series data.
[0206] The detection result determination module is configured to determine, based on the training sequence and the label sequence of each time point, an anomaly detection result of the underwater glider at the time point.
[0207] The anomaly determination module is configured to determine, based on the multiple anomaly detection results, an anomaly situation of the underwater glider.
[0208] According to an embodiment of the present disclosure, the association difference determination module 620 comprises an embedded data determination sub-module, a fusion data determination sub-module and an association difference determination sub-module.
[0209] The embedded data determination sub-module is configured to input the training sequence into a first embedding layer of the anomaly detection model to obtain first embedded data.
[0210] The fusion data determination sub-module is configured to fuse the first embedded data and the first position encoding of the data sequence to obtain first fusion data.
[0211] The association difference determination sub-module is configured to input the first fusion data into an encoder to obtain an association difference of the data corresponding to the time point in the training sequence, wherein the association difference comprises a prior association and a sequence association, the prior association represents an association degree between the data corresponding to the time point and the training sequence calculated by using a first weight, and the sequence association represents an association degree between the data corresponding to the time point and the training sequence calculated by using a second weight, wherein the first weight assigns a weight value to the data corresponding to other time points far away from the time point, which is lower than a weight value assigned to the data corresponding to other time points far away from the time point by the second weight.
[0212] According to an embodiment of the present disclosure, the result determination module 650 comprises a first error determination sub-module, a second error determination sub-module, a difference determination sub-module, a score determination sub-module and a result determination sub-module.
[0213] The first error determination sub-module is configured to determine a reconstruction loss based on the reconstructed sequence and the training sequence.
[0214] The second error determination sub-module is configured to determine a prediction loss based on the predicted output data and the reference output data.
[0215] The difference determination sub-module is configured to determine the correlation difference based on the prior correlation and the sequence correlation.
[0216] The score determination sub-module is configured to determine an anomaly score of the to-be-detected time series data based on the correlation difference, the reconstruction loss, and the prediction loss.
[0217] The result determination sub-module is configured to determine an anomaly detection result of the underwater glider based on the anomaly score.
[0218] According to an embodiment of the present disclosure, the result determination sub-module includes a result comparison unit and a result determination unit.
[0219] The result comparison unit is configured to compare the anomaly score with a preset anomaly threshold to determine a comparison result.
[0220] The result determination unit is configured to determine that the anomaly detection result of the underwater glider is a state anomaly when the comparison result indicates that the anomaly score is greater than the anomaly threshold.
[0221] According to an embodiment of the present disclosure, the sequence reconstruction module 630 includes a data determination sub-module and a sequence reconstruction sub-module.
[0222] The data determination sub-module is configured to determine, based on data in the training sequence, a correlation difference corresponding to the data.
[0223] The sequence reconstruction sub-module is configured to reconstruct the training sequence based on the data and the correlation difference to obtain a reconstructed sequence.
[0224] According to an embodiment of the present disclosure, the underwater glider anomaly detection apparatus 600 based on a data sequence further includes a sample data preprocessing module, a sample data processing module, a loss determination module, and a loss optimization module.
[0225] The sample data preprocessing module is configured to preprocess a sample data sequence to obtain a to-be-detected sample data sequence, where the sample data sequence is obtained from a sample data sequence set, the sample data sequence set includes historical readings of one or more sensors of the underwater glider over time, and the to-be-detected sample data sequence includes a sample training sequence and a sample label sequence.
[0226] The sample data processing module is configured to input the to-be-detected sample data sequence into the initial anomaly detection model to obtain a sample correlation difference of the sample training sequence, a sample reconstructed sequence, and a sample prediction output data determined based on the sample label sequence.
[0227] The loss determination module is configured to determine a loss function of the initial anomaly detection model based on the sample correlation difference, the sample reconstructed sequence, and the sample prediction output data.
[0228] The parameter adjustment module is configured to adjust the model parameters of the initial anomaly detection model based on the loss function until a loss value determined based on the loss function is minimum.
[0229] According to an embodiment of the present disclosure, the parameter adjustment module comprises a size determination sub-module, a prior adjustment sub-module, a sequence adjustment sub-module, and a parameter adjustment sub-module.
[0230] The size determination sub-module is configured to determine a size relationship between the prior correlation and the sequence correlation.
[0231] The prior adjustment sub-module is configured to, in a case where the sample sequence correlation in the loss function is fixed, adjust the prior correlation based on a minimum strategy and the size relationship to obtain an adjusted prior correlation.
[0232] The sequence adjustment sub-module is configured to, in a case where the sample prior correlation in the loss function is fixed, maximize the sequence correlation based on a maximum strategy to obtain an adjusted sequence correlation.
[0233] The parameter adjustment sub-module is configured to adjust the model parameters of the initial anomaly detection model based on the adjusted prior correlation and the adjusted sequence correlation.
[0234] According to an embodiment of the present disclosure, any one or more of the data preprocessing module 610, the correlation difference determination module 620, the sequence reconstruction module 630, the sequence prediction module 640, and the result determination module 650 can be combined in one module, or any one of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the data preprocessing module 610, the correlation difference determination module 620, the sequence reconstruction module 630, the sequence prediction module 640, and the result determination module 650 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging a circuit, etc. hardware or firmware, or in any one of software, hardware, and firmware implementation or in any appropriate combination of any of them. Alternatively, at least one of the data preprocessing module 610, the correlation difference determination module 620, the sequence reconstruction module 630, the sequence prediction module 640, and the result determination module 650 can be at least partially implemented as a computer program module that can perform corresponding functions when the computer program module is run.
[0235] Figure 7A block diagram of an electronic device suitable for implementing a data sequence based underwater glider anomaly detection method according to embodiments of the present disclosure is shown schematically.
[0236] As shown in Figure 7 The electronic device 700 according to embodiments of the present disclosure includes a processor 701 that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 702 or loaded into a random access memory (RAM) 703 from a storage section 708. The processor 701 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor, and / or a related chipset and / or a dedicated microprocessor (e.g., an application specific integrated circuit (ASIC)), and the like. The processor 701 can also include an on-board memory for cache use. The processor 701 can include a single processing unit or multiple processing units for executing different actions of the method processes according to embodiments of the present disclosure.
[0237] In the RAM 703, various programs and data required for the operation of the electronic device 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. The processor 701 performs various operations of the method processes according to embodiments of the present disclosure by executing programs in the ROM 702 and / or the RAM 703. Note that the programs can also be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 can also perform various operations of the method processes according to embodiments of the present disclosure by executing programs stored in the one or more memories.
[0238] According to embodiments of the present disclosure, the electronic device 700 can also include an input / output (I / O) interface 705 that is also connected to the bus 704. The electronic device 700 can also include one or more of the following components connected to the input / output (I / O) interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as necessary. A removable medium 711 such as a magnetic disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 710 as necessary, so that a computer program read out therefrom is installed into the storage section 708 as necessary.
[0239] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present disclosure.
[0240] According to an embodiment of the present disclosure, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer readable storage medium can include one or more of the ROM 702 and / or the RAM 703 described above, and / or one or more memories other than the ROM 702 and the RAM 703.
[0241] An embodiment of the present disclosure further includes a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the methods provided by the embodiments of the present disclosure.
[0242] The above functions defined in the system / apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 701. According to an embodiment of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0243] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage medium, a magnetic storage medium, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be downloaded and installed via the communication part 709 and / or installed from the detachable medium 711. The program codes contained in the computer program can be transmitted via any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.
[0244] In such embodiments, the computer program can be downloaded and installed from the network via the communication section 709, and / or installed from the removable media 711. When the computer program is executed by the processor 701, the above-described functions defined in the system of the embodiments of the present disclosure are executed. According to the embodiments of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by the computer program modules.
[0245] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, "C" language or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected to the Internet through an Internet service provider).
[0246] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions, and operations of the systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than those noted in the drawings. For example, two blocks that are shown in succession can actually be executed substantially concurrently, or they can sometimes be executed in reverse order, depending on the involved functions. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0247] Those skilled in the art can understand that the features described in various embodiments of the present disclosure can be combined and / or integrated in various combinations, even if such combinations are not explicitly described in the present disclosure. In particular, the features described in various embodiments of the present disclosure can be combined and / or integrated in various combinations without departing from the spirit and teachings of the present disclosure. All such combinations and / or integrations fall within the scope of the present disclosure.
[0248] The above describes embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and these substitutions and modifications should all fall within the scope of the present disclosure.
Claims
1. An underwater glider anomaly detection method based on data sequence, characterized in that, The method comprises: Preprocessing a data sequence collected by an underwater glider to obtain a to-be-detected data sequence, wherein the data sequence comprises a multivariate data sequence collected by one or more sensors of the underwater glider, the multivariate data sequence comprises a depth data sequence, a roll angle data sequence, a pitch angle data sequence, a heading angle data sequence, and a data sequence representing a change in position of a battery pack over time of the underwater glider, the to-be-detected data sequence comprises a training sequence and a label sequence, the training sequence comprises data sequences with a length of W in the to-be-detected data sequence, the label sequence has a length of P, comprises P-1 data sequences after the training data as prediction input data, and one data after the training data in the to-be-detected data sequence as reference output data; the label sequence is determined based on the training sequence, corresponding time points of the label sequence in the to-be-detected time sequence data are determined, in a case where a last data of the training sequence corresponds to a time point k, data with a length of P-1 between the k-P+2th time point and the k+1th time point are taken as the label sequence, and P is less than W; Determining a correlation difference of data corresponding to a time point in the training sequence, wherein the correlation difference represents a correlation degree between the data and data corresponding to other time points in the training sequence; Based on the training sequence and the correlation difference, a reconstruction sequence is obtained; Based on the prediction input data in the label sequence, a sequence is predicted to obtain prediction output data, and based on the correlation difference, the reconstruction sequence, the prediction output data, and the reference output data, an anomaly detection result of the underwater glider is determined.
2. The method of claim 1, wherein, The preprocessing of the data sequence collected by the underwater glider to obtain the to-be-detected data sequence comprises: Data completion is performed on the data sequence to obtain a data completion result; Normalization is performed on the data completion result to obtain a normalized data sequence, and based on the normalized data sequence, the training sequence and the label sequence are determined.
3. The method of claim 2, wherein The data completion on the data sequence to obtain the data completion result comprises: Determining a start time and an end time of each data sequence in the data sequence; In a case where the data sequence is the multivariate data sequence, based on a plurality of start times and a plurality of end times, a start collection time and an end collection time of the data sequence are determined; A plurality of resampling time stamps are determined in a collection time interval, wherein the collection time interval is determined according to the start collection time and the end collection time; The collection time interval is divided into a plurality of interpolation windows by using a first sliding window, wherein a preset window length and a sliding step of the first sliding window are both a first preset length; and interpolation is performed at the resampling time stamps in each interpolation window by using a linear interpolation method to obtain a data completion result.
4. The method of claim 2, wherein, The method further comprises: dividing the to-be-detected time series data multiple times to obtain the training sequence corresponding to each of the time points; based on each of the training sequences, determining the label sequence corresponding to the time point of the training sequence in the to-be-detected time series data; based on the training sequence and the label sequence of each of the time points, determining the anomaly detection result of the autonomous underwater vehicle at the time point; and based on multiple anomaly detection results, determining the abnormal situation of the autonomous underwater vehicle.
5. The method of claim 2, wherein, The determination of the correlation difference of the data corresponding to the time point in the training sequence comprises: inputting the training sequence into a first embedding layer of the anomaly detection model to obtain first embedding data; fusing the first embedding data and the first position encoding of the data sequence to obtain first fusion data; and inputting the first fusion data into an encoder to obtain the correlation difference of the data corresponding to the time point in the training sequence, wherein the correlation difference comprises prior correlation and sequence correlation, the prior correlation represents the correlation degree between the data corresponding to the time point and the training sequence calculated by using a first weight, and the sequence correlation represents the correlation degree between the data corresponding to the time point and the training sequence calculated by using a second weight, wherein the weight value allocated by the first weight to the data corresponding to other time points far away from the time point is lower than the weight value allocated by the second weight to the data corresponding to other time points far away from the time point.
6. The method of claim 5, wherein, The determination of the anomaly detection result of the autonomous underwater vehicle based on the correlation difference, the reconstruction sequence, the predicted output data and the reference output data comprises: determining a reconstruction loss based on the reconstruction sequence and the training sequence; determining a prediction loss based on the predicted output data and the reference output data; determining a correlation difference based on the prior correlation and the sequence correlation; determining an anomaly score of the to-be-detected time series data based on the correlation difference, the reconstruction loss and the prediction loss; and determining the anomaly detection result of the autonomous underwater vehicle based on the anomaly score.
7. The method of claim 6, wherein, The determination of the anomaly detection result of the autonomous underwater vehicle based on the anomaly score comprises: comparing the anomaly score with a preset anomaly threshold to determine a comparison result; and in a case where the comparison result represents that the anomaly score is greater than the anomaly threshold, determining that the anomaly detection result of the autonomous underwater vehicle is a state anomaly.
8. The method of claim 1, wherein, The determination of the reconstruction sequence based on the training sequence and the correlation difference comprises: determining the correlation difference corresponding to the data in the training sequence based on the data; and reconstructing the training sequence based on the data and the correlation difference to obtain the reconstruction sequence.
9. The method of claim 5, wherein, The training method of the anomaly detection model comprises: Preprocess a sample data sequence to obtain a to-be-detected sample data sequence, wherein the sample data sequence is obtained from a sample data sequence set, the sample data sequence set includes historical readings of the one or more sensors of the underwater glider over time, and the to-be-detected sample data sequence includes a sample training sequence and a sample label sequence; input the to-be-detected sample data sequence into an initial anomaly detection model to obtain a sample correlation difference of the sample training sequence, a sample reconstruction sequence, and a sample predicted output data determined based on the sample label sequence; determine a loss function of the initial anomaly detection model based on the sample correlation difference, the sample reconstruction sequence, and the sample predicted output data; and adjust model parameters of the initial anomaly detection model based on the loss function until a loss value determined based on the loss function is minimum.
10. The method of claim 9, wherein, The adjusting of the model parameters of the initial anomaly detection model based on the loss function includes: determining a size relationship between the prior correlation and the sequence correlation; in a case where the sample sequence correlation in the loss function is fixed, adjusting the prior correlation based on a minimum strategy and the size relationship to obtain an adjusted prior correlation; in a case where the sample prior correlation in the loss function is fixed, maximizing the sequence correlation based on a maximum strategy to obtain an adjusted sequence correlation; and adjusting the model parameters of the initial anomaly detection model based on the adjusted prior correlation and the adjusted sequence correlation.
Citation Information
Patent Citations
Track geometric irregularity anomaly detection method and device based on deep learning
CN118035824A