Training method and device of electric power confrontation sample image recognition model, equipment and storage medium

By adding different noise to each original image in the power image dataset, generating adversarial sample images and updating the generation adversarial network, the problem of lack of a unified system for the security evaluation of artificial intelligence models in the prior art is solved, and the recognition accuracy of adversarial sample images and the robustness of the model are improved.

CN119600368AActive Publication Date: 2025-03-11ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD +1

Patent Information

Application Number
CN202411762777.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-11
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

The prior art lacks a unified system when evaluating and testing the security of artificial intelligence models, and the existing security testing methods are weak in scalability and repeatability, making it difficult to effectively identify adversarial sample images in power images.

Method used

By adding at least two different noises to each original image in the power image data set, multiple noise-added seed images are generated, and these images are input into the generator and discriminator of the generating adversarial network, the adversarial sample images are generated and the generation adversarial network is updated until the preset stop conditions are met, and the recognition model for identifying the target power image is formed.

Benefits of technology

The accuracy of target power image recognition is improved, the recognition ability of adversarial sample images is enhanced, the discriminator performance of the generative adversarial network is improved, and the robustness of the model is ensured in the face of malicious attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600368A_ABST
    Figure CN119600368A_ABST
Patent Text Reader

Abstract

The invention discloses a training method, device and equipment of an electric power confrontation sample image recognition model and a storage medium, and the method comprises the steps: adding at least two different noises to each original electric power image, and obtaining a plurality of noise-added seed images; inputting each noise-added seed image into a GAN generator to generate a plurality of adversarial sample images; inputting each adversarial sample image into a GAN discriminator to obtain a prediction category of each adversarial sample image; based on the prediction category and the actual category of the original power image corresponding to each confrontation sample image, determining an evaluation index value corresponding to the GAN; and on the basis of the evaluation index value determined by the ith iteration and the generated multiple adversarial sample images, performing iterative updating on the GAN of the (i + 1) th iteration until a preset condition of stopping generating the adversarial sample images is met, and taking a discriminator of the GAN of the last iteration as a power image recognition model. In this way, the accuracy of power image recognition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a training method, device, equipment and storage medium for an electric power adversarial sample image recognition model. Background Art

[0002] At present, the application of artificial intelligence technology in the energy industry, especially in the power system, has entered a mature stage. However, the black-box characteristics and weak interpretability of artificial intelligence algorithms used in new power systems make adversarial sample image attacks and other threats a continuous threat to the security of artificial intelligence algorithm models in power systems, which may cause system failures or even paralysis. Among them, adversarial sample image attacks refer to the attacker adding tiny perturbations that are imperceptible to humans to normal samples, thereby misleading the artificial intelligence model to make wrong decisions. Therefore, it is particularly important to identify power images in power systems to determine whether the power images are adversarial sample images.

[0003] Existing AI model security assessment methods usually focus on specific dimensions and lack a unified system for model security assessment. In addition, most existing AI security testing methods focus on single tests, and their scalability and repeatability are weak. Therefore, how to improve the accuracy of power image recognition has become an urgent problem to be solved. Summary of the invention

[0004] The embodiments of the present application provide a training method, device, equipment and storage medium for an electric power adversarial sample image recognition model, which is conducive to improving the accuracy of target electric power image recognition.

[0005] In a first aspect, an embodiment of the present application provides a method for training a power adversarial sample image recognition model, the method comprising:

[0006] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0007] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0008] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0009] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0010] In one embodiment, at least two different noises are added to each original image in the power image dataset to obtain multiple noisy seed images, including: adding Gaussian noise and salt and pepper noise to each original image in the power image dataset to obtain multiple noisy seed images.

[0011] In one embodiment, based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1th iteration is iteratively updated until a preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as a power image recognition model for identifying the target power image, including: updating the network parameters of the generative adversarial network of the i+1th iteration based on the evaluation index value determined in the i-th iteration to obtain the i+1th generative adversarial network; inputting the multiple adversarial sample images generated in the i-th iteration into the i+1th generative adversarial network; In the generator, multiple new adversarial sample images generated by the i+1th iteration are obtained, and the multiple new adversarial sample images are input into the discriminator of the i+1th generative adversarial network to obtain the predicted category of each new adversarial sample image; based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image, the evaluation index value corresponding to the i+1th iteration is determined, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image.

[0012] In one embodiment, the evaluation index value includes accuracy and / or a total loss value; the total loss value is composed of a first loss value, a second loss value and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, and the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image.

[0013] In one embodiment, the first loss value, the second loss value, and the third loss value are determined in the following manner: the original image is input into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and the first loss value is determined based on the probability of the predicted category of the original image; the second loss value is determined based on the probability corresponding to the predicted category of the adversarial sample image; and the third loss value is determined based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image.

[0014] In one embodiment, each noisy seed image is input into a generator of a generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and each adversarial sample image is input into a discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image, including: inputting each original image and each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each original image and an adversarial sample image corresponding to each noisy seed image; and inputting the generated multiple adversarial sample images into the discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image.

[0015] In a second aspect, the present application provides a training device for a power adversarial sample image recognition model, the device comprising:

[0016] A processing module, used for adding at least two different noises to each original image in the power image data set to obtain a plurality of noisy seed images;

[0017] The processing module is further used to input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image;

[0018] A determination module, used to determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0019] An updating module is used to iteratively update the generative adversarial network of the (i+1)th iteration based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, until a preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0020] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0021] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0022] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0023] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0024] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0025] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0026] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0027] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0028] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0029] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0030] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0031] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0032] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0033] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0034] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0035] The training method, device, equipment and storage medium of the above-mentioned power adversarial sample image recognition model, the computer equipment can add at least two different noises to each original image in the power image data set to obtain multiple noisy seed images; each noisy seed image is input into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and each adversarial sample image is input into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image; based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image, the evaluation index value corresponding to the generative adversarial network is determined; based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1. By adopting this method, a computer device adds at least two different noises to each original image in a power image data set to obtain multiple noisy seed images, and inputs the multiple noisy seed images into a generator, thereby improving the diversity of generated adversarial samples. Thus, based on the diverse adversarial samples and the evaluation index values ​​corresponding to the determined generative adversarial network, the generative adversarial network is iteratively updated, thereby improving the performance of the discriminator of the generative adversarial network. Furthermore, when the preset condition for stopping the generation of adversarial sample images is met, the discriminator of the generative adversarial network of the last iteration is used as a power image recognition model for identifying the target power image, which is conducive to using the power image recognition model to accurately identify whether the target power image is an adversarial sample image, that is, it is conducive to improving the accuracy of identifying the target power image. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 It is an architecture diagram of a training system for a power adversarial sample image recognition model provided in an embodiment of the present application;

[0038] Figure 2 It is a schematic diagram of the training process of a power adversarial sample image recognition model provided in an embodiment of the present application;

[0039] Figure 3It is a flowchart of a method for training a power adversarial sample image recognition model provided in an embodiment of the present application;

[0040] Figure 4 It is a flowchart of another method for training a power adversarial sample image recognition model provided in an embodiment of the present application;

[0041] Figure 5 It is a structural schematic diagram of a training device for a power adversarial sample image recognition model provided in an embodiment of the present application;

[0042] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0044] Combine the following Figure 1 and Figure 2 The application scenarios of the training method of the power adversarial sample image recognition model provided in the embodiment of the present application are introduced. Figure 1 is an architecture diagram of a training system for a power adversarial sample image recognition model provided in an embodiment of the present application, Figure 2 This is a schematic diagram of the training process of a power adversarial sample image recognition model provided in an embodiment of the present application.

[0045] like Figure 1 As shown, the computer device 101 ( Figure 1 In the figure, the computer device 101 is taken as a terminal device for example) and the database server 102, wherein the computer device 101 and the database server 102 can transmit data via a network. The computer device 101 can obtain the power image data set from the database server 102.

[0046] like Figure 2 As shown, after acquiring the power image dataset, the computer device 101 can add at least two different noises (corresponding to Figure 2), obtain multiple noisy seed images; then, input the multiple noisy seed images into the generator of the generative adversarial network to generate diversified noisy adversarial sample images; then, input the diversified noisy adversarial sample images into the discriminator of the generative adversarial network to classify each noisy adversarial sample image to obtain the predicted category of each adversarial sample image; further, determine the evaluation index value (for example, accuracy) corresponding to the generative adversarial network based on the predicted category of the adversarial sample image, and based on the accuracy determined by the i-th iteration and the generated diversified adversarial samples, iteratively update the generative adversarial network of the i+1th iteration until the preset condition for stopping the generation of adversarial sample images is met, and use the discriminator of the last iteration as the power image recognition model, which is used to identify whether the power image is an adversarial sample image; wherein i is a positive integer greater than or equal to 1. In this way, the computer device 101 iteratively updates the generative adversarial network based on the diverse adversarial samples and the evaluation index values ​​corresponding to the determined generative adversarial network, which can improve the performance of the discriminator of the generative adversarial network. Therefore, when the preset condition for stopping generating adversarial sample images is met, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image, which is beneficial to using the power image recognition model to accurately identify whether the target power image is an adversarial sample image, that is, it is beneficial to improve the accuracy of identifying the target power image.

[0047] Optionally, the computer device 101 may be a terminal device or a server. The terminal device mentioned here may include but is not limited to: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, a smart TV, a smart car terminal, etc. The server mentioned here may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers.

[0048] See also Figure 3 , Figure 3 1 is a flow chart of a method for training a power adversarial sample image recognition model provided in an embodiment of the present application. The method can be executed by a computer device (for example, the above-mentioned computer device 101). Figure 3 As shown, the training method of the power adversarial sample image recognition model may include but is not limited to the following steps:

[0049] S301 . Add at least two different noises to each original image in the power image dataset to obtain a plurality of noisy seed images.

[0050] The noisy seed image refers to the original image after adding at least two different noises, which can be used to train the generative adversarial network.

[0051] Generative Adversarial Networks (GAN) is a deep learning model that generates new data similar to training data through adversarial training of two neural networks. GAN consists of a generator and a discriminator, where the goal of the generator is to generate samples that look real, while the goal of the discriminator is to distinguish between real samples and generated samples.

[0052] S302: Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image.

[0053] Among them, since each adversarial sample image is generated based on each noisy seed image, each adversarial sample image is an adversarial sample image with noise.

[0054] S303: Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image.

[0055] S304. Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the (i+1)-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0056] In an optional implementation, the evaluation index value corresponding to the generative adversarial network may include the accuracy and / or total loss value corresponding to the generative adversarial network.

[0057] In this embodiment, if the evaluation index value is accuracy, the preset condition for stopping the generation of adversarial sample images may be that the accuracy of the generated adversarial network obtained after N consecutive iterations is greater than the preset accuracy threshold. If the evaluation index value is the total loss value, the preset condition for stopping the generation of adversarial sample images may be that the total loss value of the generated adversarial network obtained after N consecutive iterations is greater than the preset total loss threshold. If the evaluation index value is accuracy and total loss value, the preset condition for stopping the generation of adversarial sample images may be that the accuracy of the generated adversarial network obtained after N consecutive iterations is greater than the preset accuracy threshold, and the total loss value is greater than the preset total loss threshold.

[0058] In an embodiment of the present application, a computer device may add at least two different noises to each original image in a power image data set to obtain a plurality of noisy seed images; input each noisy seed image into a generator of a generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into a discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image; determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image; iteratively update the generative adversarial network of the i+1th iteration based on the evaluation index value determined by the i-th iteration and the plurality of adversarial sample images generated until a preset condition for stopping generating adversarial sample images is met, and use the discriminator of the generative adversarial network of the last iteration as a power image recognition model for identifying a target power image; wherein i is a positive integer greater than or equal to 1. By adopting this method, a computer device adds at least two different noises to each original image in a power image data set to obtain multiple noisy seed images, and inputs the multiple noisy seed images into a generator, thereby improving the diversity of generated adversarial samples. Thus, based on the diverse adversarial samples and the evaluation index values ​​corresponding to the determined generative adversarial network, the generative adversarial network is iteratively updated, thereby improving the performance of the discriminator of the generative adversarial network. Furthermore, when the preset condition for stopping the generation of adversarial sample images is met, the discriminator of the generative adversarial network of the last iteration is used as a power image recognition model for identifying the target power image, which is conducive to using the power image recognition model to accurately identify whether the target power image is an adversarial sample image, that is, it is conducive to improving the accuracy of identifying the target power image.

[0059] See also Figure 4 , Figure 4 is a flow chart of another method for training a power adversarial sample image recognition model provided in an embodiment of the present application. Figure 3 Compared with the training method of the power adversarial sample image recognition model shown, Figure 4 The method shown specifically describes how the computer device iteratively updates the generative adversarial network of the i+1th iteration based on the evaluation index value determined in the ith iteration and the multiple adversarial sample images generated, until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image. Figure 4 As shown, the training method of the power adversarial sample image recognition model may include but is not limited to the following steps:

[0060] S401 : Add Gaussian noise and salt and pepper noise to each original image in the power image dataset to obtain a plurality of noisy seed images.

[0061] Among them, Gaussian noise is a statistical noise whose amplitude follows a normal (Gaussian) distribution. Gaussian noise is a Gaussian distributed random variable with a mean of 0 and a variance of σ2. Salt and pepper noise is a random noise that is simulated by changing some pixels of the image to the maximum value (salt, usually 255) or the minimum value (pepper, usually 0).

[0062] In an optional embodiment, the computer device adds Gaussian noise and salt and pepper noise to each original image in the power image data set to obtain multiple noisy seed images. Gaussian noise may be first added to each original image to obtain multiple noisy images, and then salt and pepper noise is added to each noisy image to obtain multiple noisy seed images. Salt and pepper noise may be first added to each original image to obtain multiple noisy images, and then Gaussian noise is added to each noisy image to obtain multiple noisy seed images. Gaussian noise and salt and pepper noise may also be added to each original image at the same time to obtain multiple noisy seed images, which is not limited here.

[0063] In an optional implementation, the computer device adds Gaussian noise and salt and pepper noise to each original image in the power image dataset, and each of the obtained noisy seed images can be expressed by the following formula (1).

[0064] (1)

[0065] In formula (1), I noisy represents the noisy seed image; I represents the original image; N g represents Gaussian noise; I s represents salt and pepper noise; (x, y) represents each pixel in the image.

[0066] It can be understood that the image after adding Gaussian noise can be expressed as the following formula (2).

[0067] (2)

[0068] In formula (2), I g represents the image after adding Gaussian noise; I represents the original image; N g represents Gaussian noise.

[0069] Among them, for each pixel in the image, the Gaussian noise N g It can be expressed as the following formula (3).

[0070] (3)

[0071] In formula (3), It means that the mean is 0 and the variance is Gaussian distribution.

[0072] For each pixel in the image, the salt and pepper noise I s It can be expressed as the following formula (4).

[0073] (4)

[0074] In formula (4), p represents the noise density, that is, the probability of each pixel in the image being changed to salt and pepper; I represents the original image.

[0075] In this implementation, the computer device adds Gaussian noise to each original image in the power image data set, such as adding a random value with a mean of 0 and an adjustable standard deviation to simulate the electronic noise in the natural image capture process. Adding salt and pepper noise to each original image can simulate random errors that may occur in image transmission or processing, and is achieved by randomly changing some pixels to white (salt) or black (pepper) with a certain probability. In this way, by adding Gaussian noise and salt and pepper noise with adjusted parameters to each original image, the generated noisy seed image can effectively test and enhance the robustness of the generative adversarial network. In other words, by adding Gaussian noise and salt and pepper noise with adjusted parameters to each original image, not only can the diversity and intensity of the noise be balanced to ensure that the generated samples are both realistic, but also the generalization ability of the generative adversarial network can be challenged with sufficiently complex noisy seed images.

[0076] S402: Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image.

[0077] As part of the generative adversarial network, the generator can learn to extract features from the input image and generate new images similar to the input image (i.e. adversarial sample images). The goal of the generator is to minimize the discriminator's ability to correctly identify the generated data.

[0078] In the process of inputting each noisy seed image into the generator of the generative adversarial network and generating adversarial sample images corresponding to each noisy seed image, the computer device will try to maintain the key features of the seed image while introducing changes to create new data samples (i.e., new images similar to the input images), wherein the introduced changes may include but are not limited to further added noise, distortion or other visual disturbances. Ultimately, the computer device can generate a set of new adversarial sample images through the generator of the generative adversarial network, which are visually similar to the original images but contain sufficient changes. The adversarial sample images can be used to further test and enhance the robustness of the generative adversarial network, especially in terms of the defense capabilities against adversarial sample attacks, and can better test and enhance the robustness of the generative adversarial network.

[0079] It is understandable that a computer device can generate a diverse set of adversarial sample images through a generator of a generative adversarial network, which is helpful for evaluating and improving the performance of the generative adversarial network in the face of malicious attacks in practical applications.

[0080] In step S402, the computer device inputs each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image, the main purpose of which is to evaluate the performance of the discriminator, that is, to evaluate the ability of the discriminator to distinguish between the original image and the adversarial sample image. The computer device can output the predicted category probability value corresponding to each input image through the discriminator, and the probability value is used to indicate the possibility that the input image belongs to the real data set (or the power image data set).

[0081] S403: Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image.

[0082] In an optional implementation, the evaluation index value includes accuracy and / or a total loss value; wherein the total loss value is composed of a first loss value, a second loss value, and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image. In this way, by introducing the third loss value in the process of determining the total loss value of the generative adversarial network, the computer device can further enhance the discriminator's ability to recognize subtle differences, thereby facilitating the subsequent improvement of the performance of the generative adversarial network.

[0083] The accuracy rate refers to the proportion of correct classifications (correct identification of the input image as the original image or the adversarial sample image) by the discriminator. The accuracy rate can be determined by a computer device through the following formula (5).

[0084] (5)

[0085] In formula (5), ACC represents the accuracy; TP refers to the true positive examples, which indicates the number of images correctly identified as original images; TN refers to the true negative examples, which indicates the number of images correctly identified as adversarial samples; FP refers to the false positive examples, which indicates the number of adversarial samples that are mistakenly judged as original images; and FN refers to the false negative examples, which indicates the number of original images that are mistakenly judged as adversarial samples.

[0086] Optionally, the third loss value may be a Euclidean distance loss value between the adversarial sample image and the original image corresponding to the adversarial sample image. The total loss value may be determined by the computer device through the following formula (6).

[0087] (6)

[0088] In formula (6), LD represents the total loss value; the first term on the right side of the equal sign represents the first loss value, the second term represents the second loss value, and the third term represents the third loss value; λ is a hyperparameter, which is the weight used to balance the adversarial loss value (i.e., the first loss value and the second loss value) and the Euclidean distance loss value (the third loss value). In this way, by introducing the Euclidean distance loss when determining the total loss value of the generative adversarial network, it is not only beneficial to subsequently improve the discriminator's ability to recognize the generated adversarial sample images, but also to promote the generator to generate higher quality adversarial sample images, thereby improving the performance and security of the entire generative adversarial network.

[0089] The first loss value, the second loss value and the third loss value may be determined by the computer device in the following manner: the original image is input into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and based on the probability of the predicted category of the original image, the first loss value is determined (such as the first term on the right side of the equal sign in formula (6)); the second loss value is determined based on the probability corresponding to the predicted category of the adversarial sample image (such as the second term on the right side of the equal sign in formula (6)); and the third loss value is determined based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image (such as the third term on the right side of the equal sign in formula (6)).

[0090] S404: Update the network parameters of the generative adversarial network of the (i+1)th iteration based on the evaluation index value determined in the (i+1)th iteration to obtain the (i+1)th generative adversarial network.

[0091] Wherein, i is a positive integer greater than or equal to 1.

[0092] S405. Input the multiple adversarial sample images generated by the i-th iteration into the generator of the i+1-th generative adversarial network to obtain multiple new adversarial sample images generated by the i+1-th iteration, and input the multiple new adversarial sample images into the discriminator of the i+1-th generative adversarial network to obtain the predicted category of each new adversarial sample image.

[0093] S406. Based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image, determine the evaluation index value corresponding to the i+1th iteration, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, and use the discriminator of the generative adversarial network of the last iteration as the power image recognition model for identifying the target power image.

[0094] The following is an illustration of steps S404 to S406.

[0095] Exemplarily, assuming that the evaluation index value is accuracy, the preset evaluation index threshold is 85% (i.e., the accuracy threshold is 85%), and assuming that the accuracy determined in the first iteration is 89%, the computer device can determine that the accuracy of 89% determined in the first iteration is greater than the accuracy threshold of 85%. In this case, the computer device can first update the network parameters of the second iteration of the generative adversarial network based on the accuracy of 89% determined in the first iteration to obtain the second generative adversarial network. Secondly, the adversarial sample image generated in the first iteration is input into the generator of the second generative adversarial network to obtain multiple new adversarial sample images generated in the second iteration, and the multiple new adversarial sample images are input into the discriminator of the second generative adversarial network to obtain the predicted category of each new adversarial sample image. Then, the computer device may determine the accuracy corresponding to the second iteration based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image. If the accuracy corresponding to the second iteration is greater than 85% (such as the accuracy corresponding to the second iteration is 90%), the computer device may update the network parameters of the second iteration of the generative adversarial network based on the accuracy of 90% determined in the second iteration to obtain the third generative adversarial network. Afterwards, the computer device may input the new adversarial sample image generated by the second iteration into the generator of the third generative adversarial network to obtain multiple new adversarial sample images generated by the third iteration, and input the multiple new adversarial sample images generated by the third iteration into the discriminator of the third generative adversarial network to obtain the predicted category of each new adversarial sample image generated by the third iteration. Subsequently, the computer device may determine the accuracy corresponding to the third iteration based on the predicted category of each new adversarial sample image generated by the third iteration and the actual category of the original image corresponding to each new adversarial sample image. If the accuracy corresponding to the third iteration is still greater than 85% (such as the accuracy corresponding to the third iteration is 91%), the computer device may determine that the accuracy corresponding to three consecutive iterations is greater than the preset accuracy threshold of 85%. In this case, the computer device may use the discriminator of the generative adversarial network of the last iteration (i.e., the discriminator in the third generative adversarial network) as a power image recognition model for identifying the target power image.

[0096] In an optional implementation, after step S406, the computer device may further use the power image recognition model to recognize the target power image to determine whether the target power image is an adversarial sample image. In this way, the accuracy of the recognition of the target power image may be improved.

[0097] In an embodiment of the present application, a computer device can add Gaussian noise and salt and pepper noise to each original image in a power image data set to obtain a plurality of noisy seed images. In this way, the diversity and complexity of the seed images can be improved by artificial noise addition. Afterwards, by inputting the diverse and complex noisy seed images into the generator of a generative adversarial network, not only the diversity of the generated adversarial sample images can be improved, but also the robustness of the generative adversarial network can be effectively tested and enhanced. Thus, based on the diverse adversarial samples and the evaluation index values ​​corresponding to the determined generative adversarial network, the generative adversarial network is iteratively updated to improve the performance of the discriminator of the generative adversarial network. Furthermore, when the preset condition for stopping the generation of adversarial sample images is met, the discriminator of the generative adversarial network of the last iteration is used as a power image recognition model for identifying the target power image, which is beneficial to using the power image recognition model to accurately identify whether the target power image is an adversarial sample image, that is, it is beneficial to improve the accuracy of identifying the target power image.

[0098] In addition, in an embodiment of the present application, by setting an early stopping strategy, when the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the next iteration is stopped, that is, the generation of new adversarial sample images is stopped, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image. In this way, the generative adversarial network can be effectively prevented from overfitting, computing resources can be saved, and the training process can be accelerated.

[0099] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0100] Based on the same inventive concept, the embodiment of the present application also provides a training device for a power adversarial sample image recognition model for implementing the training method for the power adversarial sample image recognition model involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the training device for one or more power adversarial sample image recognition models provided below can refer to the limitations of the training method for the power adversarial sample image recognition model above, and will not be repeated here.

[0101] See also Figure 5 , Figure 5 Schematic diagram of a training device for a power adversarial sample image recognition model provided by an embodiment of the present application. Figure 5 As shown, the training device of the power adversarial sample image recognition model may include but is not limited to:

[0102] The processing module 501 is used to add at least two different noises to each original image in the power image data set to obtain a plurality of noisy seed images;

[0103] The processing module 501 is further used to input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category of each adversarial sample image;

[0104] A determination module 502 is used to determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0105] The updating module 503 is used to iteratively update the generative adversarial network of the (i+1)th iteration based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0106] In one embodiment, when the processing module 501 is used to add at least two different noises to each original image in the power image data set to obtain multiple noisy seed images, it is specifically used to add Gaussian noise and salt and pepper noise to each original image in the power image data set to obtain multiple noisy seed images.

[0107] In one embodiment, the update module 503 is used to iteratively update the generative adversarial network of the i+1th iteration based on the evaluation index value determined by the i-th iteration and the multiple adversarial sample images generated, until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image. Specifically, it is used to: update the network parameters of the generative adversarial network of the i+1th iteration based on the evaluation index value determined by the i-th iteration to obtain the i+1th generative adversarial network; input the multiple adversarial sample images generated by the i-th iteration into the i+1th generative adversarial network; In the generator of the generative adversarial network, multiple new adversarial sample images generated by the i+1th iteration are obtained, and the multiple new adversarial sample images are input into the discriminator of the i+1th generative adversarial network to obtain the predicted category of each new adversarial sample image; based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image, the evaluation index value corresponding to the i+1th iteration is determined, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image.

[0108] In one embodiment, the evaluation index value includes accuracy and / or a total loss value; the total loss value is composed of a first loss value, a second loss value and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, and the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image.

[0109] In one embodiment, the determination module 502 is further used to: input the original image into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and determine a first loss value based on the probability of the predicted category of the original image; determine a second loss value based on the probability corresponding to the predicted category of the adversarial sample image; and determine a third loss value based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image.

[0110] In one embodiment, when the processing module 501 is used to input each noisy seed image into the generator of the generative adversarial network, generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image, it is specifically used to: input each original image and each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each original image and an adversarial sample image corresponding to each noisy seed image; and input the generated multiple adversarial sample images into the discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image.

[0111] Each module in the training device of the power adversarial sample image recognition model can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the terminal device in the form of hardware, or can be stored in the memory of the terminal device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0112] In an exemplary embodiment, the present application provides a computer device, which may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a training method for an electric power adversarial sample image recognition model is implemented.

[0113] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0114] In an exemplary embodiment, the present application provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0115] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0116] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0117] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0118] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0119] In one embodiment, when a processor executes a computer program to add at least two different noises to each original image in the power image data set to obtain multiple noisy seed images, the following steps are specifically implemented: Gaussian noise and salt and pepper noise are added to each original image in the power image data set to obtain multiple noisy seed images.

[0120] In one embodiment, the processor executes a computer program to iteratively update the generative adversarial network of the i+1th iteration based on the evaluation index value determined by the i-th iteration and the multiple adversarial sample images generated, until a preset condition for stopping the generation of adversarial sample images is met, and when the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image, the following steps are specifically implemented: based on the evaluation index value determined by the i-th iteration, the network parameters of the generative adversarial network of the i+1th iteration are updated to obtain the i+1th generative adversarial network; the multiple adversarial sample images generated by the i-th iteration are input into the i+1th generation adversarial network; In the generator of a generative adversarial network, multiple new adversarial sample images generated by the i+1th iteration are obtained, and the multiple new adversarial sample images are input into the discriminator of the i+1th generative adversarial network to obtain the predicted category of each new adversarial sample image; based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image, the evaluation index value corresponding to the i+1th iteration is determined, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image.

[0121] In one embodiment, the evaluation index value includes accuracy and / or a total loss value; the total loss value is composed of a first loss value, a second loss value and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, and the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image.

[0122] In one embodiment, when the processor executes the computer program, the following steps are also implemented: inputting the original image into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and determining a first loss value based on the probability of the predicted category of the original image; determining a second loss value based on the probability corresponding to the predicted category of the adversarial sample image; and determining a third loss value based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image.

[0123] In one embodiment, when a processor executes a computer program to input each noisy seed image into a generator of a generative adversarial network, generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into a discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image, the following steps are specifically implemented: input each original image and each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each original image and an adversarial sample image corresponding to each noisy seed image; and input the generated multiple adversarial sample images into the discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image.

[0124] In an exemplary embodiment, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0125] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0126] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0127] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0128] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0129] In one embodiment, when a computer program is executed by a processor to add at least two different noises to each original image in a power image dataset to obtain a plurality of noisy seed images, the following steps are specifically implemented: Gaussian noise and salt and pepper noise are added to each original image in the power image dataset to obtain a plurality of noisy seed images.

[0130] In one embodiment, the computer program is executed by a processor to iteratively update the generative adversarial network of the i+1th iteration based on the evaluation index value determined by the i-th iteration and the multiple adversarial sample images generated until a preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image, and specifically implements the following steps: based on the evaluation index value determined by the i-th iteration, the network parameters of the generative adversarial network of the i+1th iteration are updated to obtain the i+1th generative adversarial network; the multiple adversarial sample images generated by the i-th iteration are input into the i+1th generation adversarial network; In the generator of a generative adversarial network, multiple new adversarial sample images generated by the i+1th iteration are obtained, and the multiple new adversarial sample images are input into the discriminator of the i+1th generative adversarial network to obtain the predicted category of each new adversarial sample image; based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image, the evaluation index value corresponding to the i+1th iteration is determined, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image.

[0131] In one embodiment, the evaluation index value includes accuracy and / or a total loss value; the total loss value is composed of a first loss value, a second loss value and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, and the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image.

[0132] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: inputting the original image into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and determining a first loss value based on the probability of the predicted category of the original image; determining a second loss value based on the probability corresponding to the predicted category of the adversarial sample image; and determining a third loss value based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image.

[0133] In one embodiment, when a computer program is executed by a processor to input each noisy seed image into a generator of a generative adversarial network, generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into a discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image, the following steps are specifically implemented: input each noisy seed image into the generator of the generative adversarial network, generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image.

[0134] In an exemplary embodiment, the present application provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0135] Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images;

[0136] Input each noisy seed image into the generator of the generative adversarial network to generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image;

[0137] Determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each adversarial sample image and the actual category of the original image corresponding to each adversarial sample image;

[0138] Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

[0139] In one embodiment, when a computer program is executed by a processor to add at least two different noises to each original image in a power image dataset to obtain a plurality of noisy seed images, the following steps are specifically implemented: Gaussian noise and salt and pepper noise are added to each original image in the power image dataset to obtain a plurality of noisy seed images.

[0140] In one embodiment, the computer program is executed by a processor to iteratively update the generative adversarial network of the i+1th iteration based on the evaluation index value determined by the i-th iteration and the multiple adversarial sample images generated until a preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image, and specifically implements the following steps: based on the evaluation index value determined by the i-th iteration, the network parameters of the generative adversarial network of the i+1th iteration are updated to obtain the i+1th generative adversarial network; the multiple adversarial sample images generated by the i-th iteration are input into the i+1th generation adversarial network; In the generator of a generative adversarial network, multiple new adversarial sample images generated by the i+1th iteration are obtained, and the multiple new adversarial sample images are input into the discriminator of the i+1th generative adversarial network to obtain the predicted category of each new adversarial sample image; based on the predicted category of each new adversarial sample image and the actual category of the original image corresponding to each new adversarial sample image, the evaluation index value corresponding to the i+1th iteration is determined, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image.

[0141] In one embodiment, the evaluation index value includes accuracy and / or a total loss value; the total loss value is composed of a first loss value, a second loss value and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, and the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image.

[0142] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: inputting the original image into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and determining a first loss value based on the probability of the predicted category of the original image; determining a second loss value based on the probability corresponding to the predicted category of the adversarial sample image; and determining a third loss value based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image.

[0143] In one embodiment, when a computer program is executed by a processor to input each noisy seed image into a generator of a generative adversarial network, generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into a discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image, the following steps are specifically implemented: input each noisy seed image into the generator of the generative adversarial network, generate an adversarial sample image corresponding to each noisy seed image, and input each adversarial sample image into the discriminator of the generative adversarial network to obtain a predicted category for each adversarial sample image.

[0144] It should be noted that the data involved in this application (including but not limited to original images, adversarial sample images, target power images, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0145] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0146] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0147] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A training method for a power adversarial sample image recognition model, characterized in that: The method comprises: Add at least two different noises to each original image in the power image dataset to obtain multiple noisy seed images; Inputting each of the noisy seed images into a generator of a generative adversarial network to generate adversarial sample images corresponding to each of the noisy seed images, and inputting each of the adversarial sample images into a discriminator of the generative adversarial network to obtain a predicted category of each of the adversarial sample images; Determining an evaluation index value corresponding to the generative adversarial network based on the predicted category of each of the adversarial sample images and the actual category of the original image corresponding to each of the adversarial sample images; Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until the preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein, i is a positive integer greater than or equal to 1.

2. The method according to claim 1, characterized in that The step of adding at least two different noises to each original image in the power image dataset to obtain a plurality of noisy seed images includes: Gaussian noise and salt and pepper noise are added to each original image in the power image dataset to obtain multiple noisy seed images.

3. The method according to claim 1, characterized in that Based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, the generative adversarial network of the i+1-th iteration is iteratively updated until a preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as a power image recognition model for identifying the target power image, including: Based on the evaluation index value determined in the i-th iteration, the network parameters of the generative adversarial network of the i+1-th iteration are updated to obtain the i+1-th generative adversarial network; Inputting the multiple adversarial sample images generated in the i-th iteration into the generator of the i+1-th generative adversarial network to obtain multiple new adversarial sample images generated in the i+1-th iteration, and inputting the multiple new adversarial sample images into the discriminator of the i+1-th generative adversarial network to obtain the predicted category of each new adversarial sample image; Based on the predicted category of each of the new adversarial sample images and the actual category of the original image corresponding to each of the new adversarial sample images, the evaluation index value corresponding to the i+1th iteration is determined, until the evaluation index value corresponding to N consecutive iterations is greater than or equal to the preset evaluation index threshold, the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image.

4. The method according to any one of claims 1 to 3, characterized in that: The evaluation index value includes accuracy and / or total loss value; The total loss value is composed of a first loss value, a second loss value and a third loss value; the first loss value is used to characterize the ability of the discriminator to recognize the original image, the second loss value is used to characterize the ability of the discriminator to recognize the adversarial sample image corresponding to the original image; the third loss value is used to characterize the difference between the adversarial sample image and the original image corresponding to the adversarial sample image.

5. The method according to claim 4, characterized in that The first loss value, the second loss value, and the third loss value are determined in the following manner: Inputting the original image into the discriminator of the generative adversarial network to obtain the probability of the predicted category of the original image, and determining a first loss value based on the probability of the predicted category of the original image; Determining a second loss value based on the probability corresponding to the predicted category of the adversarial sample image; and A third loss value is determined based on the probability corresponding to the predicted category of the adversarial sample image and the probability of the predicted category of the original image corresponding to the adversarial sample image.

6. The method according to claim 1, characterized in that The step of inputting each of the noisy seed images into a generator of a generative adversarial network to generate adversarial sample images corresponding to each of the noisy seed images, and inputting each of the adversarial sample images into a discriminator of the generative adversarial network to obtain a predicted category of each of the adversarial sample images comprises: Inputting each of the original images and each of the noisy seed images into a generator of a generative adversarial network to generate an adversarial sample image corresponding to each of the original images and an adversarial sample image corresponding to each of the noisy seed images; The generated multiple adversarial sample images are input into the discriminator of the generative adversarial network to obtain the predicted category of each adversarial sample image.

7. A training device for an electric power adversarial sample image recognition model, characterized in that: The device comprises: A processing module, used for adding at least two different noises to each original image in the power image data set to obtain a plurality of noisy seed images; The processing module is further used to input each of the noisy seed images into a generator of a generative adversarial network to generate an adversarial sample image corresponding to each of the noisy seed images, and input each of the adversarial sample images into a discriminator of the generative adversarial network to obtain a predicted category of each of the adversarial sample images; A determination module, configured to determine an evaluation index value corresponding to the generative adversarial network based on the predicted category of each of the adversarial sample images and the actual category of the original image corresponding to each of the adversarial sample images; An updating module is used to iteratively update the generative adversarial network of the (i+1)th iteration based on the evaluation index value determined in the i-th iteration and the multiple adversarial sample images generated, until a preset condition for stopping the generation of adversarial sample images is met, and the discriminator of the generative adversarial network of the last iteration is used as the power image recognition model for identifying the target power image; wherein i is a positive integer greater than or equal to 1.

8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Medical image classification-oriented adversarial sample generation method and system

    CN110516695A

Cited By

  • Method and apparatus for training power adversarial sample image recognition model, device, and storage medium

    WO2026118496A1