Anomaly detection method and device based on reconstruction model, equipment, medium and product

By introducing a denoising network into the reconstruction network and utilizing downsampling and upsampling structures, the problem of high reconstruction error was solved, and the accuracy of anomaly detection was improved.

CN121388922APending Publication Date: 2026-01-23CHINA MOBILE GROUP SICHUAN +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511480063.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

The reconstruction network suffers from high reconstruction error in anomaly detection, which affects detection sensitivity and accuracy.

Method used

A denoising network is added to the reconstructed network, and the ability to reconstruct detailed features is enhanced by sequentially connected downsampling and upsampling structures.

Benefits of technology

It significantly reduces reconstruction errors during anomaly detection and improves detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121388922A_ABST
    Figure CN121388922A_ABST
Patent Text Reader

Abstract

The invention discloses an anomaly detection method, device and equipment based on a reconstruction model, a medium and a product. The method comprises the steps of obtaining target data to be subjected to anomaly detection; inputting the target data into the reconstruction model, and determining an anomaly detection result according to a reconstruction result output by the reconstruction model; the reconstruction model comprises a reconstruction network and a denoising network which are connected in sequence; the denoising network comprises a down-sampling structure and an up-sampling structure which are connected in sequence, the down-sampling structure comprises down-sampling units which are connected in sequence, and the up-sampling structure comprises up-sampling units which are connected in sequence; the input data of the up-sampling unit is determined based on the output data of the previous unit of the up-sampling unit and the output data of the down-sampling unit matched with the up-sampling unit. According to the scheme, the problem that the reconstruction error is high when the reconstruction network performs anomaly detection is solved, the denoising network is added on the basis of the reconstruction network, the reconstruction error in the anomaly detection process can be greatly reduced, and the anomaly detection accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to an anomaly detection method and device based on a reconstruction model, equipment, medium and product. BACKGROUND

[0002] At present, anomaly detection as a key data analysis technology has penetrated into every corner of the financial field, network security, medical screening and industrial manufacturing. The breakthrough of deep learning has injected new vitality into anomaly detection methods. Among them, the reconstruction network as a typical unsupervised learning method, with its powerful feature extraction and data reconstruction ability, has shown great potential in anomaly detection. The reconstruction network is usually composed of an encoder and a decoder. In the training stage, the encoder is responsible for compressing the input positive samples into low-dimensional bottleneck features, and the decoder tries to recover the original input data from these low-dimensional features, that is, data reconstruction. In the test stage, since the reconstruction network learns the positive samples more fully, the reconstruction error of the positive samples is smaller than that of the negative samples. Therefore, samples with high reconstruction error are considered as negative samples, and samples with low reconstruction error are considered as positive samples.

[0003] The principle of anomaly detection by the reconstruction network is that only positive samples are used in training, and in the test stage, the reconstruction ability of the reconstruction network for positive samples is relatively strong compared with negative samples, so there is a threshold between the reconstruction error of the original sample and the reconstructed sample in theory. Less than the threshold is judged as a positive sample, and greater than the threshold is judged as an abnormal sample. However, the reconstruction result output by the reconstruction network has certain limitations. In the process of changing the original dimension of the sample into low-dimensional bottleneck features and mapping the low-dimensional space back to the high-dimensional space, the reconstruction network extracts the abstract features of the sample to a certain extent, and cannot reconstruct the detailed features of the positive sample, resulting in high reconstruction error of the positive sample, and further affecting the sensitivity and accuracy of anomaly detection. SUMMARY

[0004] The present application provides an anomaly detection method, device, equipment, medium and product based on a reconstruction model, to solve the problem of high reconstruction error when the reconstruction network performs anomaly detection. By adding a denoising network based on the reconstruction network, the reconstruction error in the anomaly detection process can be greatly reduced, and the accuracy of anomaly detection can be improved.

[0005] According to an aspect of the present application, an anomaly detection method based on a reconstruction model is provided, the method comprising:

[0006] Obtaining target data to be subjected to anomaly detection;

[0007] Inputting the target data into a pre-trained reconstruction model, and determining the anomaly detection result of the target data according to the reconstruction result output by the reconstruction model.

[0008] The reconstruction model comprises a reconstruction network and a denoising network connected in sequence; the denoising network comprises a down-sampling structure and an up-sampling structure connected in sequence, the down-sampling structure comprises at least one down-sampling unit connected in sequence, the up-sampling structure comprises at least one up-sampling unit connected in sequence, the number of the down-sampling units is the same as the number of the up-sampling units, each up-sampling unit is matched with a down-sampling unit, and input data of the up-sampling unit is determined based on output data of a previous unit of the up-sampling unit and output data of the down-sampling unit matched with the up-sampling unit.

[0009] According to another aspect of the present application, there is provided an anomaly detection device based on a reconstruction model, comprising:

[0010] a target data acquisition module configured to acquire target data to be subjected to anomaly detection;

[0011] a detection result determination module configured to input the target data into a pre-trained reconstruction model, and determine an anomaly detection result of the target data according to a reconstruction result output by the reconstruction model;

[0012] The reconstruction model comprises a reconstruction network and a denoising network connected in sequence; the denoising network comprises a down-sampling structure and an up-sampling structure connected in sequence, the down-sampling structure comprises at least one down-sampling unit connected in sequence, the up-sampling structure comprises at least one up-sampling unit connected in sequence, the number of the down-sampling units is the same as the number of the up-sampling units, each up-sampling unit is matched with a down-sampling unit, and input data of the up-sampling unit is determined based on output data of a previous unit of the up-sampling unit and output data of the down-sampling unit matched with the up-sampling unit.

[0013] According to another aspect of the present application, there is provided an electronic device, comprising:

[0014] at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the anomaly detection method based on a reconstruction model according to any one of the embodiments of the present application.

[0015] According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for enabling a processor to execute the anomaly detection method based on a reconstruction model according to any one of the embodiments of the present application.

[0016] According to another aspect of the present application, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the reconstruction model based anomaly detection method according to any of the embodiments of the present application.

[0017] The technical solution of the embodiment of the present application obtains target data to be subjected to anomaly detection, inputs the target data into a pre-trained reconstruction model, and determines an anomaly detection result of the target data according to a reconstruction result output by the reconstruction model. The reconstruction model comprises a reconstruction network and a denoising network connected in sequence. The denoising network comprises a down-sampling structure and an up-sampling structure connected in sequence. The down-sampling structure comprises at least one down-sampling unit connected in sequence. The up-sampling structure comprises at least one up-sampling unit connected in sequence. The number of the down-sampling units is the same as the number of the up-sampling units. Each up-sampling unit is matched with a down-sampling unit. The input data of the up-sampling unit is determined based on the output data of a previous unit of the up-sampling unit and the output data of the down-sampling unit matched with the up-sampling unit. The technical solution solves the problem of high reconstruction error when the reconstruction network performs anomaly detection. By adding the denoising network based on the reconstruction network, the reconstruction error in the anomaly detection process can be greatly reduced, and the accuracy of anomaly detection is improved.

[0018] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0020] Figure 1 is a flowchart of a reconstruction model based anomaly detection method according to embodiment one of the present application;

[0021] Figure 2 is a flowchart of a reconstruction model based anomaly detection method according to embodiment two of the present application;

[0022] Figure 3 is a structural schematic diagram of a denoising network according to embodiment two of the present application;

[0023] Figure 4 is a structural schematic diagram of a reconstruction model based anomaly detection device according to embodiment three of the present application;

[0024] Figure 5 FIG. 1 is a structural schematic diagram of an electronic device implementing a reconstruction model-based anomaly detection method according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to make the technical personnel in the art better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0026] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices. The acquisition, storage, use, processing and the like of data in the technical solutions of the present application comply with the relevant provisions of national laws and regulations.

[0027] Embodiment one

[0028] Figure 1 A flowchart of a reconstruction model-based anomaly detection method is provided for the first embodiment of the present application. The present embodiment can be applied to scenarios such as anomaly detection of text, image and sound data, and especially to the case of anomaly detection based on reconstruction network. The method can be performed by a reconstruction model-based anomaly detection device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device. As shown in the figure, the method comprises: Figure 1

[0029] S110, obtaining target data to be subjected to anomaly detection.

[0030] The present scheme can be executed by a computer, a server or other electronic device. The electronic device can obtain target data to be subjected to anomaly detection. The target data can be text, image, audio and video data, and the target data can be determined according to the specific application scenario of anomaly detection. ​

[0031] In S120, the target data is input to a pre-trained reconstruction model, and an anomaly detection result of the target data is determined according to a reconstruction result output by the reconstruction model; the reconstruction model includes a reconstruction network and a denoising network connected in sequence; the denoising network includes a down-sampling structure and an up-sampling structure connected in sequence, the down-sampling structure includes at least one down-sampling unit connected in sequence, the up-sampling structure includes at least one up-sampling unit connected in sequence, the number of the down-sampling units is the same as the number of the up-sampling units, each up-sampling unit is matched with a down-sampling unit, and input data of the up-sampling unit is determined based on output data of a previous unit of the up-sampling unit and output data of the down-sampling unit matched with the up-sampling unit.

[0032] The electronic device can pre-train a reconstruction model for reconstructing target data and output a reconstruction result of the target data. The reconstruction model can include two parts of a reconstruction network and a denoising network, where the reconstruction network can be a network structure constructed based on algorithms such as an autoencoder (AE), a variational autoencoder (VAE), and a generative adversarial network (GAN). The reconstruction network includes an encoder and a decoder connected in sequence, the encoder is responsible for compressing the target data into low-dimensional features, and the decoder reconstructs the input data from the low-dimensional features to output a first reconstruction result of the target data.

[0033] Since the reconstruction network is difficult to reconstruct the detailed features of the target data in the data reconstruction process, the reconstruction error is too large, causing misjudgment of the anomaly. In order to ensure the accuracy and reliability of the reconstruction result, the electronic device can take the first reconstruction result output by the reconstruction network as a reconstruction result with "noise". The denoising network is sequentially connected after the reconstruction network, and is used for "denoising" processing of the first reconstruction result, so as to improve the accuracy of the reconstruction result of the target data.

[0034] Specifically, the denoising network comprises sequentially connected down-sampling structure and up-sampling structure. The down-sampling structure is used for feature extraction on the first reconstruction result, and reduces the data dimension of the first reconstruction result. The up-sampling structure is used for data reconstruction based on the features extracted from the first reconstruction result, to obtain the second reconstruction result with the same target data dimension. The second reconstruction result can be used as the reconstruction result output by the reconstruction model. The down-sampling structure can comprise one or more sequentially connected down-sampling units, and the up-sampling structure can comprise one or more sequentially connected up-sampling units. The number of down-sampling units in the down-sampling structure is the same as the number of up-sampling units in the up-sampling structure. Each up-sampling unit in the down-sampling structure is matched with a down-sampling unit in the up-sampling structure. The input data of each up-sampling unit is determined based on the output data of the previous unit of the up-sampling unit and the output data of the down-sampling unit matched with the up-sampling unit, that is, the down-sampling units in the down-sampling structure are jump-connected with the up-sampling units in the up-sampling structure. The jump connection can reduce feature loss and enhance the reconstruction ability of the reconstruction model for detailed features.

[0035] According to the reconstruction result output by the reconstruction model, the electronic device can determine whether the target data is abnormal. It can be understood that if the error between the reconstruction result output by the reconstruction model and the target data is within the preset error range, the target data is not abnormal, and if the error between the reconstruction result output by the reconstruction model and the target data is not within the preset error range, the target data is abnormal. The abnormality can be a text error, an image defect, or other abnormal conditions.

[0036] The technical scheme of the embodiment of the application acquires target data to be detected for abnormality, inputs the target data into a pre-trained reconstruction model, and determines an abnormality detection result of the target data according to a reconstruction result output by the reconstruction model. The reconstruction model comprises a reconstruction network and a denoising network connected in sequence. The denoising network comprises sequentially connected down-sampling structure and up-sampling structure. The down-sampling structure comprises at least one sequentially connected down-sampling unit, and the up-sampling structure comprises at least one sequentially connected up-sampling unit. The number of down-sampling units is the same as the number of up-sampling units. Each up-sampling unit is matched with a down-sampling unit. The input data of the up-sampling unit is determined based on the output data of the previous unit of the up-sampling unit and the output data of the down-sampling unit matched with the up-sampling unit. The technical scheme solves the problem of high reconstruction error when the reconstruction network is used for abnormality detection. By adding the denoising network based on the reconstruction network, the reconstruction error in the abnormality detection process can be greatly reduced, and the accuracy of abnormality detection can be improved.

[0037] Embodiment two

[0038] Figure 2A flowchart of an anomaly detection method based on a reconstruction model is provided for Embodiment Two of the present application. The training process of the reconstruction model is refined based on the above-mentioned embodiment. As shown in FIG. 8, the method comprises the following steps. Figure 2

[0039] In S201, a preset number of training samples are obtained; the training samples are positive samples.

[0040] Before training the reconstruction model, the electronic device can obtain a preset number of training samples for training the reconstruction model, and the training samples are positive samples, i.e., sample data without anomalies. For example, the anomaly detection task is specifically a defect detection task for images, and the training samples are all images without defects. The electronic device can randomly assign weight parameters in the reconstruction model according to a preset initialization manner.

[0041] In S202, each training sample is sequentially input into the reconstruction network to obtain a first reconstruction result of each training sample.

[0042] The electronic device can sequentially input each training sample into the reconstruction network, and the reconstruction network can output a first reconstruction structure of each training sample.

[0043] In S203, the first reconstruction result of each training sample is input into the denoising network to obtain a second reconstruction result; the denoising network comprises sequentially connected down-sampling structures and up-sampling structures, the down-sampling structure comprises at least one sequentially connected down-sampling unit, the up-sampling structure comprises at least one sequentially connected up-sampling unit, the number of the down-sampling units is the same as the number of the up-sampling units; each up-sampling unit is matched with a down-sampling unit; the input data of the up-sampling unit is determined based on the output data of the previous unit of the up-sampling unit and the output data of the down-sampling unit matched with the up-sampling unit.

[0044] After obtaining the first reconstruction result of each training sample, the electronic device can sequentially input the first reconstruction result of each training sample into the denoising network in the reconstruction model, and the denoising network can output a second reconstruction result of each training sample. The first reconstruction result and the second reconstruction result have the same data dimension as each training sample.

[0045] In one specific example, the down-sampling unit comprises sequentially connected convolution layers, first activation layers and pooling layers; the up-sampling unit comprises sequentially connected de-pooling layers, de-convolution layers and second activation layers; the first activation layer performs an activation operation on the features output by the convolution layer based on a nonlinear activation function; and the second activation layer performs an activation operation on the features output by the de-convolution layer based on a nonlinear activation function.

[0046] Figure 3 ​is a structural schematic diagram of a denoising network provided according to Embodiment Two of the present application, as shown in Figure 3 The structure shown by the thin dashed line in the denoising network is a down-sampling structure, which includes n down-sampling units, and the structure shown by the thick dashed line is an up-sampling structure, which includes n up-sampling units. The i th down-sampling unit in the down-sampling structure is matched with the n-i th up-sampling unit in the up-sampling structure. The down-sampling unit includes a convolution layer, a first activation layer and a pooling layer connected in sequence, and the up-sampling unit includes an inverse pooling layer, an inverse convolution layer and a second activation layer connected in sequence.

[0047] It can be understood that, when performing convolution operation, the size of the convolution kernel, the convolution step and the padding step number and other parameters of the convolution layer can be determined based on the dimension of the target data, and the inverse convolution layer can be matched with the convolution layer. The pooling layer can perform pooling operation on the features output by the activation layer in a manner of maximum pooling, average pooling or the like, and the inverse convolution layer can be matched with the pooling layer. The nonlinear activation function can include Sigmoid, Tanh, ReLU, LReLU, ELU and GeLu activation functions. Using the nonlinear activation function for activation operation is conducive to enhancing the expression ability and generalization ability of the reconstruction model.

[0048] S204, according to each training sample, the first reconstruction result of each training sample and the second reconstruction result of each training sample, a model loss is calculated according to a preset loss function.

[0049] It can be easily understood that the electronic device inputs each training sample into the reconstruction model to obtain two reconstruction results of each training sample, i.e., the first reconstruction result and the second reconstruction result. Among them, the first reconstruction result is the reconstruction result before "denoising", and the second reconstruction result is the reconstruction result after "denoising". The electronic device can compare the first reconstruction result and the second reconstruction result of each training sample with each training sample, and calculate the reconstruction error before "denoising" and the reconstruction error after "denoising", respectively. According to the reconstruction error before "denoising" and the reconstruction error after "denoising", the model loss is calculated to update the weight parameters in the reconstruction model as a whole, so that the reconstruction model evolves in the direction of smaller reconstruction error in the iterative training process. The preset loss function can include the first reconstruction error and the second reconstruction error, the first reconstruction error can be the reconstruction error determined based on the first reconstruction result of each training sample and each training sample, and the second reconstruction error can be the reconstruction error determined based on the second reconstruction result of each training sample and each training sample.

[0050] In this scheme, the expression of the preset loss function is:

[0051] ;

[0052] Among them, , denotes a training sample, denotes a first reconstruction result of the training sample, denotes a second reconstruction sample of the training sample, denotes an information divergence of the training sample and the second reconstruction result, and denote weight coefficients of and respectively.

[0053] It can be understood that is an asymmetric measure of the training sample and the second reconstruction result, used to represent the relative entropy of the training sample and the second reconstruction result. and are weight coefficients of and respectively, The value range of The value range of The value range of The electronic device can set the sizes of and according to the abnormal detection scene.

[0054] The loss function of the scheme not only considers the error of the first reconstruction result and the training sample and the error of the second reconstruction result and the training sample, but also considers the information divergence of the training sample and the second reconstruction result. The second reconstruction result can be made closer to the distribution of the training sample in the reconstruction model training process, thereby enhancing the stability and consistency of the data reconstruction process.

[0055] S205, according to the model loss, at least once training of the reconstruction model until the reconstruction model meets a preset evaluation condition, outputting the reconstruction model.

[0056] ​​​​​​​​​The electronic device can update the weight parameters in the reconstruction model according to the model loss of the current iteration, and complete one training of the reconstruction model. Meanwhile, the electronic device can determine whether the reconstruction model of the current iteration meets the preset evaluation condition. The electronic device can test the reconstruction model obtained in the current iteration when each iteration training is completed, and determine whether the evaluation indexes such as the test loss and the test accuracy of the reconstruction model obtained in the current iteration meet the preset evaluation condition. If the preset evaluation condition is met, the training of the reconstruction model is stopped, and the reconstruction model obtained in the current iteration is output. If the preset evaluation condition is not met, the electronic device can update the weight parameters of the reconstruction model according to the model loss of the current iteration, and continue to train the reconstruction model until the evaluation indexes meet the preset evaluation condition.

[0057] Optionally, the preset evaluation condition includes that the number of iterations reaches a preset number of times and / or the model loss of the current iteration is less than a preset loss threshold.

[0058] The electronic device can set the maximum number of iterations before starting the training of the reconstruction model, and record the number of iteration training during the training of the reconstruction model. When the number of iteration training reaches the maximum number of iterations, the training of the reconstruction model is stopped, and the reconstruction model obtained in the last iteration is output. The electronic device can also set the loss threshold before starting the training of the reconstruction model, and record the model loss of each iteration training during the training of the reconstruction model. When the model loss of the current iteration is less than the preset loss threshold, the training of the reconstruction model is stopped, and the reconstruction model obtained in the current iteration is output.

[0059] The preset evaluation condition can include both that the number of iterations reaches a preset number of times and that the model loss of the current iteration is less than a preset loss threshold. The electronic device can set the loss threshold before starting the training of the reconstruction model, and record the model loss of each iteration training during the training of the reconstruction model. When the model loss of the current iteration is less than the preset loss threshold, and the current iteration is the maximum number of iterations, the training of the reconstruction model is stopped, and the reconstruction model obtained in the current iteration is output.

[0060] S206, obtaining target data to be subjected to anomaly detection.

[0061] S207, inputting the target data into a pre-trained reconstruction model, and calculating a reconstruction error between a reconstruction result output by the reconstruction model and the target data.

[0062] The target data is input into the trained reconstruction model, and the reconstruction model can output a reconstruction result of the target data. The electronic device can calculate a reconstruction error between the reconstruction result output by the reconstruction model and the target data, and compare the reconstruction error with a preset error threshold.

[0063] S208, determining whether the reconstruction error is greater than or equal to the preset error threshold.

[0064] If the reconstruction error is greater than or equal to the preset error threshold, S209 is performed, and if the reconstruction error is less than the preset error threshold, S210 is performed.

[0065] S209, determining that the target data is abnormal.

[0066] S210, determining that the target data is not abnormal.

[0067] The scheme solves the problem of high reconstruction error when the reconstruction network performs anomaly detection, and by adding a denoising network based on the reconstruction network, the reconstruction ability of the reconstruction model for positive samples is increased, and the gap between positive samples and negative samples is further widened, which is conducive to improving the accuracy of anomaly detection of the target data and reducing the false detection of positive samples and the missed detection of negative samples.

[0068] Embodiment three

[0069] Figure 4 A structural schematic diagram of an anomaly detection device based on a reconstruction model provided for the third embodiment of the application is shown in FIG. 3. Figure 4 As shown in the figure, the device comprises:

[0070] A target data acquisition module 310 is configured to acquire target data to be subjected to anomaly detection.

[0071] A detection result determination module 320 is configured to input the target data into a pre-trained reconstruction model, and determine an anomaly detection result of the target data according to a reconstruction result output by the reconstruction model.

[0072] The reconstruction model comprises a reconstruction network and a denoising network connected in sequence; the denoising network comprises a down-sampling structure and an up-sampling structure connected in sequence, the down-sampling structure comprises at least one down-sampling unit connected in sequence, the up-sampling structure comprises at least one up-sampling unit connected in sequence, the number of the down-sampling units is the same as the number of the up-sampling units; each up-sampling unit is matched with a down-sampling unit; the input data of the up-sampling unit is determined based on the output data of a previous unit of the up-sampling unit and the output data of the down-sampling unit matched with the up-sampling unit.

[0073] In the scheme, the device further comprises a model training module configured to:

[0074] acquire a preset number of training samples; the training samples are positive samples;

[0075] input each training sample into the reconstruction network in sequence to obtain a first reconstruction result of each training sample;

[0076] input the first reconstruction result of each training sample to the denoising network to obtain a second reconstruction result;

[0077] According to each training sample, the first reconstruction result of each training sample, and the second reconstruction result of each training sample, a model loss is calculated according to a preset loss function;

[0078] The reconstruction model is trained at least once according to the model loss until the reconstruction model meets a preset evaluation condition, and the reconstruction model is output.

[0079] On the basis of the foregoing scheme, an expression of the preset loss function is:

[0080] ;

[0081] Among them, , , , denotes a training sample, denotes a first reconstruction result of a training sample, denotes a second reconstruction result of a training sample, denotes an information divergence of a training sample and a second reconstruction result, 、 and respectively denote weight coefficients of 、 and .

[0082] On the basis of the foregoing scheme, the preset evaluation condition includes that an iteration number reaches a preset number and / or a model loss of this iteration is less than a preset loss threshold.

[0083] In one feasible scheme, the detection result determination module 320 is specifically configured to:

[0084] calculate a reconstruction error between a reconstruction result output by the reconstruction model and the target data;

[0085] if the reconstruction error is greater than or equal to a preset error threshold, it is determined that the target data is abnormal;

[0086] if the reconstruction error is less than the preset error threshold, it is determined that the target data is not abnormal.

[0087] In a preferred scheme, the down-sampling unit comprises a convolution layer, a first activation layer and a pooling layer connected in sequence; the up-sampling unit comprises an anti-pooling layer, a de-convolution layer and a second activation layer connected in sequence; the first activation layer performs an activation operation on the features output by the convolution layer based on a nonlinear activation function; and the second activation layer performs an activation operation on the features output by the de-convolution layer based on a nonlinear activation function.

[0088] The abnormality detection device based on a reconstruction model provided in the embodiments of the present application can perform the abnormality detection method based on a reconstruction model provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of performing the method.

[0089] Embodiment Four

[0090] Figure 5 A structural diagram of a water and fertilizer application device 410 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices (e.g., headgear, eyewear, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application described and / or claimed in this document.

[0091] As shown in Figure 5 The electronic device 410 includes at least one processor 411 and a memory that is communicatively connected to the at least one processor 411, which can be a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., where the memory stores a computer program that can be executed by the at least one processor. The processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or loaded from the storage unit 418 into the random access memory (RAM) 413. In the RAM 413, various programs and data required for operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other through a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0092] A plurality of components in the electronic device 410 are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a magnetic disk, an optical disk, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0093] The processor 411 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 411 performs various methods and processes described above, such as the reconstruction model based anomaly detection method.

[0094] In some embodiments, the reconstruction model based anomaly detection method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded onto the RAM 413 and executed by the processor 411, one or more steps of the reconstruction model based anomaly detection method described above can be performed. Alternatively, in other embodiments, the processor 411 can be configured to perform the reconstruction model based anomaly detection method by any other appropriate means, such as by means of firmware.

[0095] The various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, specially designed application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0096] Computer programs for implementing the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be implemented on general purpose computers, special purpose computers, or other programmable apparatuses to produce the functions / acts specified in the flow diagrams and / or block diagrams. These computer programs can execute entirely on a machine, partly on a machine, as a stand-alone software package, partly on a machine and partly on a remote machine or entirely on a remote machine or server.

[0097] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, 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), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0098] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0099] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0100] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0101] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in series, or executed in different orders, as long as the desired results of the technical solutions of the present disclosure can be achieved, and the present disclosure is not limited herein.

[0102] The specific implementation described above does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method of anomaly detection based on a reconstructed model, characterized in that, The method comprises: acquiring target data to be subjected to anomaly detection; inputting the target data into a pre-trained reconstruction model, and determining an anomaly detection result of the target data according to a reconstruction result output by the reconstruction model; wherein the reconstruction model comprises a reconstruction network and a denoising network connected in sequence; the denoising network comprises a down-sampling structure and an up-sampling structure connected in sequence, the down-sampling structure comprises at least one down-sampling unit connected in sequence, the up-sampling structure comprises at least one up-sampling unit connected in sequence, the number of the down-sampling units is the same as the number of the up-sampling units; each up-sampling unit is matched with a down-sampling unit; input data of the up-sampling unit is determined based on output data of a previous unit of the up-sampling unit and output data of the down-sampling unit matched with the up-sampling unit.

2. The method of claim 1, wherein, The training process of the reconstruction model is as follows: acquiring a preset number of training samples; the training samples are positive samples; inputting each training sample into the reconstruction network in sequence to obtain a first reconstruction result of each training sample; inputting the first reconstruction result of each training sample into the denoising network to obtain a second reconstruction result; calculating a model loss according to each training sample, the first reconstruction result of each training sample and the second reconstruction result of each training sample according to a preset loss function; training the reconstruction model at least once according to the model loss until the reconstruction model meets a preset evaluation condition, and outputting the reconstruction model.

3. The method of claim 2, wherein, The expression of the preset loss function is as follows: ; wherein, , , , denotes a training sample, denotes a first reconstruction result of the training sample, denotes a second reconstruction result of the training sample, denotes an information divergence of the training sample and the second reconstruction result, , and denote weight coefficients of , and , respectively.

4. The method of claim 2, wherein, The preset evaluation condition comprises that the number of iterations reaches a preset number and / or the model loss of the current iteration is less than a preset loss threshold.

5. The method of claim 1, wherein, The determination of the anomaly detection result of the target data according to the reconstruction result output by the reconstruction model comprises: calculating a reconstruction error between the reconstruction result output by the reconstruction model and the target data; if the reconstruction error is greater than or equal to a preset error threshold, determining that the target data is abnormal; if the reconstruction error is less than the preset error threshold, determining that the target data is not abnormal.

6. The method of claim 1, wherein, The down-sampling unit comprises a convolution layer, a first activation layer and a pooling layer connected in sequence; the up-sampling unit comprises an inverse pooling layer, an inverse convolution layer and a second activation layer connected in sequence; the first activation layer performs an activation operation on features output by the convolution layer based on a nonlinear activation function; the second activation layer performs an activation operation on features output by the inverse convolution layer based on a nonlinear activation function.

7. An anomaly detection apparatus based on a reconstruction model, characterized by, The device comprises: a target data acquisition module configured to acquire target data to be subjected to anomaly detection; a detection result determination module configured to input the target data into a pre-trained reconstruction model, and determine an anomaly detection result of the target data according to a reconstruction result output by the reconstruction model. The reconstruction model comprises a reconstruction network and a denoising network connected in sequence; the denoising network comprises a down-sampling structure and an up-sampling structure connected in sequence, the down-sampling structure comprises at least one down-sampling unit connected in sequence, the up-sampling structure comprises at least one up-sampling unit connected in sequence, the number of the down-sampling units is the same as the number of the up-sampling units; each up-sampling unit is matched with a down-sampling unit; input data of the up-sampling unit is determined based on output data of a previous unit of the up-sampling unit and output data of the down-sampling unit matched with the up-sampling unit.

8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the reconstruction model-based anomaly detection method in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to implement the reconstruction model-based anomaly detection method in any one of claims 1-6 when executed.

10. A computer program product comprising a computer program which, when executed by a processor, implements the reconstruction model-based anomaly detection method according to any one of claims 1-6.