A water level data anomaly detection method and device, a terminal device, and a storage medium
By combining current and historical water level data for detection, the problem of abnormal data collected by water level sensors has been solved, achieving higher precision in detecting abnormal water level data.
Patent Information
- Application Number
- CN202211623027.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-16
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-12-16
AI Technical Summary
Existing technologies contain outliers in the water level data collected by water level sensors, making it impossible to accurately obtain the true state of water bodies such as rivers and reservoirs.
By acquiring the current actual water level data and the predicted water level data, and combining them with the actual water level data from historical times, anomaly detection is performed from two dimensions. The deviation value and data range are used to determine the anomaly of the water level data.
This improves the accuracy of anomaly detection in water level data, ensuring the accuracy and reliability of the data.
Smart Images

Figure CN115796048B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of hydrological technology, and in particular relates to a method, device, terminal equipment and storage medium for detecting water level data anomalies. Background Technology
[0002] When monitoring water levels in rivers, reservoirs, and other bodies of water, the acquired water level data is mostly obtained using water level sensors. However, the data acquisition process of these sensors is often affected by factors such as their installation method and built-in algorithms, resulting in numerous outliers in the collected water level data. Based on this outlier water level data, it is impossible to obtain the true state of rivers, reservoirs, and other bodies of water. Therefore, how to detect anomalies in water level data is a pressing technical problem that needs to be solved. Summary of the Invention
[0003] This application provides a method, apparatus, terminal device, and storage medium for detecting anomalies in water level data, which can detect anomalies in water level data.
[0004] In a first aspect, embodiments of this application provide a method for detecting anomalies in water level data, the method comprising: Obtain the current actual water level data and the predicted water level data; Based on the first actual water level data and the predicted water level data, a first judgment result is determined, wherein the first judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. Obtain the second actual water level data at a historical moment; Based on the first actual water level data and the second actual water level data, a second judgment result is determined, wherein the second judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. Based on the first judgment result and the second judgment result, anomaly detection is performed on the first actual water level data.
[0005] Secondly, embodiments of this application provide a water level data anomaly detection device, the device comprising: The first acquisition module is used to acquire the first actual water level data and the predicted water level data at the current moment. The first judgment module is used to determine a first judgment result based on the first actual water level data and the predicted water level data, wherein the first judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. The second acquisition module is used to acquire the second actual water level data at historical moments. The second judgment module is used to determine a second judgment result based on the first actual water level data and the second actual water level data. The second judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. An anomaly detection module is used to perform anomaly detection on the first actual water level data based on the first judgment result and the second judgment result.
[0006] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the water level data anomaly detection method described in the first aspect above.
[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the water level data anomaly detection method described in the first aspect above.
[0008] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the water level data anomaly detection method described in the first aspect above.
[0009] The beneficial effects of this application embodiment compared with the prior art are as follows: It acquires the first actual water level data and predicted water level data at the current moment; determines a first judgment result based on the first actual water level data and predicted water level data; acquires the second actual water level data at historical moments; determines a second judgment result based on the first actual water level data and the second actual water level data; and performs anomaly detection on the first actual water level data based on the first judgment result and the second judgment result. This application can perform anomaly detection on water level data, and it performs anomaly detection on water level data from two dimensions, thus improving the accuracy of anomaly detection on water level data. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating a method for detecting anomalies in water level data provided in one embodiment of this application; Figure 2 This is a flowchart illustrating a method for detecting anomalies in water level data provided in another embodiment of this application; Figure 3 This is a schematic structural block diagram of a water level data anomaly detection device provided in one embodiment of this application; Figure 4 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation
[0012] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0013] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0014] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0015] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0016] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0017] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0018] Example 1: Please see Figure 1 , Figure 1 The illustration shows a schematic flow of a water level data anomaly detection method provided in this application.
[0019] Step 101: Obtain the first actual water level data and the predicted water level data at the current moment.
[0020] The first actual water level data is the water level data obtained from water level sampling at the current moment. Optionally, the first actual water level data can be obtained through a water level sensor, such as a water level gauge. The sampling interval of the water level gauge can be determined by the user; as an example rather than a limitation, the sampling interval can be five minutes.
[0021] Optionally, if the first actual water level data is not obtained at the current moment, a data breakpoint warning can be issued to remind the user that the water level sensor is malfunctioning or that the data transmission process is malfunctioning.
[0022] The predicted water level data is the predicted water level data for the current moment. Optionally, the predicted water level data can be obtained through a neural network model.
[0023] As an example and not a limitation, the neural network model can be a Long Short-Term Memory (LSTM) network model. The input to the LSTM network model can be water level data collected in the first time period before the current moment. The values of the first time period can be set by the user.
[0024] Optionally, to ensure the prediction accuracy of the LSTM network model, the LSTM network model can be retrained at regular intervals.
[0025] Step 102: Based on the first actual water level data and the predicted water level data, determine the first judgment result.
[0026] The first judgment result is either that the first actual water level data is abnormal or that the first actual water level data is normal.
[0027] Optionally, the deviation value between the first actual water level data and the predicted water level data can be obtained. If the deviation value is greater than or equal to a set value, the first judgment result is determined to be that the first actual water level data is abnormal data; if the deviation value is less than the set value, the first judgment result is determined to be that the first actual water level data is normal data.
[0028] Optionally, before determining the first judgment result based on the first actual water level data and the predicted water level data, the method further includes: determining whether the current time is within the target time period, where the target time period is the period in which the water level changes due to the target event.
[0029] Based on the first actual water level data and the predicted water level data, a first judgment result is determined, including: when the current time is not within the target time period, the first judgment result is determined based on the first actual water level data and the predicted water level data.
[0030] The target event will cause a sudden change in water level. In order to avoid identifying the water level data after the sudden change as abnormal data, this application can first determine whether the current time is within the target time period. If the current time is within the target time period, the first actual water level data will not be included in the scope of anomaly detection.
[0031] As an example and not a limitation, the target event can be a rainfall event, a gate opening / closing event, or other similar events. Rainfall events can refer to heavy rainfall events; optionally, rainfall events with intensity exceeding a set threshold can be defined as heavy rainfall events. Gate opening / closing events include gate opening events and gate closing events.
[0032] Step 103: Obtain the second actual water level data at the historical moment.
[0033] The second actual water level data is the water level data obtained from historical time periods. Optionally, the historical time period can be a time within a second time interval preceding the current time. The value of the second time interval can be set by the user.
[0034] The second actual water level data is used to determine whether the first actual water level data is abnormal. Therefore, in order to ensure the accuracy of the judgment result, the second actual water level data can be normal data, that is, normal data determined after anomaly detection of the water level data collected in the second time period before the current time.
[0035] Step 104: Determine the second judgment result based on the first actual water level data and the second actual water level data.
[0036] The second judgment result is either that the first actual water level data is abnormal or that the first actual water level data is normal.
[0037] Optionally, based on the first actual water level data and the second actual water level data, a second judgment result is determined, including: based on the first actual water level data and the second actual water level data, a first data interval is determined, where the first data interval is the interval containing normal data; if the first actual water level data is within the first data interval, the second judgment result is that the first actual water level data is normal data; if the first actual water level data is not within the first data interval, the second judgment result is that the first actual water level data is abnormal data.
[0038] Optionally, determining a first data interval based on the first actual water level data and the second actual water level data includes: calculating a first expectation and the standard deviation of the first actual water level data and the second actual water level data, wherein the first expectation is the expectation of the first actual water level data and the second actual water level data; and determining the first data interval based on the first expectation and the standard deviation.
[0039] In an optional embodiment, the first data interval determined based on the first expectation and standard deviation can be [ , ],in, As the first expectation, The standard deviation is denoted as .
[0040] Judging the first actual water level data based on the first data interval requires less computation. Furthermore, when the first actual water level data is a prominent outlier relative to the second actual water level data, this application can quickly identify the first actual water level data as abnormal data based on the first data interval.
[0041] Step 105: Based on the first judgment result and the second judgment result, perform anomaly detection on the first actual water level data.
[0042] Optionally, after performing anomaly detection on the first actual water level data, an anomaly detection result for the first actual water level data can be obtained. If both the first and second judgment results indicate that the first actual water level data is normal, the resulting anomaly detection result is that the first actual water level data is normal. If both the first and / or second judgment results indicate that the first actual water level data is abnormal, the resulting anomaly detection result is that the first actual water level data is abnormal.
[0043] Optionally, after performing anomaly detection on the first actual water level data based on the first judgment result and the second judgment result, the method further includes: storing the first actual water level data into the corresponding water level data table according to the anomaly detection result of the first actual water level data.
[0044] If the first actual water level data is normal, it can be stored in the first water level data table, where the water level data is normal. If the first actual water level data is abnormal, it can be stored in the second water level data table, where the water level data is abnormal. If the first actual water level data corresponds to the target event, it can be stored in the third water level data table, where the water level data is pending confirmation and can be confirmed by the user to determine whether the data in this table is abnormal.
[0045] Optionally, the aforementioned water level data table can be pushed to the target database.
[0046] It should be noted that users can modify the data status of water level data in the aforementioned water level data tables. For example, they can change the abnormal status of data in the second water level data table to a normal status, insert this data into the first water level data table, and then delete the data from the second water level data table. Furthermore, after modifying the data status in the aforementioned water level data tables, the corresponding data status in the target database can be modified.
[0047] Optionally, to preserve the original water level data, after acquiring the first actual water level data, the data can be stored in an original water level data table. This table stores the water level data collected by the water level sensor. When the original water level data is needed, the original water level data table can be pushed to the target database.
[0048] It should be noted that, to facilitate unified management of water level data by users, each body of water can have a corresponding original water level data table, a first water level data table, a second water level data table, and a third water level data table. For example, the original water level data table for a river stores water level data obtained by collecting water level data from the river using water level sensors, while the original water level data table for a reservoir stores water level data obtained by collecting water level data from the reservoir using water level sensors.
[0049] Optionally, after anomaly detection of the first actual water level data, normal data can be obtained, and based on the normal data, it can be determined whether the water level is higher than the set upper limit, lower than the set lower limit, or whether the water level fluctuation is greater than the set amplitude; an early warning is issued when the water level is higher than the set upper limit, lower than the set lower limit, or the water level fluctuation is greater than the set amplitude.
[0050] Optionally, users can filter the data they need based on conditions such as water area, time, and data status. Among them, water level data can be presented in the form of a list or a line graph.
[0051] Optionally, the anomaly type can be determined based on existing anomaly data. As an example, and not a limitation, the following anomaly types are included: 1. There are fewer obvious jump points; 2. When there is no significant rainfall and the gate status remains unchanged, the data suddenly changes and remains stable for a period of time, lasting less than 1 hour (step type I). 3. When there is no significant rainfall and the gate status remains unchanged, the data suddenly changes and remains stable for a period of time, lasting for more than 1 hour (step type II). 4. Data fluctuates rapidly in the short term ("shockwave"); 5. The data fluctuates slowly and slightly.
[0052] This application acquires the first actual water level data and predicted water level data at the current moment; determines a first judgment result based on the first actual water level data and predicted water level data; acquires the second actual water level data at historical moments; determines a second judgment result based on the first actual water level data and the second actual water level data; and performs anomaly detection on the first actual water level data based on the first judgment result and the second judgment result. This application can perform anomaly detection on water level data, and it performs anomaly detection on water level data from two dimensions, thereby improving the accuracy of anomaly detection on water level data.
[0053] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0054] Example 2: Please see Figure 2 , Figure 2 The illustration shows a schematic flow of a water level data anomaly detection method provided in this application.
[0055] Step 201: Obtain the first actual water level data and the predicted water level data at the current moment.
[0056] Step 202: Based on the first actual water level data and the predicted water level data, determine the first judgment result.
[0057] Step 203: Obtain the second actual water level data at the historical moment.
[0058] Step 204: Based on the first actual water level data and the second actual water level data, determine the first data interval, which is the interval where the normal data is located.
[0059] The relevant content in steps 201-204 can be found in the relevant descriptions in steps 101-104, and will not be repeated here.
[0060] Step 205: If the first actual water level data is within the first data interval, then based on the first actual water level data and the second actual water level data, determine the second data interval, which is contained within the first data interval.
[0061] Optionally, based on the first and second actual water level data, a second data interval is determined, including: Based on the first and second actual water level data, at least two water level data sequences are obtained, each containing a different number of water level data points. The second expectation and bandwidth of each water level data sequence are calculated, where bandwidth represents the degree of dispersion of the water level data sequence relative to the second expectation. The mean expectation is calculated based on the second expectation of all water level data sequences, and the mean bandwidth is calculated based on the bandwidth of all water level data sequences. The second data interval is determined based on the mean expectation and the mean bandwidth.
[0062] In one optional embodiment, a target water level data sequence can be obtained based on a first actual water level data and a second actual water level data. As an example and not a limitation, the target water level data sequence can also be obtained by sorting the first and second actual water level data in chronological order.
[0063] Optionally, based on the first and second actual water level data, at least two water level data sequences are obtained, including: sequentially selecting the first water level data sequence from the target water level data sequence. From the water level data, a water level data sequence is obtained. ,in, The value range is [1, n], where n is the total number of water level data in the target water level data sequence.
[0064] Optionally, calculating the bandwidth of the water level data sequence includes: calculating the second and fourth central moments of the water level data sequence, and calculating the bandwidth based on the second and fourth central moments. As an example, and not a limitation, the bandwidth can be calculated using the following formula:
[0065] in, For bandwidth, It is the second-order central moment. It is the fourth-order central moment.
[0066] Optionally, after calculating the second expectation and bandwidth for each water level data sequence, n second expectations and n bandwidths can be obtained. The mean expectation is calculated based on the n second expectations, and the mean bandwidth is calculated based on the n bandwidths.
[0067] Optionally, the second data interval determined based on the expected mean and the bandwidth mean can be [M-3B, M+3B], where M is the expected mean and B is the bandwidth mean.
[0068] Step 206: Determine the second judgment result based on the second data interval.
[0069] Optionally, based on the second data interval, a second judgment result is determined, including: if the first actual water level data is within the second data interval, then the second judgment result is determined to be that the first actual water level data is normal data; if the first actual water level data is not within the second data interval, then the second judgment result is determined to be that the first actual water level data is abnormal data.
[0070] When there are many outliers in the target water level data sequence, the upper and lower limits of the calculated first data interval will be pulled toward the outliers, causing many outliers to be misclassified as normal data. Based on this, this application determines the second data interval based on the expected mean and the bandwidth mean, strengthens the weight influence of normal data, avoids the upper and lower limits of the second data interval being pulled toward the outliers, and thus accurately identifies abnormal water level data and improves the accuracy of anomaly detection.
[0071] Step 207: If the first actual water level data is not within the first data range, then the second judgment result is determined to be that the first actual water level data is abnormal data.
[0072] If the first actual water level data is not located within the first data interval, it can be said that the first actual water level data is a relatively prominent outlier. In this case, anomaly detection can be performed on the first actual water level data based on the first data interval.
[0073] This application determines a first data interval based on first and second actual water level data. If the first actual water level data is within the first data interval, a second data interval is determined based on the first and second actual water level data, and a second judgment result is determined based on the second data interval. If the first actual water level data is not within the first data interval, the second judgment result is determined to be that the first actual water level data is abnormal data. This application can preliminarily determine whether the first actual water level data is a prominent outlier based on the first data interval. If the first actual water level data is not a prominent outlier, a second data interval is obtained, and a judgment is made based on the second data interval to determine whether the first actual water level data is abnormal data, thereby improving detection efficiency and detection accuracy.
[0074] Example 3: Please see Figure 3 , Figure 3 The figure shows a schematic structure of a water level data anomaly detection device provided in this application. For ease of explanation, only the parts relevant to the embodiments of this application are shown in the figure.
[0075] Reference Figure 3The device includes a first acquisition module 31, a first judgment module 32, a second acquisition module 33, a second judgment module 34, and an anomaly detection module 35; the specific functions of each module are as follows: The first acquisition module 31 is used to acquire the first actual water level data and the predicted water level data at the current moment; The first judgment module 32 is used to determine a first judgment result based on the first actual water level data and the predicted water level data. The first judgment result is either that the first actual water level data is abnormal data or that the first actual water level data is normal data. The second acquisition module 33 is used to acquire the second actual water level data at historical moments; The second judgment module 34 is used to determine a second judgment result based on the first actual water level data and the second actual water level data. The second judgment result is either that the first actual water level data is abnormal data or that the first actual water level data is normal data. The anomaly detection module 35 is used to perform anomaly detection on the first actual water level data based on the first judgment result and the second judgment result.
[0076] Optionally, the second judgment module 34 is specifically used for: Based on the first actual water level data and the second actual water level data, a first data interval is determined, which is the interval where the normal data is located. If the first actual water level data is within the first data interval, then based on the first actual water level data and the second actual water level data, the second data interval is determined, and the second data interval is contained within the first data interval; Based on the second data interval, determine the second judgment result; If the first actual water level data is not within the first data range, then the second judgment result is determined to be that the first actual water level data is abnormal data.
[0077] Optionally, the second judgment module 34 is specifically used for: Calculate the first expectation and the standard deviation of the first actual water level data and the second actual water level data. The first expectation is the expectation of the first actual water level data and the second actual water level data. The first data interval is determined based on the first expectation and standard deviation.
[0078] Optionally, the second judgment module 34 is specifically used for: If the first actual water level data is within the second data range, then the second judgment result is determined to be that the first actual water level data is normal data; If the first actual water level data is not within the second data range, then the second judgment result is determined to be that the first actual water level data is abnormal data.
[0079] Optionally, the second judgment module 34 is specifically used for: Based on the first and second actual water level data, at least two water level data sequences are obtained, and the number of water level data contained in each water level data sequence is different. Calculate the second expectation and bandwidth for each water level data sequence, where bandwidth represents the degree of dispersion of the water level data sequence relative to the second expectation; The second expectation is calculated based on the total water level data series, and the bandwidth is calculated based on the bandwidth of the total water level data series. The second data interval is determined based on the expected mean and the bandwidth mean.
[0080] Optionally, the device further includes a third determination module, used for: Determine whether the current time is within the target time period, which is the period during which the water level changes due to the target event; The first judgment module 32 is specifically used to determine the first judgment result based on the first actual water level data and the predicted water level data when the current time is not within the target time period.
[0081] Optionally, the device further includes a storage module for: After performing anomaly detection on the first actual water level data based on the first and second judgment results, the first actual water level data is stored in the corresponding water level data table according to the anomaly detection results.
[0082] The water level data anomaly detection device provided in this application embodiment can be applied in the aforementioned method embodiment one and embodiment two. For details, please refer to the description of the aforementioned method embodiment one and embodiment two, which will not be repeated here.
[0083] Example 4: Please see Figure 4 , Figure 4 A schematic structure of a terminal device according to an embodiment of this application is shown. The terminal device 4 of this embodiment includes: at least one processor 40 ( Figure 4 The above describes a method for detecting anomalies in water level data, shown in only one example, a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40. When the processor 40 executes the computer program 42, it implements the steps of the water level data anomaly detection method described in Embodiments 1 and 2.
[0084] The terminal device 4 can be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device 4 may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that... Figure 4This is merely an example of terminal device 4 and does not constitute a limitation on terminal device 4. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, etc.
[0085] The processor 40 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0086] In some embodiments, the memory 41 may be an internal storage unit of the terminal device 4, such as a hard disk or memory of the terminal device 4. In other embodiments, the memory 41 may be an external storage device of the terminal device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the terminal device 4. Furthermore, the memory 41 may include both internal and external storage units of the terminal device 4. The memory 41 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 41 can also be used to temporarily store data that has been output or will be output.
[0087] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0088] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0089] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0090] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a terminal device, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0091] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0092] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0093] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0094] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0095] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for detecting anomalies in water level data, characterized in that, The method includes: Obtain the first actual water level data and the predicted water level data at the current moment; the predicted water level data is obtained through a long short-term memory network model, and the input of the long short-term memory network model is the water level data collected in the first time period before the current moment; Based on the first actual water level data and the predicted water level data, a first judgment result is determined, wherein the first judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. Obtain the second actual water level data at a historical moment; Based on the first actual water level data and the second actual water level data, a second judgment result is determined, wherein the second judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. Based on the first judgment result and the second judgment result, anomaly detection is performed on the first actual water level data; wherein, if the first judgment result indicates that the first actual water level data is normal data, and the second judgment result indicates that the first actual water level data is normal data, the anomaly detection result obtained is that the first actual water level data is normal data; if the first judgment result and / or the second judgment result indicates that the first actual water level data is abnormal data, the anomaly detection result obtained is that the first actual water level data is abnormal data. The determination of the second judgment result based on the first actual water level data and the second actual water level data includes: Based on the first actual water level data and the second actual water level data, a first data interval is determined, which is the interval where normal data is located. If the first actual water level data is within the first data interval, then based on the first actual water level data and the second actual water level data, a second data interval is determined, and the second data interval is contained within the first data interval; Based on the second data interval, the second judgment result is determined; If the first actual water level data is not within the first data range, then the second judgment result is determined to be that the first actual water level data is abnormal data; The step of determining the second data interval based on the first actual water level data and the second actual water level data includes: Based on the first actual water level data and the second actual water level data, at least two water level data sequences are obtained, including: sequentially selecting the first j water level data from the target water level data sequence to obtain a water level data sequence Xj, where the value of j is in the range of [1, n], and n is the total number of water level data in the target water level data sequence; the number of water level data contained in each of the water level data sequences is different; Calculate a second expectation and bandwidth for each of the water level data sequences, where the bandwidth represents the degree of dispersion of the water level data sequence relative to the second expectation; The expected mean is calculated based on the second expectation of all the water level data sequences, and the bandwidth mean is calculated based on the bandwidth of all the water level data sequences. The second data interval is determined based on the expected mean and the bandwidth mean; The calculation of bandwidth for the water level data sequence includes: calculating the second and fourth central moments of the water level data sequence, and calculating the bandwidth based on the second and fourth central moments; specifically, the bandwidth is calculated according to the following formula: Where b is the bandwidth, c2 is the second-order central moment, and c4 is the fourth-order central moment.
2. The method as described in claim 1, characterized in that, The step of determining the first data interval based on the first actual water level data and the second actual water level data includes: Calculate the first expectation and the standard deviation of the first actual water level data and the second actual water level data, where the first expectation is the expectation of the first actual water level data and the second actual water level data; The first data interval is determined based on the first expectation and the standard deviation.
3. The method as described in claim 1, characterized in that, Determining the second judgment result based on the second data interval includes: If the first actual water level data is within the second data range, then the second judgment result is determined to be that the first actual water level data is normal data; If the first actual water level data is not within the second data range, then the second judgment result is determined to be that the first actual water level data is abnormal data.
4. The method as described in claim 1, characterized in that, Before determining the first judgment result based on the first actual water level data and the predicted water level data, the method further includes: Determine whether the current time is within the target time period, where the target time period is the period during which the water level changes due to the target event; The step of determining the first judgment result based on the first actual water level data and the predicted water level data includes: If the current time is not within the target time period, the first judgment result is determined based on the first actual water level data and the predicted water level data.
5. The method according to any one of claims 1-4, characterized in that, After performing anomaly detection on the first actual water level data based on the first judgment result and the second judgment result, the method further includes: Based on the anomaly detection results of the first actual water level data, the first actual water level data is stored in the corresponding water level data table.
6. A water level data anomaly detection device, characterized in that, The device includes: The first acquisition module is used to acquire the first actual water level data and the predicted water level data at the current moment; the predicted water level data is acquired through a long short-term memory network model, and the input of the long short-term memory network model is the water level data collected in the first time period before the current moment; The first judgment module is used to determine a first judgment result based on the first actual water level data and the predicted water level data, wherein the first judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. The second acquisition module is used to acquire the second actual water level data at historical moments. The second judgment module is used to determine a second judgment result based on the first actual water level data and the second actual water level data. The second judgment result is that the first actual water level data is abnormal data or the first actual water level data is normal data. An anomaly detection module is used to perform anomaly detection on the first actual water level data based on the first judgment result and the second judgment result; wherein, when both the first judgment result and the second judgment result indicate that the first actual water level data is normal, the anomaly detection result is that the first actual water level data is normal; when both the first judgment result and / or the second judgment result indicate that the first actual water level data is abnormal, the anomaly detection result is that the first actual water level data is abnormal. The second judgment module is specifically used for: Based on the first actual water level data and the second actual water level data, a first data interval is determined, which is the interval where normal data is located. If the first actual water level data is within the first data interval, then based on the first actual water level data and the second actual water level data, a second data interval is determined, and the second data interval is contained within the first data interval; Based on the second data interval, the second judgment result is determined; If the first actual water level data is not within the first data range, then the second judgment result is determined to be that the first actual water level data is abnormal data; The second judgment module is also specifically used for: Based on the first actual water level data and the second actual water level data, at least two water level data sequences are obtained, including: sequentially selecting the first j water level data from the target water level data sequence to obtain a water level data sequence Xj, where the value of j is in the range of [1, n], and n is the total number of water level data in the target water level data sequence; the number of water level data contained in each of the water level data sequences is different; Calculate a second expectation and bandwidth for each of the water level data sequences, where the bandwidth represents the degree of dispersion of the water level data sequence relative to the second expectation; The expected mean is calculated based on the second expectation of all the water level data sequences, and the bandwidth mean is calculated based on the bandwidth of all the water level data sequences. The second data interval is determined based on the expected mean and the bandwidth mean; The calculation of bandwidth for the water level data sequence includes: calculating the second and fourth central moments of the water level data sequence, and calculating the bandwidth based on the second and fourth central moments; specifically, the bandwidth is calculated according to the following formula: Where b is the bandwidth, c2 is the second-order central moment, and c4 is the fourth-order central moment.
7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method, device and equipment for detecting abnormal data in water level measurement data and medium
CN114298281A
Wind turbine generator wind speed sensing abnormal data identification method based on speed correlation constraint
CN114372047A
Method and device for detecting data exception, storage medium and computer equipment
CN114385869A
