Electric power inspection system-oriented confrontation sample generation method and device

By optimizing the initial patch based on cosine loss and pixel loss in the power inspection system, combined with the spatial transformation network and the generative adversarial network, high-quality adversarial samples are generated, which solves the problems of low adversarial sample generation quality and high computational consumption in the existing technology. Improved system accuracy and stability.

CN118762249APending Publication Date: 2024-10-11STATE GRID HEBEI ENERGY TECH SERVICE CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410851734.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Existing adversarial sample generation methods have shortcomings in low generation quality, insufficient diversity, and high consumption of computing resources. Especially when facing power inspection systems, physical constraints are ignored, resulting in the generated adversarial samples being infeasible or dangerous.

Method used

By selecting the target attack area in the original power inspection image, the initial patch is obtained, and iterative optimization is performed based on cosine loss and pixel loss to generate an adversarial patch for generating adversarial samples. The spatial transformation network and the generative adversarial network are used to ensure the adversarial samples. Consistency and disorientation of physical constraints.

Benefits of technology

The generated adversarial samples are of high quality and highly confusing, and are difficult to be detected by the model, which improves the accuracy, reliability and stability of the power inspection system. It can simulate actual attack scenarios more realistically and help the system detect and evaluate deception. enter.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762249A_ABST
    Figure CN118762249A_ABST
Patent Text Reader

Abstract

The invention provides a confrontation sample generation method and device for an electric power inspection system, and belongs to the technical field of artificial intelligence and information security. The method comprises the following steps: selecting a target attack area in an original electric power inspection image; obtaining an initial patch; adding the initial patch to a target attack area of the original electric power inspection image to obtain a simulation image corresponding to the original electric power inspection image; and performing iterative optimization on the initial patch based on the cosine loss and the pixel loss of the analog image and the original electric power inspection image to obtain an adversarial patch for generating an adversarial sample. According to the method, the high-quality adversarial patch can be generated, and the high-quality adversarial sample can be obtained by applying the adversarial patch to the original sample image. By generating a confrontation sample, the performance of the system facing deceptive input is detected and evaluated, and the accuracy, reliability and stability of the electric power inspection system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence and information security technology, and in particular to a method and device for generating adversarial samples for a power inspection system. Background Art

[0002] Adversarial examples refer to input data that can deceive machine learning models after specific perturbations or modifications. However, existing machine learning models tend to be highly robust to adversarial examples, that is, they can still maintain high accuracy when facing adversarial examples.

[0003] Although adversarial sample generation methods are effective in improving model robustness and security, there are still some shortcomings and challenges. First, some adversarial sample generation methods may generate adversarial samples of low quality or lack of diversity. This may cause the generated adversarial samples to be easily detected by the model or fail to effectively confuse the model. Second, some adversarial sample generation methods require a lot of computing resources and time to generate adversarial samples. This makes it difficult to generate large-scale adversarial samples in practical applications and increases the overhead and latency of the system. Finally, in some application areas, such as medical, industrial control, and autonomous driving, the generation of adversarial samples must take into account physical constraints. However, current adversarial sample generation methods often ignore this point, resulting in the generated adversarial samples being infeasible or dangerous when facing power inspection systems. Summary of the invention

[0004] The embodiments of the present invention provide a method and device for generating adversarial samples for a power inspection system to solve the problem of generating effective adversarial samples.

[0005] In a first aspect, an embodiment of the present invention provides a method for generating adversarial samples for a power inspection system, comprising:

[0006] Select the target attack area in the original power inspection image;

[0007] Get the initial patch;

[0008] Adding the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image;

[0009] Based on the cosine loss and pixel loss of the simulated image and the original power inspection image, the initial patch is iteratively optimized to obtain the adversarial patch used to generate adversarial samples.

[0010] In a possible implementation, the initial patch is added to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image, including:

[0011] Perform out-of-plane bending and pitch rotation on the initial patch to obtain the initial patch after affine transformation;

[0012] Projecting the affine transformed initial patch onto the target attack area of ​​the original power inspection image to obtain an initial patch image;

[0013] The initial patch image is processed for spatial invariance based on the spatial transformation network model to obtain a simulated image corresponding to the original power inspection image.

[0014] In a possible implementation, based on the cosine loss and pixel loss of the simulated image and the original power inspection image, the initial patch is iteratively optimized to obtain an adversarial patch for generating adversarial samples, including:

[0015] The parameters of the initial patch are adjusted to obtain multiple iterative simulated images;

[0016] For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated;

[0017] A target simulated image is selected from the simulated images of each iteration based on cosine loss and pixel loss, and the initial patch in the target simulated image is used as an adversarial patch for generating adversarial samples.

[0018] In a possible implementation, for each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated, including:

[0019] Extract feature vectors of original power inspection images and simulated images of each iteration based on the trained Transform classification model;

[0020] For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated based on the feature vector of the iterative simulation image and the feature vector of the original power inspection image.

[0021] In a possible implementation, a target simulated image is selected from simulated images of each iteration based on cosine loss and pixel loss, and an initial patch in the target simulated image is used as an adversarial patch for generating an adversarial sample, including:

[0022] A loss function based on cosine loss and pixel loss is constructed. Based on the loss function, a target simulated image is selected from the simulated images of each iteration, and the initial patch in the target simulated image is used as the adversarial patch for generating adversarial samples. The loss function is:

[0023] L final (x, a) = L sim(x, a)+λ·TV(x)

[0024] L sim (x, a) = cos(e x , e a )

[0025]

[0026] Among them, L final (x, a) is the loss function value based on cosine loss and pixel loss between the iterative simulated image x and the original power inspection image a, L sim (x, a) is the cosine loss between the iterative simulated image x and the original power inspection image a, TV(x) is the pixel loss of the iterative simulated image x, λ is the weight, e x is the feature vector of the iterative simulated image x, e a is the feature vector of the original power inspection image a, x i,j is the pixel value of the pixel point in the iterative simulated image, and i, j are the coordinates of the pixel point in the iterative simulated image.

[0027] In a possible implementation, the parameters of the initial patch include projection parameters, resolution, and RGB values; the parameters of the simulated image are adjusted to obtain multiple iterative simulated images, including:

[0028] The projection parameters, resolution and RGB value of the initial patch are adjusted by using a gradient descent algorithm to obtain multiple iterative patches; wherein each iterative patch corresponds to an iterative simulated image.

[0029] In a possible implementation, it is characterized in that obtaining the initial patch includes:

[0030] Based on the generative adversarial network, the perceptual loss function, the adversarial loss function and the physical constraint loss function, a patch image similar to the original power inspection image is generated;

[0031] The area in the patch image corresponding to the target attack area is selected as the initial patch.

[0032] In a possible implementation, it is characterized in that selecting a target attack area in an original power inspection image includes:

[0033] In the original power inspection image, the area where the preset category of equipment is located is identified as the target attack area.

[0034] In a second aspect, an embodiment of the present invention provides an adversarial sample generation device for a power inspection system, comprising:

[0035] A selection module is used to select a target attack area in the original power inspection image;

[0036] Acquisition module, used to obtain the initial patch;

[0037] An adding module is used to add the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image;

[0038] The optimization module is used to iteratively optimize the initial patch based on the cosine loss and pixel loss of the simulated image and the original power inspection image to obtain the adversarial patch for generating adversarial samples.

[0039] The embodiment of the present invention provides an adversarial sample generation method and device for an electric power inspection system. Iterative optimization is performed through cosine loss and pixel loss initial patches. The use of cosine loss function can improve the obfuscation of adversarial samples and make them more difficult to be detected by the model. The optimization process adjusts the characteristics of adversarial samples by minimizing cosine similarity to make them more similar to the original samples. Pixel loss can improve the visual quality of adversarial samples and reduce noise and discontinuity. This helps to make adversarial samples more realistic and more difficult to be detected by the model. The present invention can generate high-quality adversarial patches, which can be used in the original sample images to obtain high-quality adversarial samples. By generating adversarial samples, the performance of the detection and evaluation system when facing deceptive inputs is improved, thereby improving the accuracy, reliability and stability of the electric power inspection system. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0041] Figure 1 It is a flowchart of an implementation of an adversarial sample generation method for a power inspection system provided by an embodiment of the present invention;

[0042] Figure 2 is a flowchart of an implementation of generating an adversarial patch provided by an embodiment of the present invention;

[0043] Figure 3 is a flowchart of optimizing the initial patch provided by an embodiment of the present invention;

[0044] Figure 4 It is a structural schematic diagram of an adversarial sample generation device for a power inspection system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0046] In order to make the purpose, technical solutions and advantages of the present invention more clear, specific embodiments will be described below in conjunction with the accompanying drawings.

[0047] Figure 1 The implementation flow chart of the adversarial sample generation method for the power inspection system provided by the embodiment of the present invention is described in detail as follows:

[0048] Step 101: Select a target attack area in an original power inspection image.

[0049] In this embodiment, the original power inspection image is collected by the intelligent inspection system. The intelligent inspection system is a technical application based on artificial intelligence and visual deep learning algorithms, which is used to realize the status monitoring and inspection of power equipment. It uses video monitoring equipment and monitoring robots and other equipment to collect image data, and uses artificial intelligence visual deep learning algorithms to analyze and identify images, so as to realize real-time monitoring of equipment status and automation of inspection tasks.

[0050] In addition, after the original power inspection images are acquired, the original power inspection images may be screened, for example, only power inspection images with uniform light are selected.

[0051] In a possible implementation, it is characterized in that selecting a target attack area in an original power inspection image includes:

[0052] In the original power inspection image, the area where the preset category of equipment is located is identified as the target attack area.

[0053] In this embodiment, after the original power inspection image is determined, the target area to be attacked is determined, that is, set as the target attack area. Optionally, the target attack area can be a specific object or area in the original power inspection image, and the device name or coordinates of the target attack area can be pre-set.

[0054] Step 102, obtaining an initial patch.

[0055] In this embodiment, the initialization patch can be generated using the AdvHat (Adversarial Haze) initialization method, and the initialization patch is adversarial, that is, it can deceive the target detection model when added to the original power inspection image. Among them, the target detection model can be a deep learning model for image detection. Build and train the target detection model to verify whether the generated adversarial samples can effectively confuse the model. The AdvHat framework combines the ideas of generative adversarial networks GANs and gradient masks to generate adversarial samples by adding tiny perturbations that are invisible to the human eye to the input data. These adversarial samples can deceive the power inspection model, causing it to make misjudgments or missed detections, and help evaluate and improve the robustness and security of machine learning models.

[0056] AdvHat is a method for generating adversarial samples that considers physical constraints. It focuses on solving the problem of haze in images. In the real world, due to particulate matter and humidity in the atmosphere, distant objects will appear hazy, affecting the quality and visibility of the image. The goal of AdvHat to generate adversarial samples is to make the model produce incorrect predictions when processing haze images.

[0057] The principle of AdvHat method is as follows:

[0058] 1. Physical constraint modeling: AdvHat simulates the fogging effect by modeling the physical properties of the fogging phenomenon, such as the light propagation model and the atmospheric scattering model. These physical models describe the propagation and scattering process of light in the atmosphere, thereby generating adversarial samples similar to real fogged images.

[0059] 2. Adversarial sample generation: The process of generating adversarial samples uses a generative adversarial network (GAN). GAN consists of two parts: the generator and the discriminator. The generator tries to generate realistic fogged images, while the discriminator evaluates the difference between the generated images and the real fogged images. Through the adversarial process of training the generator and the discriminator, AdvHat is able to generate more confusing and realistic adversarial samples.

[0060] 3. Loss function design: AdvHat uses multiple loss functions to optimize the generation process of adversarial samples. These include perceptual loss function, adversarial loss function, and physical constraint loss function. The perceptual loss function is used to maintain the consistency of the generated adversarial samples with the original images at the feature level. The adversarial loss function is used to encourage the generated adversarial samples to deceive the discriminator, making it unable to distinguish between adversarial samples and real foggy images. The physical constraint loss function is used to ensure the consistency of the generated adversarial samples with the real foggy images in terms of physical constraints, such as lighting conditions and scattering effects.

[0061] Step 103 : adding the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image.

[0062] In this embodiment, patches can be added to the target attack area through affine transformation, and spatial transformer networks (STN) are used to obtain spatially invariant results for common affine transformations, simulating the appearance of deployed patch stickers in real scenes in the image.

[0063] Step 104 , based on the cosine loss and pixel loss of the simulated image and the original power inspection image, the initial patch is iteratively optimized to obtain an adversarial patch for generating adversarial samples.

[0064] In this embodiment, in the process of generating an adversarial patch for generating an adversarial sample, an optimization algorithm can be used to optimize the initial patch to minimize the impact of the initial patch on the target detection model, so that the patch can deceive the model with minimal changes while keeping it invisible to the human eye as much as possible. Optionally, the above optimization algorithm can be a gradient descent algorithm.

[0065] The optimized patch is then added to the target attack area in the original power inspection image, ensuring that the patch blends in with the rest of the image to avoid arousing suspicion.

[0066] For details, please refer to Figure 2 , Figure 2 A flowchart for generating an adversarial patch provided in this embodiment.

[0067] After obtaining the adversarial patch used to generate adversarial samples, the modified image can also be used to test the object detection model to determine whether the patch can successfully deceive the model to incorrectly detect the object or ignore the object.

[0068] The embodiment of the present invention performs iterative optimization through cosine loss and pixel loss initial patches. The use of cosine loss function can improve the obfuscation of adversarial samples, making them more difficult to be detected by the model. The optimization process adjusts the characteristics of adversarial samples by minimizing cosine similarity to make them more similar to the original samples. Pixel loss can improve the visual quality of adversarial samples and reduce noise and discontinuity. This helps to make adversarial samples more realistic and more difficult to be detected by the model. The present invention can generate high-quality adversarial patches, and the adversarial patches can be used in the original sample images to obtain high-quality adversarial samples. By generating adversarial samples, the performance of the detection and evaluation system when facing deceptive inputs is improved, and the accuracy, reliability and stability of the power inspection system are improved.

[0069] In a possible implementation, the initial patch is added to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image, including:

[0070] Perform out-of-plane bending and pitch rotation on the initial patch to obtain the initial patch after affine transformation;

[0071] Projecting the affine transformed initial patch onto the target attack area of ​​the original power inspection image to obtain an initial patch image;

[0072] The initial patch image is processed for spatial invariance based on the spatial transformation network model to obtain a simulated image corresponding to the original power inspection image.

[0073] In this embodiment, the deformation process can be divided into two steps: out-of-plane bending of the patch and pitch rotation of the patch.

[0074] The out-of-plane bending is simulated as a parabolic transformation in 3D space, which maps the point with initial coordinates (x, y, 0) to a new point with coordinates (x', y, z'). The new point is located at the equation z = a*x 2 The origin of all axes is in the middle of the patch. After this transformation, the new z' (out-of-plane) coordinate of each point in the patch is equal to a·x' 2 . And this formula ensures that the geometric length of the patch does not change.

[0075]

[0076] Here, in order to be more robust in the real world, the generated position is slightly perturbed during each training process to ensure that attacks can be performed at similar positions.

[0077] Specifically, the obtained patch is projected onto the device image using a spatial transformation layer (STL). During the projection process, the parameters of the projection can be slightly modified. It is critical to project the patch onto a high-quality image. In the Transformer system, the image interpolation method that uses the values ​​of neighboring pixels to apply and create a device standard template is used. The RGB values ​​on the patch boundaries are different from the actual RGB values ​​because they also use the values ​​of device pixels.

[0078] In a possible implementation, based on the cosine loss and pixel loss of the simulated image and the original power inspection image, the initial patch is iteratively optimized to obtain an adversarial patch for generating adversarial samples, including:

[0079] The parameters of the initial patch are adjusted to obtain multiple iterative simulated images;

[0080] For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated;

[0081] A target simulated image is selected from the simulated images of each iteration based on cosine loss and pixel loss, and the initial patch in the target simulated image is used as an adversarial patch for generating adversarial samples.

[0082] In this embodiment, the process of optimizing the patch is shown in Figure 3 ,The original power inspection pictures and simulated images are respectively passed into the Transformer model to obtain the embedding of each image, and the patch color is continuously optimized iteratively until the attack is completed.

[0083] The cosine loss of the real scene and the patched scene is calculated as the optimization indicator. Then the pixel difference between the feature map of the patched image and the unpatched image is determined by the Transformer classification model.

[0084] At the same time, a TV loss is constructed to prevent the color mutation of the patch, and finally an attackable patch is constructed through iterative optimization.

[0085] A batch of images obtained through multiple parameter adjustments are fed into the input of the Transformer. The first loss to be minimized is to get the embedding e of the image x and some anchor embeddings a The cosine similarity between is expressed as:

[0086]

[0087] In the process of optimizing the patch, considering that the area of ​​the patch in the simulated image accounts for a small proportion, most of the areas of the simulated images of each iteration are the same as those of the original power inspection image. The cosine similarities of the simulated images of different iterations and the original power inspection image are small, which is not conducive to optimization. For this, it is also possible to only calculate the cosine similarity of the target attack area in the iterative simulated image and the original power inspection image, and simplify the calculation process by using the difference between the cosine similarities.

[0088] Considering the problem of preventing patch color mutation, we also need to minimize the total variation loss function TV loss, which is expressed as:

[0089]

[0090] The final loss function is the weighted sum of the first two losses, expressed as:

[0091]

[0092] In a possible implementation, for each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated, including:

[0093] Extract feature vectors of original power inspection images and simulated images of each iteration based on the trained Transform classification model;

[0094] For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated based on the feature vector of the iterative simulation image and the feature vector of the original power inspection image.

[0095] In this embodiment, the Transform classification model can be trained using power inspection images, so that the trained Transform classification model has faster and more accurate feature extraction capabilities when performing feature extraction on power inspection images and simulation images.

[0096] In a possible implementation, a target simulated image is selected from simulated images of each iteration based on cosine loss and pixel loss, and an initial patch in the target simulated image is used as an adversarial patch for generating an adversarial sample, including:

[0097] A loss function based on cosine loss and pixel loss is constructed. Based on the loss function, a target simulated image is selected from the simulated images of each iteration, and the initial patch in the target simulated image is used as the adversarial patch for generating adversarial samples. The loss function is:

[0098] L final (x, a) = L sim (x, a)+λ·TV(x)

[0099] L sim (x, a) = cos(e x , e a )

[0100]

[0101] Among them, L final (x, a) is the loss function value based on cosine loss and pixel loss between the iterative simulated image x and the original power inspection image a, L sim (x, a) is the cosine loss between the iterative simulated image x and the original power inspection image a, TV(x) is the pixel loss of the iterative simulated image x, λ is the weight, e x is the feature vector of the iterative simulated image x, e a is the feature vector of the original power inspection image a, x i,jis the pixel value of the pixel point in the iterative simulated image, and i, j are the coordinates of the pixel point in the iterative simulated image.

[0102] In this embodiment, the cosine loss function optimizes the generation process by minimizing the cosine similarity between the adversarial sample and the original sample. Cosine similarity measures the similarity between two vectors. When the cosine similarity between the adversarial sample and the original sample is high, they are closer in the feature space, thereby improving the effectiveness of the adversarial sample.

[0103] Using the cosine loss function can improve the confusion of adversarial examples, making them more difficult to be detected by the model. The optimization process adjusts the features of the adversarial examples to make them more similar to the original examples by minimizing the cosine similarity.

[0104] Total Variation Loss is another commonly used loss function. It promotes smoothness by minimizing the difference between pixels in adversarial examples. The total variation is the sum of the differences between adjacent pixels in an image. By minimizing the total variation, noise and discontinuities in adversarial examples can be reduced, making them closer to real-world images.

[0105] Using the total variation loss function can improve the visual quality of adversarial examples and reduce noise and discontinuities. This helps make adversarial examples more realistic and more difficult for models to detect.

[0106] In a possible implementation, the parameters of the initial patch include projection parameters, resolution, and RGB values; the parameters of the simulated image are adjusted to obtain multiple iterative simulated images, including:

[0107] The projection parameters, resolution and RGB value of the initial patch are adjusted by using a gradient descent algorithm to obtain multiple iterative patches; wherein each iterative patch corresponds to an iterative simulated image.

[0108] In this embodiment, the obtained image is projected onto a high-quality inspection image of the power equipment, and the perturbation of the projection parameters is small to make the attack more robust. Determine the parameters of the optimization algorithm, such as the learning rate, the number of iterations, etc., which will affect the speed and results of the optimization process; then, add the patch to the target image, and input the image into the target detection model for prediction. Calculate the loss function of the target detection model, measure the impact of the patch on the model, use an optimization algorithm (such as gradient descent) to minimize the loss function, and adjust the pixel value of the patch, and iterate this process until the predetermined number of iterations is reached or the conditions for the attack to succeed are met. Finally, when the conditions for the attack to succeed are met, stop the iteration and consider the attack to be completed.

[0109] Calculate the cosine loss of the real scene and the scene with the patch as the optimization metric, use an optimization algorithm (such as gradient descent) to minimize the cosine loss, and adjust the color of the patch. Iterate this process repeatedly until the predetermined number of iterations is reached or the attack success condition is met. Then, define the conditions for a successful attack, such as the target detection model mistakenly detecting the area in the patch as a target object. This condition can be determined based on the prediction results or evaluation indicators of the model. Finally, when the conditions for a successful attack are met, stop the iteration and consider the attack to be complete. If the number of iterations reaches the predetermined upper limit without meeting the success condition, consider adjusting the optimization parameters or trying other methods to improve the attack effect.

[0110] In a possible implementation, it is characterized in that obtaining the initial patch includes:

[0111] Based on the generative adversarial network, the perceptual loss function, the adversarial loss function and the physical constraint loss function, a patch image similar to the original power inspection image is generated;

[0112] The area in the patch image corresponding to the target attack area is selected as the initial patch.

[0113] In this embodiment, GAN is a powerful generative model consisting of a generator and a discriminator. The generator attempts to generate realistic adversarial samples, while the discriminator evaluates the authenticity of the adversarial samples. By training the adversarial generative network, the quality of adversarial samples can be improved and the computing resources and time required for the generation process can be reduced. Transfer learning uses the feature extraction capabilities of an already trained model and applies it to adversarial sample generation. By leveraging the knowledge of a pre-trained model, the computational cost of adversarial sample generation can be reduced.

[0114] The generation of adversarial samples must take physical constraints into account, which means that when generating adversarial samples, it is necessary to consider consistency with real-world physical conditions. This is because in real-world scenarios, machine learning models are usually subject to various physical constraints and restrictions, such as lighting conditions, material properties, camera parameters, etc. If the generated adversarial samples are inconsistent with real physical conditions, then these adversarial samples may fail or not be transferable in practical applications.

[0115] The initial patch in this embodiment can be generated in two ways: 1. Physical constraint modeling: Physically modeling the target area, such as using computer-aided design software for modeling and rendering, to generate a sticker patch with physical constraints. 2. GAN network generation: Generate an image similar to the original image using a generative adversarial network (GAN), and then select the corresponding area from the generated image as a patch. This method can generate patches with more complex features.

[0116] Regardless of the method used to generate the initial patch, it can be further adjusted and optimized through methods such as physical constraints and generating adversarial samples to increase the misleadingness and detection difficulty of the adversarial samples.

[0117] Compared with the prior art, the technical solution provided by the embodiment of the present application has the following beneficial effects:

[0118] In terms of performance, the performance of the power inspection system can be improved, making it more robust and resistant to interference. By generating adversarial samples, this method can detect and evaluate the performance of the system when faced with deceptive inputs and help the system improve. This helps to improve the accuracy, reliability and stability of the power inspection system.

[0119] In terms of quality, the generated adversarial samples can simulate actual attack scenarios and have a high degree of deception. These samples are similar to the original samples in appearance, but can mislead the decision-making of the power inspection system and produce wrong results. By using these adversarial samples for testing and evaluation, the weaknesses and vulnerabilities of the system can be discovered, and methods for improving the quality of the system can be provided.

[0120] In terms of energy consumption, it can help reduce the energy consumption of the power inspection system. By generating adversarial samples for system testing, we can find out the energy consumption of the system when processing adversarial inputs and make corresponding optimizations. This helps improve the energy efficiency of the system, reduce energy costs, and extend the battery life of power inspection equipment.

[0121] In terms of operation and control, automated algorithms and technologies can be used to generate adversarial samples, which simplifies the operation process and improves the accuracy of control. The process of generating adversarial samples can be implemented through programming, making it possible to generate a large number of samples quickly and flexibly. This advantage helps to improve the efficiency and operability of the power inspection system.

[0122] In terms of ease of use, once adversarial samples are generated, they can be directly applied to the testing and evaluation of the power inspection system without large-scale modification or reconstruction of the system. All that is needed is to input the adversarial samples into the system and observe its response. This makes the use of the power inspection system more convenient and practical.

[0123] In summary, the adversarial sample generation method provided in this application has the advantages of improving system performance, improving quality, reducing energy consumption, simplifying operation and control, and being easy to use in power inspection. By generating deceptive adversarial samples, this method helps to evaluate the robustness of the system, discover system weaknesses, and provide a method to improve system security and reliability.

[0124] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean 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 embodiment of the present invention.

[0125] The following is an embodiment of the device of the present invention. For details not described in detail therein, reference may be made to the corresponding method embodiment described above.

[0126] Figure 4 The structure diagram of the adversarial sample generation device for the power inspection system provided by an embodiment of the present invention is shown. For the convenience of explanation, only the part related to the embodiment of the present invention is shown, which is described in detail as follows:

[0127] like Figure 4 As shown, the adversarial sample generation device 4 for the power inspection system includes:

[0128] A selection module 41 is used to select a target attack area in the original power inspection image;

[0129] An acquisition module 42, used for acquiring an initial patch;

[0130] An adding module 43 is used to add the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image;

[0131] The optimization module 44 is used to iteratively optimize the initial patch based on the cosine loss and pixel loss of the simulated image and the original power inspection image to obtain an adversarial patch for generating an adversarial sample.

[0132] In a possible implementation, the adding module 43 is specifically used for:

[0133] Perform out-of-plane bending and pitch rotation on the initial patch to obtain the initial patch after affine transformation;

[0134] Projecting the affine transformed initial patch onto the target attack area of ​​the original power inspection image to obtain an initial patch image;

[0135] The initial patch image is processed for spatial invariance based on the spatial transformation network model to obtain a simulated image corresponding to the original power inspection image.

[0136] In a possible implementation, the optimization module 44 is specifically used to:

[0137] The parameters of the initial patch are adjusted to obtain multiple iterative simulated images;

[0138] For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated;

[0139] A target simulated image is selected from the simulated images of each iteration based on cosine loss and pixel loss, and the initial patch in the target simulated image is used as an adversarial patch for generating adversarial samples.

[0140] In a possible implementation, the optimization module 44 is specifically used to:

[0141] Extract feature vectors of original power inspection images and simulated images of each iteration based on the trained Transform classification model;

[0142] For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated based on the feature vector of the iterative simulation image and the feature vector of the original power inspection image.

[0143] In a possible implementation, the optimization module 44 is specifically used to:

[0144] A loss function based on cosine loss and pixel loss is constructed. Based on the loss function, a target simulated image is selected from the simulated images of each iteration, and the initial patch in the target simulated image is used as the adversarial patch for generating adversarial samples. The loss function is:

[0145] L final (x, a) = L sim (x, a)+λ·TV(x)

[0146] L sim (x, a) = cos(e x , e a )

[0147]

[0148] Among them, L final (x, a) is the loss function value based on cosine loss and pixel loss between the iterative simulated image x and the original power inspection image a, L sim (x, a) is the cosine loss between the iterative simulated image x and the original power inspection image a, TV(x) is the pixel loss of the iterative simulated image x, λ is the weight, e x is the feature vector of the iterative simulated image x, e a is the feature vector of the original power inspection image a, x i,j is the pixel value of the pixel point in the iterative simulated image, and i, j are the coordinates of the pixel point in the iterative simulated image.

[0149] In a possible implementation, the parameters of the initial patch include projection parameters, resolution, and RGB values; the optimization module 44 is specifically used to:

[0150] The projection parameters, resolution and RGB value of the initial patch are adjusted by using a gradient descent algorithm to obtain multiple iterative patches; wherein each iterative patch corresponds to an iterative simulated image.

[0151] In a possible implementation, it is characterized in that the acquisition module 42 is specifically used to:

[0152] Based on the generative adversarial network, the perceptual loss function, the adversarial loss function and the physical constraint loss function, a patch image similar to the original power inspection image is generated;

[0153] The area in the patch image corresponding to the target attack area is selected as the initial patch.

[0154] In a possible implementation, it is characterized in that the selection module 41 is specifically used for:

[0155] In the original power inspection image, the area where the preset category of equipment is located is identified as the target attack area.

[0156] The embodiment of the present invention performs iterative optimization through cosine loss and pixel loss initial patches. The use of cosine loss function can improve the obfuscation of adversarial samples, making them more difficult to be detected by the model. The optimization process adjusts the characteristics of adversarial samples by minimizing cosine similarity to make them more similar to the original samples. Pixel loss can improve the visual quality of adversarial samples and reduce noise and discontinuity. This helps to make adversarial samples more realistic and more difficult to be detected by the model. The present invention can generate high-quality adversarial patches, and the adversarial patches can be used in the original sample images to obtain high-quality adversarial samples. By generating adversarial samples, the performance of the detection and evaluation system when facing deceptive inputs is improved, and the accuracy, reliability and stability of the power inspection system are improved.

[0157] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0158] Those of ordinary skill in the art will appreciate that the templates, units, and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0159] If the module / unit is implemented in the form of 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 implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned embodiments of the adversarial sample generation method for the power inspection system. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium.

[0160] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for generating adversarial samples for a power inspection system, characterized in that: include: Select the target attack area in the original power inspection image; Get the initial patch; Adding the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image; Based on the cosine loss and pixel loss of the simulated image and the original power inspection image, the initial patch is iteratively optimized to obtain an adversarial patch for generating an adversarial sample.

2. The adversarial sample generation method for a power inspection system according to claim 1, characterized in that: The step of adding the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image includes: Performing out-of-plane bending and pitch rotation on the initial patch to obtain an affine transformed initial patch; Projecting the affine-transformed initial patch onto the target attack area of ​​the original power inspection image to obtain an initial patch image; The initial patch image is processed for spatial invariance based on a spatial transformation network model to obtain a simulated image corresponding to the original power inspection image.

3. The adversarial sample generation method for a power inspection system according to claim 2, characterized in that: The iterative optimization of the initial patch based on the cosine loss and pixel loss of the simulated image and the original power inspection image to obtain an adversarial patch for generating an adversarial sample includes: Adjusting the parameters of the initial patch to obtain multiple iterative simulated images; For each iterative simulation image, calculating the cosine loss and pixel loss between the iterative simulation image and the original power inspection image; A target simulated image is selected from simulated images of each iteration based on cosine loss and pixel loss, and an initial patch in the target simulated image is used as an adversarial patch for generating adversarial samples.

4. The adversarial sample generation method for a power inspection system according to claim 3 is characterized in that: The step of calculating the cosine loss and pixel loss between the simulated image of each iteration and the original power inspection image includes: Extracting feature vectors of the original power inspection image and the simulated images of each iteration based on the trained Transform classification model; For each iterative simulation image, the cosine loss and pixel loss between the iterative simulation image and the original power inspection image are calculated based on the feature vector of the iterative simulation image and the feature vector of the original power inspection image.

5. The adversarial sample generation method for a power inspection system according to claim 3, characterized in that: The method of selecting a target simulated image from simulated images of each iteration based on cosine loss and pixel loss, and using an initial patch in the target simulated image as an adversarial patch for generating an adversarial sample, comprises: A loss function based on cosine loss and pixel loss is constructed, a target simulated image is selected from each iterative simulated image based on the loss function, and an initial patch in the target simulated image is used as an adversarial patch for generating adversarial samples; wherein the loss function is: THE final (x,a)=L sim (x,a)+λ·TV(x) THE sim (x,a)=cos(e x ,And a ) Among them, L final (x, a) is the loss function value based on cosine loss and pixel loss between the iterative simulated image x and the original power inspection image a, L sim (x,a) is the cosine loss between the iterative simulated image x and the original power inspection image a, TV(x) is the pixel loss of the iterative simulated image x, λ is the weight, e x is the feature vector of the iterative simulated image x, e a is the feature vector of the original power inspection image a, x i,j is the pixel value of the pixel point in the iterative simulated image, and i, j are the coordinates of the pixel point in the iterative simulated image.

6. The adversarial sample generation method for a power inspection system according to claim 3, characterized in that: The parameters of the initial patch include projection parameters, resolution and RGB values; the parameters of the simulated image are adjusted to obtain multiple iterative simulated images, including: The projection parameters, resolution and RGB value of the initial patch are adjusted by using a gradient descent algorithm to obtain multiple iterative patches; wherein each iterative patch corresponds to an iterative simulated image.

7. The adversarial sample generation method for a power inspection system according to any one of claims 1 to 6, characterized in that: The obtaining of the initial patch comprises: Generate a patch image similar to the original power inspection image based on a generative adversarial network, a perceptual loss function, an adversarial loss function, and a physical constraint loss function; An area in the patch image corresponding to the target attack area is selected as an initial patch.

8. The adversarial sample generation method for a power inspection system according to any one of claims 1 to 6, characterized in that: The step of selecting a target attack area in the original power inspection image includes: In the original power inspection image, the area where the preset category of equipment is located is identified as the target attack area.

9. A device for generating adversarial samples for a power inspection system, characterized in that: include: A selection module is used to select a target attack area in the original power inspection image; Acquisition module, used to obtain the initial patch; An adding module, used for adding the initial patch to the target attack area of ​​the original power inspection image to obtain a simulated image corresponding to the original power inspection image; The optimization module is used to iteratively optimize the initial patch based on the cosine loss and pixel loss of the simulated image and the original power inspection image to obtain an adversarial patch for generating an adversarial sample.

10. The adversarial sample generation device for a power inspection system according to claim 9, characterized in that: The adding module is specifically used for: Performing out-of-plane bending and pitch rotation on the initial patch to obtain an affine transformed initial patch; Projecting the affine-transformed initial patch onto the target attack area of ​​the original power inspection image to obtain an initial patch image; The initial patch image is processed for spatial invariance based on a spatial transformation network model to obtain a simulated image corresponding to the original power inspection image.

Citation Information

Patent Citations

  • Image de-mesh method, storage medium

    CN109523478A

  • A model determination method and system

    CN111027628A

  • Patch attack resisting method for vehicle target detection model

    CN114168940A

  • Adversarial patch processing method, related device and storage medium

    CN117132851A

  • Anti-adversarial attack face recognition model training method and device based on immune system

    CN118135629A