Heterogeneous detection method and device based on generative adversarial network, equipment and medium
By generating virtual image data using generative adversarial networks and then using discriminative networks for discrimination, the problem of anomaly detection under passive data conditions is solved, and new anomaly detection is achieved while protecting user data privacy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2023-06-16
- Publication Date
- 2026-05-08
AI Technical Summary
In the absence of source data, how can we effectively detect anomalous data in target samples, especially in medical image detection? Existing methods require access to private data and cannot achieve novel outlier detection.
Virtual image data is generated using a generative adversarial network, and the virtual image data is then identified by a discriminant network. A preset threshold and a decision function are used to determine whether the image data to be detected is abnormal, thus protecting user data privacy.
Without using the user's medical images, it can accurately determine whether a medical image belongs to a new category, protect user data privacy, and realize the detection of new anomalies in the disease diagnosis process.
Smart Images

Figure CN116721330B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and medium for detecting outliers based on generative adversarial networks. Background Technology
[0002] In the medical field, due to the diversity of image categories, to quickly detect the category of medical images, medical images are generally used as training data to train an image category detection model. This trained model is then used to perform medical image detection and classification tasks. However, when the target medical image belongs to a new category, the trained model cannot detect its category. Therefore, it is necessary to first determine whether the target image belongs to a known category in the model. This requires performing an outlier detection task on the target image, which determines whether a target sample belongs to a known or unknown category. If the target sample does not belong to any known category, it is considered an outlier. Common outlier detection methods generally include probability-based and distance-based methods. However, both probability-based and distance-based methods require access to source data, which is often private and unavailable. Therefore, how to detect anomalous data in target samples without source data becomes a pressing problem. Summary of the Invention
[0003] Therefore, it is necessary to provide an anomaly detection method, apparatus, device, and medium based on generative adversarial networks to address the above-mentioned technical problems, in order to solve the problem of how to detect abnormal data in target samples in the absence of passive data.
[0004] The first aspect of this application provides an outlier detection method based on generative adversarial networks, the outlier detection method comprising:
[0005] A generative network is used to generate virtual image data corresponding to the image data to be detected.
[0006] A discrimination network trained based on known categories and sample data is obtained, and the virtual image data is discriminated through the discrimination network to obtain a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data.
[0007] Using a preset judgment function, a judgment score is calculated between the image data to be detected and the source data. When the judgment score is greater than a second preset threshold, the image data to be detected is determined to be abnormal data.
[0008] A second aspect of this application provides an outlier detection device based on a generative adversarial network, the outlier detection device comprising:
[0009] The generation module is used to generate virtual image data corresponding to the image data to be detected using a generation network.
[0010] The discrimination module is used to obtain a discrimination network trained based on known categories and sample data, and to discriminate the virtual image data through the discrimination network to obtain a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data.
[0011] The abnormal data determination module is used to calculate the determination score between the image data to be detected and the source data using a preset determination function. When the determination score is greater than a second preset threshold, the image data to be detected is determined to be abnormal data.
[0012] Thirdly, embodiments of the present invention provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the outlier detection method as described in the first aspect.
[0013] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the anomaly detection method as described in the first aspect.
[0014] The advantages of this invention compared to the prior art are:
[0015] A generative network is used to generate virtual image data corresponding to the image data to be detected. A discriminative network trained based on known categories and sample data is then used to discriminate the virtual image data, obtaining a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data. A preset judgment function is used to calculate the judgment score between the image data to be detected and the source data. When the judgment score is greater than a second preset threshold, the image data to be detected is determined as abnormal data. In this invention, virtual data is generated by a generative network, and the virtual data is discriminated by a discriminative network. The source data is determined from the virtual data, and the distance between the source data and the data to be detected is used to determine whether the data to be detected is abnormal. This allows for the detection of abnormal data even without source data, solving the problem of lack of source data in the abnormal data detection process and protecting the privacy of user data. In the process of disease diagnosis, the disease category is generally determined based on the category of the captured medical images. When it is necessary to determine whether the category of the medical image is a new category, the method of this application can be used to detect new and different categories of user medical images without using a large number of user medical images. It can determine whether the medical image is a new category image while protecting user data privacy, thereby determining whether the user belongs to a new disease category. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of an application environment for an outlier detection method based on generative adversarial networks provided in an embodiment of the present invention;
[0018] Figure 2 This is a flowchart illustrating an outlier detection method based on generative adversarial networks according to an embodiment of the present invention.
[0019] Figure 3 This is a schematic diagram of the structure of an outlier detection device based on a generative adversarial network according to an embodiment of the present invention;
[0020] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] It should be understood that, when used in this 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 collections thereof.
[0023] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0024] As used in this 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 [described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0025] Furthermore, in the description of this invention 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.
[0026] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention 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.
[0027] The embodiments of this invention can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0028] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0029] It should be understood that the sequence number of each step in the following 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 the present invention.
[0030] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0031] An embodiment of the present invention provides an outlier detection method based on generative adversarial networks, which can be applied to, for example... Figure 1 In this application environment, the client communicates with the server. Clients include, but are not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). The server can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0032] See Figure 2 This is a flowchart illustrating an outlier detection method based on generative adversarial networks (GANs) according to an embodiment of the present invention. The aforementioned outlier detection method based on GANs can be applied to... Figure 1 The server in the above-mentioned configuration connects to the corresponding client, such as... Figure 2 As shown, the outlier detection method based on generative adversarial networks may include the following steps.
[0033] S201: Use a generative network to generate virtual image data corresponding to the image data to be detected.
[0034] In step S201, the generation network generates virtual image data corresponding to the image data to be detected. During the image generation process, the attribute editing parameters are used to perform attribute editing operations, so that the virtual image data generated by the image generation network carries the attributes corresponding to the attribute editing parameters.
[0035] In this embodiment, multiple ultrasound images are acquired based on ultrasound videos of the tested tissues. Multiple frames are extracted from the dynamic ultrasound videos to form ultrasound images, which are then used as the image data to be detected. The tested tissues include breast and thyroid glands. For the image data to be detected, a generative network is used to generate virtual image data corresponding to the image data. The generative network can employ a general image generation model, such as a GAN (Generative Adversarial Network) model, specifically a pre-trained model of StyleGAN, StyleGAN2, or ProgressGAN, etc.
[0036] Optionally, a generative network is used to generate virtual image data corresponding to the image data to be detected, including:
[0037] Extract feature data from the image data to be detected;
[0038] The random noise data is acquired, and the network generates virtual image data corresponding to the image data to be detected based on the feature data and the random noise data.
[0039] It should be noted that when using a generative network to generate virtual image data corresponding to the image data to be detected, the generative network is first trained to extract the feature data of the image data to be detected. The image data to be detected is used as a vector for the image generated by the generative network, for example, a vector that conforms to a uniform distribution, a normal distribution, or a standard normal distribution. Vectors represent data in numerical form. The feature data of the image data to be detected is a vector obtained by feature extraction from the image data to be detected, used to describe the features of the image data to be detected.
[0040] The generator network maps the detected image data used to generate virtual image data into a hidden coding vector, including: initializing the hidden vector space; randomly sampling the hidden vectors in the hidden vector space to obtain the original hidden vectors used to generate the image; inputting the original hidden vectors into the feature mapping network in the generator network; and mapping the original hidden vectors into a hidden coding vector through the feature mapping network.
[0041] Here, the latent vector space is the vector space containing the image data to be detected. Random sampling is performed from the latent vector space to obtain the original latent vectors used to generate the image, and these original latent vectors are used as the image data to be detected. The original latent vectors are then input into the feature mapping network in the generator network, where they are mapped into latent coding vectors.
[0042] It should be noted that the generative network can include a feature mapping network and a feature synthesis network. The generative network generates virtual image data, the feature mapping network maps the image data to be detected into a hidden coding vector, and the feature synthesis network outputs the virtual image data corresponding to the hidden coding vector.
[0043] When a generative network needs to generate multiple categories of image attributes, attribute editing operations can be performed on the implicitly encoded vectors in the implicitly encoded vector space, which is the vector space where the implicitly encoded vectors reside. Based on the current attribute editing parameters, the implicitly encoded vectors are transformed towards the target attribute, where the target attribute is the attribute corresponding to the image data to be detected. After obtaining the target implicitly encoded vector carrying the target attribute, the generative network generates virtual image data corresponding to the target implicitly encoded vector.
[0044] Among them, the attribute editing parameter is used to perform attribute editing operations on the hidden coding vector. The image data to be detected is mapped to the hidden coding vector through the feature mapping network. The attribute editing parameter is used to perform attribute editing operations on the hidden coding vector in the hidden coding vector space to obtain the target hidden coding vector carrying the target attribute. After the target hidden coding vector is input into the feature synthesis network in the generation network, the feature synthesis network outputs the virtual image data corresponding to the target hidden coding vector.
[0045] It should be noted that when training the generative network, training sample data is first obtained from the image data to be detected. The image data corresponding to the training sample data is then preprocessed. Due to the influence of different camera equipment, imaging conditions, and the skill level of the data acquisition personnel, the acquired images often have varying image resolutions, brightness, and contrast. These diverse image parameters can often interfere with the standardized generative network. The image scale can be roughly normalized by estimating the field of view size in the image. Then, a Gaussian filter is used to estimate the background brightness of the image, and background subtraction is used to achieve overall image brightness equalization and contrast enhancement. To ensure that all images have consistent dimensions, the extracted images need to be padded around their edges. Normalizing the image aspect ratio helps to better preserve the geometric structure information in the original image and prevents distortion that could lead to loss of information about the fundus structure.
[0046] It should be noted that, by acquiring random noise data, the generation network generates virtual image data corresponding to the image data to be detected based on the feature data and the random noise data. Random noise, also known as background noise, is caused by the accumulation of a large number of fluctuations and disturbances that are randomly generated over time. Its value cannot be predicted within a given instant. Random noise data is used to enrich the detailed feature information of the generated image.
[0047] It should be noted that, in this embodiment, the type of noise to be added can be determined according to the category of the image data to be detected, so that the added noise is more consistent with the generation rules of the generative network. For example, when the image data to be detected is a face image, considering that the noise of a large number of face images in real-world scenes conforms to or approximately conforms to a Gaussian distribution, the added noise can be Gaussian noise, thus making the added noise more reasonable.
[0048] S202: Obtain the discrimination network trained based on known categories and sample data, use the discrimination network to discriminate virtual image data, and obtain the discrimination result. When the discrimination result is greater than the first preset threshold, determine the virtual image data corresponding to the discrimination result as the source data.
[0049] In step S202, a discriminant network trained based on known categories and sample data is obtained. The discriminant network can discriminate the virtual image data generated by the generator network and determine whether it is the same as the known category. If the virtual image data obtains a category similarity with the discriminant network, the category similarity is used as the discrimination result of the discriminant network. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data. Here, the discrimination result is the discriminant category and the corresponding discrimination value output by the discriminant network, and the source data is the real data for the image to be detected.
[0050] In this embodiment, an initial discriminant network is trained using sample data and its corresponding category labels to obtain a corresponding discriminant network. The purpose of this discriminant network is to distinguish between the virtual image data generated by the generator network and the sample data, i.e., the set real image. That is, the discriminant network has two inputs: virtual image data and sample data. By inputting the virtual image data generated by the generator network and the sample data into the initial discriminant network for discrimination processing, an image discrimination value is obtained. The purpose of this discriminant network is to distinguish between the virtual image data generated by the generator network and the sample data, i.e., the set real image.
[0051] The discriminative network comprises multiple encoders. Unlike the generator network, which outputs an image, the discriminative network outputs a single value—the discriminant value of the virtual image data. This discriminant value represents the degree of realism between the virtual image data and the sample data. In other words, the discriminative network in this embodiment corresponds to the generated virtual image data and sample data of known categories. Its purpose is to determine the realism of the generated virtual image data, thereby better guiding the generator network to generate more ideal virtual image data. It should be noted that each virtual image data corresponds to an image discriminant value; the larger the image discriminant value, the better the generated virtual image data and the more realistic the image. For example, the numerical range of the image discriminant value is [0,1].
[0052] In this embodiment, the discriminant network employs five convolutional layers with output channels of 32, 64, 64, 32, and 16, respectively. Each convolutional layer uses a 3×3 convolutional kernel to extract features from the image. As the number of channels decreases, the convolutional network fuses and filters the extracted features. Each convolutional layer includes batch normalization and ReLU activation functions to ensure the network's nonlinearity and fitting ability. A downsampling layer is connected after each convolutional layer to filter the acquired features. The output neurons obtained after convolution, batch normalization, and activation function operations are sparse, with many neurons having zero values. Therefore, maximum value downsampling with a stride of 2 is performed, retaining the maximum value among adjacent 2×2 neurons as the output. The number of output neurons becomes one-quarter of the input, thus reducing the dimensionality of the image features. At the output of the five convolutional layers and the downsampling layer, a fully connected layer is added to weight the dimensionality-reduced image features. The fully connected layer uses sigmoid as the activation function. The output of the fully connected layer is a value between 0 and 1, representing the probability that the input image is a real image, which is used to measure the similarity between virtual image data and sample data of known categories.
[0053] For the discriminative network, it can also be implemented by designing the decoder of the Transformer. Specifically, a categorical feature (i.e., the image discriminative value) is introduced as the output of the discriminative network. This categorical feature is similar to the categorical feature in the BERT model, and its function is to score the realism of the generated virtual image data in order to obtain the realism score of the discriminative network for the generated virtual image data.
[0054] Optionally, a discriminative network trained based on known categories and sample data is obtained, including:
[0055] By using a discriminant network, the cross-entropy loss, information entropy loss, and regularization loss of the virtual image data are determined.
[0056] Based on cross-entropy loss, information entropy loss, and regularization loss, a pre-trained loss function is constructed and used as the corresponding loss function in the discriminant network.
[0057] In this embodiment, to improve the realism of the virtual image data generated by the generator network, adversarial training can be performed after the discriminator network is trained. In adversarial training, the discriminator network is fixed while the generator network is trained, enabling the generator network to produce images that the discriminator network struggles to distinguish. Then, the generator network is fixed again, thereby optimizing the discriminator network's discrimination ability. During the adversarial process, both the generator and discriminator networks are optimized. In the adversarial training, each batch of images undergoes one generator network training session and two discriminator network training sessions, ensuring that the discriminator network is adequately updated.
[0058] During adversarial training, the cross-entropy loss, information entropy loss, and regularization loss of the virtual image data are determined through a discriminant network. Based on these losses, a pre-trained loss function is constructed and used as the corresponding loss function in the discriminant network. The formula for the pre-trained loss function is as follows:
[0059] L = L CE (f(G(z));θ)+L feat (f(G(z));θ)+L info (f(G(z));θ)
[0060] Where G(·) represents the mapping function of the generator network, θ is the parameter of the generator network G; f(·) represents the mapping function of the discriminator network; L CE (·) Cross-entropy, L feat (·) represents the regularization loss, L info (·) represents information entropy. Where the cross-entropy L CE (·) Allow the generated virtual image data to approximate the output of the known samples, L feat (·) Makes the feature value distribution of virtual graph data more focused, L info (·) Make the labels more evenly distributed.
[0061] A pre-trained loss function is used as the loss function in the discriminant network of this application embodiment. The initial network model is trained using the pre-trained loss function and the discriminant value. Specifically, the parameters corresponding to the generation network and the discriminant network are updated using the pre-trained loss function. Once the pre-trained loss function converges, the training is complete. That is, the parameters corresponding to the generation network and the discriminant network are updated according to the preset loss function to obtain the updated image discriminant value. When the updated image discriminant value is greater than a threshold, the corresponding virtual image data is used as the source data.
[0062] In another embodiment, when the number of known categories in the discrimination network is multiple, the discrimination network outputs the category of the virtual image data and the discrimination value of the corresponding category. For example, the discrimination network for known category samples includes sample data of three corresponding categories: sample data of the first category, sample data of the third category, and sample data of the third category. When the discrimination network is used to discriminate virtual image data, if the virtual image data output by the discrimination network is sample data of the first category and the discrimination value is 0.9, and the first preset threshold is set to 0.8, the discrimination value is greater than the first preset threshold, and the corresponding virtual image data is used as the source data corresponding to the first sample data. If the virtual image data output by the discrimination network is sample data of the first category and the discrimination value is 0.7, and the first preset threshold is set to 0.8, the discrimination value is greater than the first preset threshold, and the corresponding virtual image data cannot be used as the corresponding source data.
[0063] It should be noted that when the number of known categories in the discrimination network is multiple, the discrimination network outputs the category of the virtual image data and the corresponding discrimination value of the category. For example, the discrimination network for known category samples includes sample data of three corresponding categories: sample data of the first category, sample data of the second category, and sample data of the third category. When the features of multiple categories are similar, when the generator network generates virtual image data, the discrimination network discriminates the virtual image data. The discrimination network outputs a discrimination value of 0.9 for the sample data of the first category and 0.85 for the sample data of the second category. When the first preset threshold is set to 0.8, if the discrimination values of the sample data of the first category and the sample data of the second category are both greater than the first preset threshold, the category with the largest discrimination value is selected as the category corresponding to the virtual image data, and the virtual image data is used as the source data for that category. Therefore, the virtual image data is used as the source data corresponding to the first category sample.
[0064] S203: Using a preset judgment function, calculate the judgment score between the image data to be detected and the source data. When the judgment score is greater than the second preset threshold, determine that the image data to be detected is abnormal data.
[0065] In step S203, after obtaining the corresponding source data, the similarity between the source data and the image data to be detected is calculated, and the image data to be detected is determined to be abnormal based on the similarity between the source data and the image data to be detected.
[0066] In this embodiment, a judgment score between the image data to be detected and the source data is calculated by using a preset judgment function. When the judgment score is greater than a second preset threshold, the image data to be detected is determined to be abnormal data.
[0067] When the source data includes multiple categories, the determination of whether the judgment score is greater than a second preset threshold is performed by first dividing the source data into different categories. A preset judgment function is then used to calculate the judgment score between the image data to be detected and the source data of different categories. The minimum judgment score is selected from these scores. If the minimum judgment score is greater than the second preset threshold, the image data to be detected is determined to be abnormal data. If the minimum judgment score is less than or equal to the second preset threshold, the category of the source data corresponding to the minimum judgment score is determined as the category of the image data to be detected.
[0068] Optionally, a preset judgment function is used to calculate a judgment score between the image data to be detected and the source data. Before determining that the image data to be detected is abnormal data when the judgment score is greater than a second preset threshold, the following steps are also included:
[0069] By identifying the mapping function in the network, statistical information of the source data is calculated.
[0070] Based on the statistical information of the source data and the preset discrimination rules, a preset judgment function is constructed.
[0071] In this embodiment, statistical information of the source data is calculated using a mapping function in the discriminant network. Based on the statistical information of the source data and a preset discrimination rule, a preset judgment function is constructed. Specifically, the preset discrimination rule is based on distance, calculating the distance between the image data to be detected and the source data, and using this distance as the judgment score.
[0072] Optionally, statistical information of the source data is calculated by discriminating the mapping function in the network, including:
[0073] Using the mapping function in the discriminant network, the mean and covariance of the source data are calculated, and the mean and covariance are used as the statistical information of the source data.
[0074] In this embodiment, the mapping function in the discriminant network is used to calculate the mean and covariance of the source data, and the mean and covariance are used as the statistical information corresponding to the source data. The formulas for calculating the mean and covariance of the source data are as follows:
[0075]
[0076]
[0077] Where, N c μ represents the number of source data belonging to category c, f(·) represents the mapping function in the discriminant network, and μ cΣ is the mean when the source data is of category c, and Σ is the covariance when the source data is of category c.
[0078] In this embodiment, after obtaining the corresponding source data, the probability value of the category to which the source data belongs is obtained through a discriminant network. For example, when there are three known categories in the source data, the number of source data corresponding to each category is obtained. Then, for the source data in each category, the mean and covariance of each category are calculated. The probability value of the category to which the source data belongs is obtained through the discriminant network. The mean of the probability values of the source data in the same category is calculated. The covariance of the corresponding category is calculated based on the corresponding mean.
[0079] Optionally, a preset decision function is used to calculate the decision score between the image data to be detected and the source data, including:
[0080] The image data to be detected is input into the discrimination network, which outputs the category probability value corresponding to the image to be detected.
[0081] Based on the category probability value and the preset judgment function, the judgment score between the image data to be detected and the source data is calculated.
[0082] In this embodiment, the category probability value corresponding to the image to be detected is calculated according to the mapping function in the discriminant network. Based on the category probability value and the preset judgment function, the judgment score between the image data to be detected and the source data is calculated. The formula of the preset judgment function is as follows:
[0083]
[0084] Where f(·) represents the mapping function in the discriminant network, μ c Let be the mean of the source data when it is category c, and Σ be the covariance of the source data when it is category c. The minimum distance between the image data to be detected and the corresponding category of the source data is calculated, and the minimum distance is used as the judgment score. When the judgment score is greater than the second preset threshold, the image data to be detected is regarded as abnormal data.
[0085] For example, when there are three known categories in the source data, obtain the number of source data corresponding to each category, and then calculate the mean and covariance of the source data in each category. Obtain the probability value of the category to which the source data belongs through the discriminant network, calculate the mean of the probability values of the source data in the same category, calculate the covariance of the corresponding category based on the corresponding mean, and use the mean and covariance of the source data to calculate the distance between the image data to be detected and the source data.
[0086] A generative network is used to generate virtual image data corresponding to the image data to be detected. A discriminative network trained based on known categories and sample data is then used to discriminate the virtual image data, obtaining a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data. A preset judgment function is used to calculate the judgment score between the image data to be detected and the source data. When the judgment score is greater than a second preset threshold, the image data to be detected is determined as abnormal data. In this invention, virtual data is generated by a generative network, and the virtual data is discriminated by a discriminative network. The source data is determined from the virtual data, and the distance between the source data and the data to be detected is used to determine whether the data to be detected is abnormal. This allows for the detection of abnormal data even without source data, solving the problem of lack of source data in the abnormal data detection process and protecting the privacy of user data.
[0087] Please see Figure 3 , Figure 3 This is a schematic diagram of a heterogeneous detection device based on a generative adversarial network provided in an embodiment of the present invention. In this embodiment, the terminal includes units used for executing... Figure 2 The steps in the corresponding embodiments. Please refer to the details. Figure 2 as well as Figure 2 The relevant descriptions in the corresponding embodiments are shown below. For ease of explanation, only the parts relevant to this embodiment are shown. See also... Figure 3 The anomaly detection device 30 includes: a generation module 31, a discrimination module 32, and an abnormal data determination module 33.
[0088] The generation module 31 is used to generate virtual image data corresponding to the image data to be detected using a generation network.
[0089] The discrimination module 32 is used to obtain a discrimination network trained based on known categories and sample data, to discriminate virtual image data through the discrimination network, and to obtain a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data.
[0090] The abnormal data determination module 33 is used to calculate the determination score between the image data to be detected and the source data using a preset determination function. When the determination score is greater than a second preset threshold, the image data to be detected is determined to be abnormal data.
[0091] Optionally, the above-mentioned generation module 31 includes:
[0092] The feature extraction unit is used to extract feature data from the image data to be detected.
[0093] The virtual image data generation unit is used to acquire random noise data. The generation network generates virtual image data corresponding to the image data to be detected based on the feature data and the random noise data.
[0094] Optionally, the discrimination module 32 includes:
[0095] The loss determination unit is used to determine the cross-entropy loss, information entropy loss, and regularization loss of the virtual image data through the discriminant network.
[0096] The loss function construction unit is used to construct a pre-trained loss function based on cross-entropy loss, information entropy loss, and regularization loss, and then use the pre-trained loss function as the corresponding loss function in the discriminant network.
[0097] Optionally, the aforementioned anomaly detection device 30 further includes:
[0098] The statistical information determination module is used to calculate the statistical information of the source data by identifying the mapping function in the network.
[0099] The construction module is used to construct a preset judgment function based on the statistical information of the source data and the preset judgment rules.
[0100] Optionally, the above statistical information determination module includes:
[0101] The computation unit is used to calculate the mean and covariance of the source data using the mapping function in the discriminant network, and uses the mean and covariance as the statistical information of the source data.
[0102] Optionally, the above-mentioned abnormal data determination module 33 includes:
[0103] The image category probability value determination unit is used to input the image data to be detected into the discrimination network and output the category probability value corresponding to the image to be detected.
[0104] The determination unit is used to calculate the determination score between the image data to be detected and the source data based on the category probability value and the preset determination function.
[0105] It should be noted that the information interaction and execution process between the above-mentioned units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0106] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor, which, when executed by the processor, implements the steps in any of the above embodiments of the outlier detection method based on generative adversarial networks.
[0107] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 4 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0108] The processor referred to can be a CPU, but it can also 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 can be a microprocessor or any conventional processor.
[0109] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of a computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0110] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the functions described above 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 invention. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. 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, the present invention can implement all or part of the processes in the methods of the above embodiments by instructing related hardware through a computer program. 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 above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, 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.
[0111] The present invention can implement all or part of the processes in the methods of the above embodiments, or it can be accomplished by a computer program product. When the computer program product is run on a computer device, the computer device executes the steps in the above method embodiments.
[0112] 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.
[0113] 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 implementations should not be considered beyond the scope of this invention.
[0114] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device 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 coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0115] 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.
[0116] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention 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 the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for outlier detection based on generative adversarial networks, characterized in that, The outlier detection method includes: A generative network is used to generate virtual image data corresponding to the image data to be detected. A discrimination network trained based on known categories and sample data is obtained, and the virtual image data is discriminated through the discrimination network to obtain a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data. The statistical information of the source data is calculated using the mapping function in the discriminant network; the statistical information includes the mean and covariance. Based on the statistical information of the source data and the preset discrimination rules, a preset judgment function is constructed; the formula of the preset judgment function is as follows: in, This represents the mapping function in the discriminant network. This represents the mean value when the source data is of category c. This represents the covariance when the source data is of category c. This represents the category probability value corresponding to the image to be detected. Using a preset judgment function, a judgment score is calculated between the image data to be detected and the source data. When the judgment score is greater than a second preset threshold, the image data to be detected is determined to be abnormal data.
2. The outlier detection method as described in claim 1, characterized in that, The step of using a generative network to generate virtual image data corresponding to the image data to be detected includes: Extract feature data from the image data to be detected; The generator network acquires random noise data and generates virtual image data corresponding to the image data to be detected based on the feature data and the random noise data.
3. The outlier detection method as described in claim 1, characterized in that, The acquisition of the discriminant network trained based on known categories and sample data includes: The cross-entropy loss, information entropy loss, and regularization loss of the virtual image data are determined through the discriminant network. Based on the cross-entropy loss, information entropy loss, and regularization loss, a pre-training loss function is constructed, and this pre-training loss function is used as the corresponding loss function in the discriminant network.
4. The outlier detection method as described in claim 1, characterized in that, The step of calculating the statistical information of the source data through the mapping function in the discriminant network includes: Using the mapping function in the discriminant network, the mean and covariance of the source data are calculated, and the mean and covariance are used as the statistical information corresponding to the source data.
5. The outlier detection method as described in claim 1, characterized in that, The step of using a preset judgment function to calculate the judgment score between the image data to be detected and the source data includes: The image data to be detected is input into the discrimination network, and the category probability value corresponding to the image to be detected is output. Based on the category probability value and the preset judgment function, the judgment score between the image data to be detected and the source data is calculated.
6. An outlier detection device based on generative adversarial networks, characterized in that, The anomaly detection device includes: The generation module is used to generate virtual image data corresponding to the image data to be detected using a generation network. The acquisition module is used to acquire a discrimination network trained based on known categories and sample data, wherein the discrimination network is used to discriminate the virtual image data; The discrimination module is used to discriminate the virtual image data through the discrimination network to obtain a discrimination result. When the discrimination result is greater than a first preset threshold, the virtual image data corresponding to the discrimination result is determined as the source data. The statistical information determination module is used to calculate the statistical information of the source data through the mapping function in the discriminant network; the statistical information includes the mean and covariance. The construction module is used to construct a preset judgment function based on the statistical information of the source data and the preset discrimination rules; the formula of the preset judgment function is as follows: in, This represents the mapping function in the discriminant network. This represents the mean value when the source data is of category c. This represents the covariance when the source data is of category c. This represents the category probability value corresponding to the image to be detected. The abnormal data determination module is used to calculate the determination score between the image data to be detected and the source data using a preset determination function. When the determination score is greater than a second preset threshold, the image data to be detected is determined to be abnormal data.
7. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the outlier detection 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 the processor, it implements the outlier detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Equipment anomaly detection method using Gaussian noise
CN112836570A
Novelty detection using discriminator of generative adversarial network
EP3404586A1