A method and device for generating image adversarial samples based on regional information
By combining pixel and region-scale loss functions in the field of medical image segmentation, the problem of insufficient robustness of anti-sample attacks in medical image segmentation is solved, and stronger attack effect and smaller perturbation are achieved. , improves the stability of the model.
Patent Information
- Application Number
- CN202210388711.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-14
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-04-14
AI Technical Summary
The prior art has insufficient robustness of deep learning models against sample attacks in the field of medical image segmentation, and it is difficult to effectively evaluate model stability, resulting in potential medical risks and diagnostic errors.
A method of image adversarial sample generation based on region information is proposed. By combining the loss functions of pixel scale and region scale, interference values are calculated and iterative backpropagation is generated to generate adversarial samples that can effectively attack the deep learning model, improving the robustness of the model .
The effect of anti-attacks is significantly improved on the medical image segmentation task, showing stronger attack capabilities compared with traditional methods, and controlling the size of the perturbation, ensuring that it is small and not easy to detect, and improving the robustness of the model.
Smart Images

Figure CN114898091B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image segmentation, and in particular relates to a method and device for generating image adversarial samples based on region information. Background Art
[0002] Deep learning has made great achievements in the medical field, such as medical image segmentation, pathological tissue detection, medical image reconstruction, auxiliary disease diagnosis, etc. There is a popular theory that in order to reduce the huge labor costs of medical institutions (such as doctors, nurses, domain experts, etc.), people are trying to replace manual labor with fully automated deep learning models. However, in most medical scenarios, such as medical image segmentation tasks, only a small amount of data can be used as training data, while the relative deep learning model has extremely large parameters, which will cause the model to have a memory of the training data and have low predictability for test data or unknown data. At the same time, due to the low interpretability of deep learning models, it has been criticized as a "black box solution", and people have been unable to obtain the accurate operating logic of the neural network. This will be extremely fatal in the medical field, because the data obtained through medical equipment usually has a large amount of noise, which will cause unexplainable errors in the deep learning model, and in many cases will cause great interference to medical diagnosis. At the same time, recent studies have also shown that deep learning is easily affected by artificially created, imperceptible disturbances, such as adversarial attack samples, which will bring very large medical risks and cause irreversible consequences.
[0003] In order to prevent deep learning networks from causing potential dangers, a method is needed to evaluate the stability of deep learning models, such as their robustness in the face of attack samples. Recently, some adversarial sample generation methods have been proposed in the field of segmentation and used to evaluate the robustness of pre-trained deep learning models. For example, Fast Gradient Sign Method (FGSM) and Project Gradient Descend (PGD) are two widely used adversarial sample generation methods. However, FGSM only performs a single pixel-dimensional update along the gradient direction. Such attack methods often have limited effects on nonlinear models (such as most deep neural networks). Although PGD applies multi-step updates, it still has weak offensiveness in the field of image segmentation. At present, there is no better attack method for the field of image segmentation. Therefore, it is urgent to develop a more effective adversarial attack method for image segmentation, and on this basis, study corresponding defense measures to improve the robustness of the model. Summary of the invention
[0004] Purpose of the invention: In view of the shortcomings of the prior art, the present invention proposes a method and device for generating image adversarial samples based on regional information to improve the robustness of deep learning networks.
[0005] Technical solution: A method for generating image adversarial samples based on region information, comprising the following steps:
[0006] (1) Input a given image into a pre-trained deep neural network, and the deep neural network outputs the corresponding predicted image;
[0007] (2) Calculate the loss L between the predicted image and the target image at the regional scale RW , and calculate the loss L between the predicted image and the true label at the pixel level dice ;
[0008] (3) The gradient values of the two losses are calculated respectively and weightedly added to obtain the interference value, which is then added back to the original input image as noise, and the target adversarial sample is obtained through iteration.
[0009] Furthermore, the loss L between the predicted image and the target image is RW The calculation is as follows:
[0010]
[0011]
[0012] Where C is the number of targets in the input image X, and rrwmap is a label matrix generated by the input image, each element of which represents the area Ω from the pixel i at the corresponding position of the input image to its nearest target c. c Edge pixel b ic distance.
[0013] Furthermore, the loss L between the predicted image and the true label dice The calculation is as follows:
[0014]
[0015] Where N represents the number of pixels in the input image, p cn represents the predicted value of pixel n being classified as c, g cn Represents the label value of pixel n in category c.
[0016] Furthermore, the interference value is calculated as follows:
[0017]
[0018] Among them, r m represents the interference value of the mth iteration, P mrepresents the input image of the mth iteration, G is the label, G′ is the desired adversarial target, Indicates calculating the gradient value of the current image.
[0019] Furthermore, the method further comprises: performing Frobenius regularization on the interference value, Where γ is the value that determines the interference value r in each round m After one round of iteration, the input image P m Change to P m+1 =P m +r′ m .
[0020] Furthermore, the method further comprises: slicing the pixels after each round of interference to ensure that they fall within the interval [0,1], and the final total interference is r=∑ m r′ m .
[0021] Furthermore, the deep neural network adopts CE-Net or U-Net.
[0022] The present invention also provides a computer device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the method for generating image adversarial samples based on regional information are implemented as described above.
[0023] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for generating image adversarial samples based on regional information as described above are implemented.
[0024] Beneficial effects: The present invention uses a widely used loss function Dice Loss at the pixel scale, and applies disturbances by iterative back propagation, so that the deep learning model misclassifies each pixel in the image. At the same time, in order to further interfere with the pixels within the segmentation label, a loss function RegionLoss at the regional scale is used to deepen the interference weight of the pixels within the label, affecting the overall segmentation effect. Segmentation experiments on DRIVE and CELL datasets show that the attack effect of the method of the present invention on segmentation tasks has been significantly improved compared with traditional attack methods, while the disturbance to the image is minimal. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a flow chart of the method for generating image adversarial samples based on region information of the present invention. DETAILED DESCRIPTION
[0026] Unlike classification tasks, when attacking deep learning models, adversarial attack samples for segmentation need to make the model misidentify every pixel of the input image. To achieve this goal, the present invention uses a dense adversarial sample generation method based on regional information. In order to have a clearer understanding of the technical solution of the present invention, the relevant concepts involved are first introduced.
[0027] Adversarial samples: Adversarial samples are designed to add subtle disturbances that are not perceptible to the human eye to the image, causing the deep learning network to make incorrect predictions. The classifier of the deep learning network is set to F(X,θ), where X is the input image and θ is a trainable network parameter. For an input image with a given label Y, an adversarial sample X′=X+r can be generated, such that F(X,θ)=Y, F(X′,θ)=Y′, and Y′≠Y. At the same time, the disturbance r needs to be controlled within a relatively small range so that it is not easily detected by the human eye.
[0028] Dense Adversarial Generation (DAG): In the field of image segmentation, the purpose of adversarial attack is to make the pre-trained segmentation model make incorrect predictions for each pixel. At the pixel scale, DAG encourages the deep learning model to make incorrect segmentations by increasing the distance between the predicted value and the corresponding label value of each pixel and reducing the distance between the predicted value and the incorrect label value. Its loss function is It can be expressed by the following formula:
[0029]
[0030] in represents the segmentation target in the input image X, Indicates that for the target t c , is correctly classified into its corresponding correct label The predicted value of Indicates that for the target t c , is misclassified as its corresponding wrong label By shrinking the value of this loss function, the deep learning model will be encouraged to make incorrect predictions for every pixel.
[0031] In order to further improve the interference performance, this paper proposes a region-based dense adversarial generation method (RDAG). By combining the loss function of the region scale and the pixel scale, this adversarial generation method can simultaneously obtain the information of the input image in two dimensions and attack. Figure 1 , the adversarial sample generation method specifically includes the following steps:
[0032] (1) Input a given image into a pre-trained deep neural network, and the deep neural network outputs the corresponding prediction result. The deep neural network can be CE-Net or U-Net, which has better performance in medical image segmentation. The training of the neural network is not the core of the present invention and will not be described in detail here. Figure 1 As shown, a fundus retinal image is extracted by a neural network to obtain a predicted image.
[0033] (2) Calculate the loss REGION-WISE LOSS between the predicted image and the target image and the loss DICE LOSS between the predicted image and the real label. Here, the target image is the target image that the user expects to interfere with, such as Figure 1 As shown, it can be a completely black image, indicating that it is hoped that the network will no longer distinguish between background pixels and pixels to be segmented when predicting the input image. The true label refers to the label annotated by a doctor or expert based on the original input image.
[0034] The present invention adds region-wise loss on the basis of the above pixel scale. This loss function can be expressed by the following formula:
[0035]
[0036]
[0037] Where C is the number of targets in the input image X, that is, how many label categories need to be segmented in the input image; rrwmap is a label matrix generated by the input image, each element of which represents the area Ω from the pixel i at the corresponding position of the input image to its nearest target c. c Edge pixel b ic At the same time, in order to ensure the stability of the gradient sign during optimization, rrwmap sets all pixels outside the area to a constant value, which is set to 1 in the implementation of the present invention.
[0038] This adversarial sample generation method also improves the calculation of pixel scale and uses Dice Coefficient Loss to collect pixel scale information. It mainly calculates the degree of overlap between the label and the segmentation result generated by the deep learning network. The related loss function is expressed as follows:
[0039]
[0040] Where N is the number of pixels in the input image, p cn Indicates the predicted value of pixel n being classified as c, with a value of 0 to 1, g cn Represents the label value of pixel n in category c, and its value is 0 / 1.
[0041] (3) Calculate the gradient values of the two losses respectively and perform weighted addition to obtain the interference value, which is then added back to the original input image as noise. Perform T rounds of iterations to finally obtain the target adversarial sample.
[0042] The interference value r is the combined L dice and L RW The value of is obtained by reverse gradient calculation. At the mth iteration, the current input image (generated after m-1 iterations of interference) is obtained by P m It means that the interference r of this iteration m It is expressed by the following formula:
[0043]
[0044] Where G is the label, G′ is the adversarial target that the user wants the deep learning network output to be close to (such as a blank label), Indicates calculating the gradient value of the current image.
[0045] In order to limit the noise dimension so as to avoid significant differences between the adversarial sample and the original image and ensure the numerical stability of the interference, the present invention also gives the interference r m Frobenius regularization was performed Where γ is the factor that determines each round of interference r m The weight is usually set to 1. After one round of iteration, the input image P m Change to P m+1 =P m +r′ m .
[0046] In order to ensure that the disturbed pixels do not overflow, the present invention also performs slicing processing on each disturbed pixel to ensure that it falls within the interval [0,1]. The final total disturbance is r = ∑ m r′ m .
[0047] After T rounds of iterations, the target adversarial sample is finally obtained. When performing network prediction, its prediction performance is significantly reduced compared with the original input image without noise.
[0048] In order to verify the performance of the method of the present invention, the following experiment was conducted. The experiment used two public datasets DRIVE and CELL as test data. DRIVE is a fundus retinal image, in which the blood vessels are manually labeled by experts in related fields and are widely used in research on medical image segmentation. It consists of twenty training images and twenty test images. CELL is a subset of the NuCLS dataset, covering thirty pathological image slices of manually labeled cancerous cells, which we divided into twenty training images and ten test images. Both datasets were cropped to 448x448 size and preprocessed by random rotation, inversion, translation, etc.
[0049] The experiment uses CE-Net as the deep learning network, which has the current leading performance in the field of medical image segmentation. ADAM is used as the optimizer during training, and Dice loss is used for pre-training. At the same time, a dynamic learning rate is used to decay the learning rate every 10 epochs during the learning process to speed up the convergence. The Dice coefficient is used as an important indicator for evaluating the prediction accuracy of the model. At the same time, the structural similarity index (SSIM), mean squared error (MSE) and peak signal-to-noise ratio (PSNR) are used to assist in evaluating the attack capability of adversarial samples. In order to unify the degree of attack, the interference r is restricted. For an input image with K pixels, the interference degree p is defined as where r k To normalize the interference of each channel (an RGB image usually has three channels), the interference degree p of each pixel is set to 2.6e-3 (DRIVE) and 3.5e-3 (CELL).
[0050] Segmentation experiments were conducted on the DRIVE and CELL datasets, and the pre-trained model was attacked using the RDAG of the present invention and traditional attack methods. The results are shown in Table 1.
[0051] Table 1 Test results of DRIVE and CELL datasets on CE-Net
[0052]
[0053]
[0054] It can be clearly seen that when no attack was received, the pre-trained model produced very good segmentation predictions on both data sets (Dice coefficients were 0.7675 and 0.7736, respectively). Correspondingly, the RDAG method of the present invention has also achieved the most advanced attack effect at present. It can be seen that after our attack, the segmentation effect has dropped significantly, with the results being 0.0103 and 0.0945, respectively, significantly ahead of FGSM (0.6774 and 0.7372) and PGD (0.1804 and 0.3681). At the same time, it also surpassed the original DAG method (0.2411 and 0.2006). This proves that the attack effect of the RDAG method generated by the present invention by combining the pixel scale and the regional scale on the segmentation task has been significantly improved compared with the traditional attack method.
[0055] At the same time, the degree of disturbance generated is also an important indicator for evaluating the attack performance. SSIM, RMSE, and PSNR are used as standards to measure the degree of disturbance. As shown in Table 1, PSNR (42.809 and 36.748), SSIM (0.9673 and 0.9896) and RMSE (0.0073 and 0.0146) all show that the RDAG method of the present invention has a significant impact on the image segmentation effect, while also controlling the disturbance of the image within a very small range. Its disturbance size is smaller than that of the FGSM method that only uses a single iterative attack, but it produces a better attack effect than PGD and DAG with multiple iterative attacks, and its disturbance effect is so small that it cannot be detected by the human eye.
[0056] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices (systems), or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
Claims
1. A method for generating image adversarial samples based on region information, It is characterized in that The following steps are involved: (1) Input a given image into a pre-trained deep neural network, and the deep neural network outputs the corresponding predicted image; (2) Calculate the loss L between the predicted image and the target image at the regional scale RW , and calculate the loss L between the predicted image and the true label at the pixel level dice ; The loss L between the predicted image and the target image RW The calculation is as follows: Where C is the number of targets in the input image X, and rrwmap is a label matrix generated by the input image, each element of which represents the area Ω from the pixel i at the corresponding position of the input image to its nearest target c. c Edge pixel b ic distance; The loss L between the predicted image and the true label dice The calculation is as follows: Where N represents the number of pixels in the input image, p cn represents the predicted value of pixel n being classified as c, g cn Represents the label value of pixel n in category c; (3) The gradient values of the two losses are calculated respectively and weightedly added to obtain the interference value, which is then added back to the original input image as noise, and the target adversarial sample is obtained through iteration.
2. The method for generating image adversarial samples based on region information according to claim 1, It is characterized in that The interference value is calculated as follows: Among them, r m represents the interference value of the mth iteration, P m represents the input image of the mth iteration, G is the label, G′ is the desired adversarial target, Indicates calculating the gradient value of the current image.
3. The method for generating image adversarial samples based on region information according to claim 2, It is characterized in that The method further comprises: performing Frobenius regularization on the interference value, Where γ is the value that determines the interference value r in each round m After one round of iteration, the input image P m Change to P m+1 =P m +r′ m .
4. The method for generating image adversarial samples based on region information according to claim 3, It is characterized in that The method further includes: slicing the pixels after each round of interference to ensure that they fall within the interval [0,1], and the final total interference is r=∑ m r′ m .
5. The method for generating image adversarial samples based on region information according to claim 1, It is characterized in that The deep neural network adopts CE-Net or U-Net.
6. A computer device, It is characterized in that include: one or more processors; Memory; And one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the method for generating image adversarial samples based on region information are implemented as described in any one of claims 1-5.
7. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method for generating an image adversarial sample based on region information are implemented as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Fundus blood vessel image segmentation adversarial sample generation method and segmentation network security evaluation method
CN110503650A
Medical image segmentation method and system based on generative adversarial network, and electronic equipment
CN110503654A
An image processing method for combating attacks
CN111932646A
Adversarial sample generation method and system, computer equipment and storage medium
CN113780123A
Target detection attack method and device
CN114330652A
