Dual medical image encryption and decryption method based on generative adversarial and attention mechanism driving

Through the dual medical image encryption and decryption method driven by a generative adversarial and attention mechanism, the image style is optimized by generator and reconstructor, combined with the secondary encryption strategy, the existing chaotic encryption system has been solved, and the medical image encryption and decryption with high security is achieved with high security and high accuracy.

CN120408680APending Publication Date: 2025-08-01NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510614349.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The existing medical image encryption method based on chaotic encryption systems is complex in calculations and is difficult to resist differential attacks and select plaintext attacks, and is insufficient in security.

Method used

The dual medical image encryption and decryption method driven by generative adversity and attention mechanisms is adopted, and the network structure composed of generator, reconstructor and discriminator is used to convert plaintext images into ciphertext images through the generator, and the image style is optimized through the discriminator. The reconstructor reconstructs plaintext images, combining the secondary encryption strategy to improve security and decryption accuracy.

Benefits of technology

It improves the security and accuracy of medical image encryption, can effectively resist attacks, maintain the robustness and reliability of the encryption system, and ensures high similarity between ciphertext images and plaintext images and the retention of key organizational structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120408680A_ABST
    Figure CN120408680A_ABST
Patent Text Reader

Abstract

The invention discloses a dual medical image encryption and decryption method (EDG-Net) based on generative adversarial and attention mechanism driving, which is used for encrypting medical images. The method is composed of a generator, a reconstructor and two discriminators. According to the method, a medical image with clear organization structure information is converted into a ciphertext domain image through circular image translation work of generation, identification, reconstruction and identification, so that the encryption of the medical image is realized. The decryption process is completely the same as the encryption process, and only the data of the source domain and the target domain need to be exchanged. And finally, the EDG-Net adopts a secondary encryption strategy (DEDS), and the EDG-Net adopts a secondary encryption strategy (DEDS). In the encryption stage, a ciphertext image obtained after a medical image is encrypted through the EDG-Net for the first time replaces a ciphertext image obtained after a traditional method is adopted to serve as a ciphertext domain image label, encryption is conducted through the EDG-Net again, and a ciphertext of the EDG-Net obtained after secondary encryption serves as final output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms, belonging to the fields of computer medical image processing and information security. Background Art

[0002] Currently, the mainstream methods for medical image encryption and decryption are mainly encryption and decryption methods based on chaotic encryption systems. The encryption methods of medical image encryption systems based on chaos are mainly divided into scrambling or diffusion operations on the pixels of medical images. Scrambling encryption of medical images is to change the pixels of the original medical image by changing the pixel positions of the medical image through a chaotic system, so that the human eye cannot see or distinguish the tissue and pathological information of the medical image, thereby encrypting the medical image. Commonly used scrambling operations in chaotic image encryption technology include Arnold operation, Baker operation, and magic square operation.

[0003] Diffusion encryption of medical images is to use chaotic operations to generate random sequences and perform XOR and other arithmetic operations with the original medical image to change the pixels of the image, achieving the purpose of medical image encryption. The medical image encryption method based on the chaos principle generates chaotic sequences to participate in the image encryption process, and the encryption calculation process is too complex. Moreover, the calculation of the chaotic system cannot be parallelized during the encryption and decryption processes. Finally, the encryption methods and encryption processes of general medical image encryption systems based on chaos are single, and it is difficult to effectively resist attack methods such as differential attacks and chosen-plaintext attacks, resulting in a greater challenge to the security of medical image encryption systems. Summary of the Invention

[0004] The purpose of the present invention is to provide a dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms. The method consists of a generator, a reconstructor, and two discriminators. The first generator transforms the medical image from the plaintext image domain to the ciphertext image domain. The first discriminator is used to score the quality of the image translation from the plaintext domain to the ciphertext domain, and the generator optimizes the image style it generates based on the feedback of the discriminator. After the image is transformed from the plaintext domain to the ciphertext domain, the image in the ciphertext domain is reconstructed into a plaintext image by a reconstructor, and the similarity degree of the image distribution between the reconstructed image and the plaintext image is measured by the second discriminator to optimize the reconstructor. The encryption and decryption tasks of medical images are transformed into a task similar to medical image "translation". The sender converts the medical image with tissue structure information into an encrypted image with a ciphertext image style similar to a snowflake style, and the receiver decrypts the encrypted medical image by converting the source domain and the target domain with the help of a key, avoiding the direct exposure and leakage of the tissue structure of the patient's medical image.

[0005] The present invention adopts the following technical solutions to solve the above problems:

[0006] The present invention provides a dual medical image encryption and decryption method based on generative adversarial and attention mechanism, which can improve the security of medical image encryption and the accuracy of decryption. The method includes the following steps:

[0007] Step 1: Given a set of medical images as the plaintext image domain P, and then given a set of ciphertext label image domain C encrypted by various encryption methods, the plaintext domain images and the ciphertext domain images can alternately become the source domain and the target domain according to the encryption or decryption tasks.

[0008] Step 2: Train the generator G P→C An optimal mapping of; Specifically as follows, the generator G generates The empirical distribution of is matched with the ciphertext image c, thereby realizing the transformation from the plaintext image domain P to the ciphertext label image domain C;

[0009] Step 3, Generator G P→C According to the discriminator D C The feedback is used to optimize the image style generated by itself; specifically, the output image The pixel distribution style of the ciphertext image c is determined by the discriminator D C To determine whether they are the same, the discriminator D C Used to score the quality of image translation from plaintext to ciphertext and guide G P→C Optimize;

[0010] Step 4, Reconstructor G C→P Reconstruct the ciphertext domain image into the plaintext image;

[0011] Step 5, the second discriminator D P Measure the similarity between the reconstructed image and the plaintext image to optimize the reconstructor G C→P ;

[0012] In step 6, the sender gives a source domain image network parameter as the encryption and decryption key. The receiver receives the ciphertext and key, and inputs the ciphertext into the decryption network loaded with the network parameters to decrypt the medical image that can be used in clinical practice. EDG-Net adopts a secondary encryption strategy; specifically, in the encryption stage, the ciphertext image of the medical image that has been encrypted by EDG-Net for the first time replaces the ciphertext image encrypted by the traditional method as the ciphertext domain image label, and is encrypted again by EDG-Net. The ciphertext of the secondary encrypted EDG-Net is used as the final output.

[0013] Among them, the generator to be trained in step 2 is as follows: The generator consists of a downsampling module, residual blocks, a class activation map, residual blocks, and an upsampling module in sequence. The downsampling module consists of a convolutional kernel with a size of 7×7, a stride of 1, and a padding of 3, a BN batch normalization layer, a ReLU activation layer, a convolutional kernel with a size of 3×3, a stride of 2, and a padding of 1, an IN instance normalization layer, a ReLU activation layer, a convolutional kernel with a size of 3×3, a stride of 2, and a padding of 1, and an IN instance normalization layer and a ReLU activation layer in sequence. Each residual block consists of two convolutional kernels with a size of 3×3, a stride of 1, and a padding of 1, an IN instance normalization layer, and a ReLU activation layer, and uses a residual connection to directly add the input feature to the convolution result to alleviate the problem of gradient disappearance. There are a total of 4 residual blocks, and the structure of each block is the same. The class activation map calculates the global feature through global average pooling and global max pooling, and is mapped to a single-channel output through a multi-layer perceptron, consisting of a 1×1 convolutional kernel and a ReLU activation layer, and maps the feature back to 256 channels. Each residual block consists of two convolutional kernels with a size of 3×3, a stride of 1, and a padding of 1, an AdaLIN adaptive linear normalization layer, and a ReLU activation layer. Similar to the ordinary residual block, it uses a residual connection to directly add the input to the convolution result. The upsampling module consists of a convolutional kernel with a size of 3×3, a stride of 1, and a padding of 3, a LIN linear normalization layer, a ReLU activation layer, a convolutional kernel with a size of 3×3, a stride of 1, and a padding of 1, a LIN linear normalization layer, a ReLU activation layer, a convolutional kernel with a size of 7×7, a stride of 1, and a padding of 3, an IN instance normalization layer, and a Tanh activation layer in sequence, and maps the feature to a single-channel output.

[0014] Among them, the global discriminator in step 3 consists of 6 downsampling units in sequence. A downsampling unit includes a convolutional kernel with a size of 4×4, a stride of 2, and a padding of 1, an SN (spectral normalization) layer, a Leaky-ReLU activation layer. In the class activation map stage, the global feature is extracted through global average pooling and global max pooling, and then the result is mapped to a feature space of 4096 channels through an MLP, and then consists of a 1×1 convolutional kernel and a Leaky-ReLU activation layer in sequence for feature transformation. The classifier stage consists of a convolutional kernel with a size of 4×4, a stride of 1, and a padding of 1, an SN layer, and outputs the final classification result.

[0015] The local discriminator structure in step 3 consists of four downsampling units in sequence. Each downsampling unit includes a 4×4 convolution kernel with a stride of 2 and a padding of 1, a SN layer, and a Leaky-ReLU activation layer. The class activation map stage extracts global features through global average pooling and global maximum pooling. The result is then mapped to a 1024-channel feature space through an MLP. The structure consists of a 1×1 convolution kernel and a Leaky-ReLU activation layer for feature transformation. The classifier stage consists of a 4×4 convolution kernel with a stride of 1 and a padding of 1, an SN layer, and outputs the final classification result.

[0016] Among them, the network loss function that needs to be trained in step 2, step 3, step 4, and step 5 is a multi-level consistency loss function composed of adversarial loss, cycle loss, authentication loss, and class activation map loss, as shown in the following formula:

[0017]

[0018] Among them, λ1=1, λ2=10, λ3=10, λ4=100, L lsgan , L cycle , L identity and L cam is calculated as follows:

[0019]

[0020] Among them, L lsgan is the least squares constrained adversarial loss function, L cycle is the cycle loss function, L identity is the authentication loss function, L cam is the class activation map loss function, L lsgan , L cycle , L identity and L cam The calculation method of the medical image encryption process is taken as an example. The calculation method of the decryption process is exactly the same. It only needs to convert the sample data of the source domain and the target domain to counter the loss L lsgan The distribution of the plaintext domain image is constrained and matched with the distribution of the ciphertext domain image. The calculation method is as follows:

[0021]

[0022] in, Denotes the expected value of the distribution function. The generator in encryption and decryption uses a cycle consistency constraint. This cycle consistency constraint ensures that after encrypting the plaintext image into a ciphertext image, the ciphertext image can be successfully decrypted to the original plaintext domain one-to-one while avoiding overfitting. Its calculation method is as follows:

[0023]

[0024] The generator in the encryption and decryption processes also uses an authentication loss function. The main function of this function is to ensure that the color distributions are similar after generating the ciphertext or plaintext image using the generator given the plaintext or ciphertext image. Its calculation method is as follows:

[0025]

[0026] In the generator, L cam By using the auxiliary classifier η in the generator c to classify the plaintext domain and the ciphertext domain to understand the maximum difference between the plaintext and ciphertext domains, the cross-entropy loss is used at this time In the auxiliary classifier η in the discriminator p the least squares loss is used to feedback to the generator at which position to perform the plaintext domain and ciphertext domain conversions on the feature map. The calculation method of L cam is as follows:

[0027]

[0028] Among them, the encryption and decryption qualitative effects are mainly evaluated visually. The encryption and decryption qualitative quantitative indicators mainly include peak signal-to-noise ratio, structural similarity, Inception Score (IS), Fréchet Inception Distance (FID), and Kernel Inception Distance (KID). The IS index combines the clarity and diversity of the image to evaluate the quality of the image generated by medical image encryption or decryption. The calculation formula of IS is as follows:

[0029]

[0030] Among them, G represents the generation model, D represents the Inception classifier, D KL (*) represents the Kullback-Leibler (KL) divergence of two probability distributions. p(y|x) represents the class distribution of the image generated given the image x, and p(y) is the average class distribution of all input images. The calculation of the KL divergence that measures the difference between the probability distributions of P(x) and Q(x) is as follows:

[0031]

[0032] Both FID and KID are used to evaluate the performance of the generation model. Both evaluate the quality of the generated image by comparing the distributions of the generated image and the real image in the feature space. The calculation process of FID is as follows:

[0033]

[0034] Among them, Tr represents the trace of the matrix, μ represents the mean, ∑I and ∑r are the corresponding covariance matrices. FID calculates the distance of the mean and covariance between the feature vectors extracted from real images and generated images. The FID value is the Fréchet distance between these two multivariate normal distributions, which reflects the similarity of the two groups of images at the feature level. The smaller the FID value, the more similar the generated image is to the real image.

[0035]

[0036] Among them, k(I i ,I j ) represents the kernel function, I i , I j represents the i, j feature in I, r i , r j represents the i, j feature in r. m and n respectively represent the number of original images and the number of processed images. KID measures the difference between two groups of samples by calculating the square of the maximum mean difference between Inception representations. Different from FID, KID has an unbiased estimate value of a cubic kernel, which more consistently matches human perception. KID does not depend on empirical bias, so it provides a more stable and consistent evaluation.

[0037] After decrypting the ciphertext image received by the receiver, the plaintext image is obtained. The larger the PSNR and SSIM values, the closer the restored image after decryption is to the original image, the higher the image quality, and the more key tissue structures of the medical image can be restored. The smaller the FID and KID, the closer the distribution of the generated plaintext image is to the original medical image and the better the diversity, and the more excellent the performance of EDG-Net. For the sender, the larger the SSIM and PSNR obtained by the ciphertext image encrypted by the sender and the original ciphertext image, the smaller the difference between the ciphertext image and the original medical image, the better the encryption effect, and the better the protection of the medical image. The smaller the FID and KID, the smaller the difference between the encrypted image and the original ciphertext image, and the fewer the tissue structures of the medical image exposed. During the encryption or decryption process, the larger the value of IS, the larger the KL divergence, the higher the class distribution and quality of the plaintext image, and the stronger the ability of the generation model.

[0038] Among them, the network model parameters that need to be trained in Step 2, Step 3, Step 4, and Step 5 are iteratively updated by the optimizer.

[0039] An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the program, the dual medical image encryption and decryption method driven by a generative adversarial network and an attention mechanism is implemented.

[0040] A computer-readable storage medium, on which a computer instruction is stored, and when the computer instruction is executed by a processor, the dual medical image encryption and decryption method driven by a generative adversarial network and an attention mechanism is implemented.

[0041] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0042] 1. A dual medical image encryption and decryption network EDG-Net driven by a generative adversarial network and an attention mechanism proposed by the present invention, and a secondary encryption strategy is applied to EDG-Net, which improves the security of encryption and the accuracy of decryption. In the comparative experiment, the encryption quality of the ciphertext image encrypted by EDG-Net is higher than that of other encryption methods, and the plaintext accuracy after decryption is also higher than that of other algorithms.

[0043] 2. The encryption system in the present invention can maintain the robustness and reliability of the encryption system when facing attacks from third parties.

[0044] 3. The key in the present invention is the trained network parameters. The more network parameters there are, the larger the key space is, and the higher the security performance of the encryption algorithm is. [[ID= sixteen]]

[0045] 4. The present invention collects a private dataset of medical images for encryption. Three data augmentation methods of rotating 90°, 180°, and 270° are adopted to augment 1639 kinds of clinical data into 6556 copies, and three different encryption methods are used to generate ciphertext image datasets corresponding to the plaintext images one by one. Qualitative and quantitative results show that this dataset can be used to train, verify, and test the dual medical image encryption and decryption network driven by a generative adversarial network and an attention mechanism.

[0046] 5. After the training of the present invention is completed, only an image needs to be input, and no other parameters need to be adjusted. It is an end-to-end and one-step medical image encryption method. The present invention has high encryption quality and can maintain the robustness and reliability of the encryption system when facing attacks from third parties. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a schematic diagram of the whole process of the present invention,

[0048] Figure 2 It is a schematic diagram of the composition of each unit mentioned in the network,

[0049] Figure 3This is the flowchart of the dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms proposed by the present invention. Specific implementation manners

[0050] The following further clarifies the present invention in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and not to limit the scope of the present invention. After reading the present invention, various equivalent forms of modification by those skilled in the art fall within the scope defined by the appended claims of this application.

[0051] Embodiment 1: The dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms, and the specific implementation steps are as follows:

[0052] Specifically, a set of medical images containing patient tissue structure information that meets the clinical diagnosis requirements is given as the plaintext image domain P, and a set of ciphertext label image domains C encrypted by various encryption methods is given. The plaintext domain images and ciphertext domain images can alternately become the source domain and the target domain according to the encryption or decryption tasks. During the encryption phase, a mapping with an output as shown in

[0053] Equation 4-1 is trained:

[0054]

[0055] Theoretically, an optimal mapping, that is, the generator G C , can be trained. The empirical distribution of the generated by the generator G matches the ciphertext image c, so as to realize the conversion from the plaintext image domain P to the ciphertext image domain C. The pixel distribution style of the output image and the image c in the ciphertext domain is determined by a discriminator D C to determine whether they are the same. The discriminator D C is used to score the quality of the image translation work from the plaintext domain to the ciphertext domain. The generator optimizes the image style generated by itself according to the feedback of the discriminator D C so that the image distribution becomes more and more like the image distribution of the target domain. After converting the plaintext domain to the ciphertext domain image, the image in the ciphertext domain passes through a reconstructor G CP . The purpose of this reconstructor is to obtain a mapping as follows:

[0056]

[0057] This mapping ensures that each output of the reconstructor G(C→P) corresponds one-to-one with the plaintext image p in the source domain, that is:

[0058]

[0059] The reconstructor reconstructs the ciphertext-domain image into a plaintext image. The similarity degree of the image distribution between the reconstructed image and the plaintext image is measured by the second discriminator P, so as to optimize the reconstructor G(C→P). The reconstructor G(C→P) is mainly responsible for the cyclic image translation work of "generate→discriminate→reconstruct→discriminate", and converts the medical image with clear organizational structure information into a ciphertext-domain image to realize the encryption of the medical image. The decryption process is exactly the same as the encryption process, and only the data of the source domain and the target domain need to be exchanged. As long as the sender trains a high-performance EDG-Net network and gives the image network parameters of a source domain as the encryption and decryption key, the receiver receives the ciphertext and the key, and inputs the ciphertext into the decryption network loaded with the network parameters to decrypt, and then a medical image that can be used clinically can be obtained. Finally, the double encryption strategy (Double Encryption and Decryption Strategy, DEDS) is adopted by EDG-Net.

[0060] In the encryption stage, in order to fully learn the image style of the ciphertext domain and try not to arouse the locking of the attacker, the ciphertext image after the medical image is first encrypted by EDG-Net is used to replace the ciphertext image encrypted by the traditional method as the ciphertext-domain image label, and then encrypted by EDG-Net again. The ciphertext of EDG-Net after double encryption is used as the final output. This operation will effectively adjust the difference between the encrypted ciphertext style and the ciphertext label style, ensuring that the encrypted image has the ciphertext style while not attracting the attention of third-party attackers. In the decryption stage, the double encryption and decryption strategy can enhance the ability of the decryption network to restore the details of the key organizational structure, maintain the accuracy of the decrypted medical image, and meet the requirements of clinical diagnosis.

[0061] Effect evaluation:

[0062] The present invention proposes a dual medical image encryption and decryption method based on generative adversarial and attention mechanism drive, which is used to encrypt medical images with high security and decryption accuracy. Compared with the existing methods, the security of the medical image encryption and the accuracy of decryption of this method have been improved to a relatively high level.

[0063] Tables 1 and 2 list the quantitative analysis results of the encrypted images on the public dataset and the private dataset. From the encrypted results, EDG-Net achieved the highest PSNR and SSIM on both the public dataset and the private dataset, indicating that the gap between the medical images encrypted by EDG-Net and the ciphertext medical images is the smallest, and the similarity of the ciphertext images is the highest. CCPL obtained the lowest PSNR and SSIM on both the public dataset and the private dataset, indicating that the medical images encrypted by CCPL exposed more organizational structures similar to the original medical images. Calculating FID and KID between the medical images encrypted by EDG-Net and the original medical images, the maximum values in Tables 1 and 2 were obtained, reaching as low as 461.04, 0.6345 and 543.37, 0.7593 respectively, indicating that the distance between the ciphertext medical image labels and the ciphertext images encrypted by EDG-Net is the smallest, the performance of the ciphertext generation model of EDG-Net is the best, and the encryption effect is the best. The IS values of the medical images encrypted by EDG-Net on the public dataset and the private dataset are 1.43 and 1.67 respectively, indicating that the KL divergence between the class probability distribution of the ciphertext images generated during the encryption process and the marginal distribution of all classes is the largest, and EDG-Net is the best among all the ciphertext generation models in the comparative experiment.

[0064] Table 1. Quantitative evaluation indexes after encryption of the present invention on the public dataset

[0065]

[0066] Table 2. Quantitative evaluation indexes after encryption of the present invention on the private dataset

[0067]

[0068] It should be noted that the above embodiments are only the preferred embodiments of the present invention and do not limit the protection scope of the present invention. Any equivalent replacement or substitution made on the basis of the above technical solutions falls within the protection scope of the present invention.

Claims

1. A dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms, characterized in that The method includes the following steps: Step 1: Given a set of medical images as the plaintext image domain P, and then given a set of ciphertext label image domains C obtained by encrypting through various encryption methods, where the plaintext domain images and the ciphertext domain images can alternately become the source domain and the target domain according to the encryption or decryption tasks. Step 2, train the generator G P→C to obtain an optimal mapping; specifically, match the empirical distribution of generated by the generator G with the ciphertext image c, so as to realize the transformation from the plaintext image domain P to the ciphertext label image domain C; Step 3, Generator G P→C Optimize the image style it generates according to the feedback from Discriminator D C Specifically, the output image and the pixel distribution style of the ciphertext image c are determined by Discriminator D C to determine whether they are the same. Discriminator D C is used to score the quality of the image translation work from the plaintext domain to the ciphertext domain and guide G P→C to perform optimization; Step 4, Reconstructor G C→P Reconstruct the ciphertext domain image into a plaintext image; Step 5, the second discriminator D P Measure the similarity of the image distributions between the reconstructed image and the plaintext image, and use this to optimize the reconstructor G C→P ; Step 6: The sender gives an image network parameter of a source domain as the encryption and decryption key. The receiver receives the ciphertext and the key, inputs the ciphertext into the decryption network loaded with the network parameter for decryption, and can obtain the medical images that can be used clinically. EDG-Net adopts a secondary encryption strategy; specifically, in the encryption stage, the ciphertext image obtained by first encrypting the medical image through EDG-Net replaces the ciphertext image encrypted by the traditional method as the ciphertext domain image label, and then is encrypted again through EDG-Net. The ciphertext of EDG-Net after secondary encryption is used as the final output.

2. A dual medical image encryption and decryption method based on generative adversarial and attention mechanism drive according to claim 1, characterized in that, The generator to be trained in Step 2 is as follows: The generator consists of a downsampling module, residual blocks, a class activation map, residual blocks, and an upsampling module in sequence. The downsampling module consists of a 7×7 convolutional kernel with a stride of 1 and a padding of 3, a BN batch normalization layer, a ReLU activation layer, a 3×3 convolutional kernel with a stride of 2 and a padding of 1, an IN instance normalization layer, a ReLU activation layer, a 3×3 convolutional kernel with a stride of 2 and a padding of 1, and an IN instance normalization layer and a ReLU activation layer in sequence. The residual block consists of two 3×3 convolutional kernels with a stride of 1 and a padding of 1, an IN instance normalization layer, and a ReLU activation layer, and uses a residual connection to directly add the input feature to the convolution result to alleviate the problem of gradient disappearance. There are a total of 4 residual blocks, and the structure of each block is the same. The class activation map calculates the global feature through global average pooling and global max pooling, and is mapped to a single-channel output through a multi-layer perceptron, consisting of a 1×1 convolutional kernel and a ReLU activation layer, and maps the feature back to 256 channels. Each residual block consists of two 3×3 convolutional kernels with a stride of 1 and a padding of 1, an AdaLIN adaptive linear normalization layer, and a ReLU activation layer, and uses a residual connection to directly add the input to the convolution result. The upsampling module consists of a 3×3 convolutional kernel with a stride of 1 and a padding of 3, a LIN linear normalization layer, a ReLU activation layer, a 3×3 convolutional kernel with a stride of 1 and a padding of 1, a LIN linear normalization layer, a ReLU activation layer, a 7×7 convolutional kernel with a stride of 1 and a padding of 3, an IN instance normalization layer, and a Tanh activation layer in sequence, and maps the feature to a single-channel output.

3. A dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms according to claim 1, characterized in that, The global discriminator in step 3 consists of 6 downsampling units in sequence. A downsampling unit includes a convolutional kernel of 4×4, stride 2, and padding 1, an SN (spectral normalization) layer, a Leaky-ReLU activation layer. In the class activation map stage, global features are extracted through global average pooling and global max pooling. Subsequently, the result is mapped to a feature space of 4096 channels through an MLP, and then consists of a convolutional kernel of 1×1 and a Leaky-ReLU activation layer in sequence for feature transformation. The classifier stage consists of a convolutional kernel of 4×4, stride 1, and padding 1, an SN layer, and outputs the final classification result.

4. A dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms according to claim 1, wherein The local discriminator structure in step 3 consists of 4 downsampling units in sequence. A downsampling unit includes a convolutional kernel of 4×4, stride 2, and padding 1, an SN layer, a Leaky-ReLU activation layer. In the class activation map stage, global features are extracted through global average pooling and global max pooling. Subsequently, the result is mapped to a feature space of 1024 channels through an MLP, and consists of a convolutional kernel of 1×1 and a Leaky-ReLU activation layer in sequence for feature transformation. The classifier stage consists of a convolutional kernel of 4×4, stride 1, and padding 1, an SN layer, and outputs the final classification result.

5. A dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms according to claim 1, characterized in that The network loss function to be trained in steps 2, 3, 4, and 5 is a multi-level consistency loss function composed of adversarial loss, cycle loss, authentication loss, and class activation map loss, as shown in the following formula: Among them, λ1 = 1, λ2 = 10, λ3 = 10, λ4 = 100, L lsgan , L cycle , L identity and L cam are calculated as follows: Among them, L lsgan is the adversarial loss function of least squares constraint, L cycle is the cycle loss function, L identity is the authentication loss function, L cam is the class activation map loss function, L lsgan 、L cycle 、L identity and L cam are all calculated taking the medical image encryption process as an example. The calculation method in the decryption process is exactly the same. Only the sample data in the source domain and the target domain need to be converted. The adversarial loss L lsgan constrains and matches the distribution of the plaintext domain image and the distribution of the ciphertext domain image. Its calculation method is as follows: Among them, represents the expected value of the distribution function. The generators in encryption and decryption use cyclic consistency constraints. Such cyclic consistency constraints ensure that after encrypting the plaintext image into a ciphertext image, the ciphertext image can be successfully decrypted one-to-one back to the original plaintext domain, while avoiding overfitting. Its calculation method is as follows: The generator in the encryption and decryption processes also uses an authentication loss function. The main function of this function is to ensure similar color distributions after generating ciphertext or plaintext images using the generator given plaintext or ciphertext images. Its calculation method is as follows: In the generator, L cam classifies the plaintext domain and the ciphertext domain by using the auxiliary classifier η in the generator c to understand the maximum difference between the plaintext and ciphertext domains. At this time, cross-entropy loss is used The auxiliary classifier D in the discriminator p uses least squares loss to feedback to the generator the position where the feature map is converted between the plaintext domain and the ciphertext domain. The calculation method of L cam is as follows:

6. A dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms according to claim 1, characterized in that, The encryption and decryption qualitative effects are mainly evaluated visually. The encryption and decryption qualitative quantitative indicators mainly include peak signal-to-noise ratio, structural similarity, Inception Score (IS), Fréchet Inception Distance (FID), and Kernel Inception Distance (KID). The IS index combines the clarity and diversity of images to evaluate the quality of images generated by medical image encryption or decryption. The calculation formula of IS is as follows: Among them, G represents the generative model, D represents the Inception classifier, D KL (*) represents the Kullback-Leibler (KL) divergence of two probability distributions. p(y|x) represents the distribution of image categories generated given the image x, and p(y) is the average category distribution of all input images. The calculation of the KL divergence, which measures the difference between the probability distributions of P(x) and Q(x), is as follows: Both FID and KID are used to evaluate the performance of the generative model. They evaluate the quality of the generated images by comparing the distributions of the generated images and the real images in the feature space. The calculation process of FID is as follows: Where Tr represents the trace of the matrix, μ represents the mean, I and r are the extracted feature sets, ∑I and ∑r are the corresponding covariance matrices. FID calculates the distance between the mean and covariance of the feature vectors extracted from the real images and the generated images. The FID value is the Fréchet distance between these two multivariate normal distributions, reflecting the similarity of the two groups of images at the feature level. The smaller the FID value, the more similar the generated images are to the real images. Among them, k(I i , I j ) represents the kernel function, I i , I j represents the i-th and j-th features in I, r i , r j represents the i-th and j-th features in r, m and n respectively represent the number of original images and the number of processed images, and KID measures the difference between two sets of samples by calculating the square of the maximum mean difference between Inception representations.

7. A dual medical image encryption and decryption method driven by generative adversarial and attention mechanisms according to claim 1, characterized in that In steps 2, 3, 4, and 5, the network model parameters to be trained are iteratively updated by the optimizer.

8. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the dual medical image encryption and decryption method based on generative adversarial and attention mechanisms as described in any one of claims 1 to 7 above.

9. A computer-readable storage medium having computer instructions stored thereon, characterized in that, When the computer instruction is executed by the processor, it implements the dual medical image encryption and decryption method based on generative adversarial and attention mechanisms as described in any one of claims 1 - 7.