Image steganography method based on hybrid attention mechanism and generative adversarial network

By employing an image steganography method based on a hybrid attention mechanism and generative adversarial networks, the problem of imprecise fusion between the carrier image and secret information is solved, generating high-quality encrypted images and improving the accuracy of secret image recovery, thus achieving effective and secure information transmission.

CN117596345BActive Publication Date: 2026-11-24YUNNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311616494.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-29
Publication Date
2026-11-24
Estimated Expiration
2043-11-29

AI Technical Summary

Technical Problem

Existing image steganography models are not precise enough in fusing carrier images and secret information, resulting in large differences between the steganographic image and the carrier image, increasing the risk of steganographic transmission. Furthermore, the steganographic image is easily interfered with when transmitted over public channels, leading to failure in extracting secret information.

Method used

An image steganography method based on a hybrid attention mechanism and a generative adversarial network is adopted. A generative adversarial network is constructed through joint training of the generator and the discriminator. The hybrid attention mechanism is used to perform cross-channel and spatial domain information fusion during the generation and extraction processes to generate high-quality cryptic images. The secret image is then recovered by the extractor.

Benefits of technology

It improves the quality of steganographic images and the accuracy of secret image recovery, ensuring information security and privacy, and can effectively extract secret information under interference such as image compression and cropping.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117596345B_ABST
    Figure CN117596345B_ABST
Patent Text Reader

Abstract

This invention discloses an image steganography method based on a hybrid attention mechanism and a generative adversarial network (GAN). The GAN is constructed according to actual needs, including a generator and a discriminator. The generator, based on a hybrid attention mechanism, generates a coded image from a secret image and a carrier image. The discriminator distinguishes between the carrier image and the coded image to determine whether it is the carrier image. An extractor, also based on the hybrid attention mechanism, is used to extract and recover the secret image from the coded image. The GAN and the extractor are jointly trained. The trained generator is deployed at the sending end, and the extractor is deployed at the receiving end. The sending end inputs the secret image and the carrier image into the generator to obtain the coded image, which is then sent to the receiving end. The receiving end inputs the received coded image into the extractor to extract and recover the secret image. This invention can improve the image quality of the steganographic image and the extraction accuracy of the recovered secret image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image steganography technology, and more specifically, relates to an image steganography method based on a hybrid attention mechanism and a generative adversarial network. Background Technology

[0002] Image steganography is an important method of information hiding. Its core concept is to embed information in a carrier image in a covert manner without altering the image's inherent characteristics. This technology has attracted significant attention in the field of information security. In image steganography, the sender hides secret information within a carrier image, creating a coded image, while the receiver is responsible for retrieving and decoding these coded images. This method ensures that only the sender and receiver know the hidden secret information, guaranteeing information security and privacy even if intercepted by unauthorized individuals.

[0003] Currently, image steganography methods can be broadly categorized into three types: traditional steganography methods, which rely on researchers' extensive prior knowledge and require manually designed image feature extraction algorithms; deep learning-based steganography methods, which leverage the modeling capabilities of deep learning models for complex data to model the complex dependencies between different pixels in an image; and attention-based image steganography methods, which use attention mechanisms to adaptively extract carrier image information and secret information. However, existing image steganography models have the following shortcomings:

[0004] 1) Most existing image steganography models directly fuse the carrier image and the secret information, resulting in insufficient fusion. This leads to a large difference between the secret image and the carrier image, increasing the potential dangers in steganographic transmission.

[0005] 2) When a secret image is transmitted over a public channel, it may be subject to various interferences, such as image compression and cropping, which may cause the receiver to fail to extract the secret information. Summary of the Invention

[0006] The purpose of this invention is to overcome the shortcomings of the prior art and provide an image steganography method based on a hybrid attention mechanism and a generative adversarial network, thereby improving the image quality of steganographic images and the extraction accuracy of secret image recovery.

[0007] To achieve the above-mentioned objectives, the image steganography method based on a hybrid attention mechanism and generative adversarial networks of the present invention includes the following steps:

[0008] S1: Construct a generative adversarial network (GAN) according to actual needs, including a generator and a discriminator. The generator generates a secret image based on the secret image and the carrier image, and the discriminator distinguishes between the carrier image and the secret image to obtain a result indicating whether it is the carrier image. The generator includes a secret image feature extraction module, a carrier image feature extraction module, a feature fusion module, a first convolution module, a first hybrid attention mechanism module, a second convolution module, a second hybrid attention mechanism module, and a third convolution module, wherein:

[0009] The secret image feature extraction module is used to extract features from secret images and send the extracted secret image feature map to the feature fusion module;

[0010] The carrier image feature extraction module is used to extract features from the carrier image and send the extracted carrier image feature map to the feature fusion module;

[0011] The feature fusion module is used to concatenate the secret image feature map and the carrier image feature map, and send the resulting fused feature map to the first convolution module;

[0012] The first convolutional module is used to perform convolution operations on the fused feature map and send the resulting feature map to the first hybrid attention module.

[0013] The first hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the second convolution module.

[0014] The second convolutional module is used to perform convolution operations on the received feature map and output the resulting feature map to the second hybrid attention module.

[0015] The second hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the third convolution module.

[0016] The third convolution module is used to perform convolution operations on the received feature map and output the resulting feature map as a dense image.

[0017] S2: An extractor is configured to extract and recover the secret image from the dense image, based on the actual situation. This includes a first convolutional module, a first hybrid attention module, a second convolutional module, a second hybrid attention module, and a third convolutional module, wherein:

[0018] The first convolution module is used to perform convolution operations on dense images and send the resulting feature maps to the first hybrid attention module.

[0019] The first hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the second convolution module.

[0020] The second convolution module is used to perform convolution operations on the received feature map and send the resulting feature map to the second hybrid attention module.

[0021] The second hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the third convolution module.

[0022] The third convolution module is used to perform convolution operations on the received feature maps to obtain the recovered secret image;

[0023] S3: The generative adversarial network and the extractor are jointly trained using the following method:

[0024] S3.1: Set up several pairs of secret images and carrier images according to actual needs to form a training sample set;

[0025] S3.2: Initialize the parameters of the generator and discriminator in the generative adversarial network, and initialize the parameters of the extractor at the same time;

[0026] S3.3: Fix the parameters of the generator and extractor, extract several pairs of secret images and carrier images from the training sample set, input them into the generator to generate secret images, and then input the secret images and corresponding carrier images into the discriminator for discrimination, and calculate the discrimination loss L. D The parameters of the discriminator are updated; the above process is repeated several times to update the parameters of the discriminator, and then the process proceeds to step S3.4.

[0027] S3.4: With the discriminator parameters fixed, extract several pairs of secret images and carrier images from the training sample set, input them into the generator to generate secret images, and then input the secret images into the extractor to extract and recover the secret images. Calculate the generation-extraction loss L. T The parameters of the generator and extractor are updated; the generation-extraction loss L T The calculation formula is as follows:

[0028] L T =λ1L C +λ2L G +L R

[0029] Where λ1 and λ2 represent preset weights, and L C L represents the image hiding loss between the carrier image and the dense image. G L represents the adversarial loss of the generator. RThe loss between the secret image and the recovered secret image is calculated using the following formulas:

[0030]

[0031] L G (I C' ) = log(1-D(I C' ))

[0032]

[0033] Where |||2 represents finding the L2 norm, I C I C′ Let D represent the corresponding carrier image and the dense image, respectively, and let I represent the discrimination result of the discriminator. S I S′ These represent the corresponding secret image and the recovered secret image, respectively, and C′, H′, and W′ represent the number of feature channels, height, and width of the secret image and the carrier image, respectively.

[0034] S3.5: Determine whether the training termination condition has been met. If it has, the training ends; otherwise, return to step S3.3.

[0035] S4: Deploy the trained generator at the sending end and the extractor at the receiving end; the sending end inputs the secret image and the carrier image into the generator to obtain the secret image and sends it to the receiving end; the receiving end inputs the received secret image into the extractor to extract and recover the secret image.

[0036] This invention relates to an image steganography method based on a hybrid attention mechanism and a generative adversarial network (GAN). The GAN is constructed according to actual needs, including a generator and a discriminator. The generator, based on a hybrid attention mechanism, generates a secret image from a secret image and a carrier image. The discriminator distinguishes between the carrier image and the secret image to determine whether it is a secret image. An extractor, also based on a hybrid attention mechanism, is constructed to extract and recover the secret image from the secret image. The GAN and the extractor are jointly trained. The trained generator is deployed at the sending end, and the extractor is deployed at the receiving end. The sending end inputs the secret image and the carrier image into the generator to obtain the secret image, which is then sent to the receiving end. The receiving end inputs the received secret image into the extractor to extract and recover the secret image.

[0037] The present invention has the following beneficial effects:

[0038] 1) This invention proposes an image steganography method based on a hybrid attention mechanism and generative adversarial networks, which can improve the image quality of steganographic images and the extraction accuracy of secret image recovery;

[0039] 2) This invention employs a hybrid attention mechanism that integrates channel attention and spatial attention to highlight key information and suppress irrelevant information. This enables cross-channel and spatial information fusion during image steganography and extraction, thereby improving the quality of image steganography and recovery of secret images. Attached Figure Description

[0040] Figure 1 This is a flowchart illustrating a specific implementation of the image steganography method based on a hybrid attention mechanism and a generative adversarial network, as described in this invention.

[0041] Figure 2 This is a structural diagram of the generator in this invention;

[0042] Figure 3 This is a structural diagram of the first convolutional module in this embodiment;

[0043] Figure 4 This is a structural diagram of the second convolution module in this embodiment;

[0044] Figure 5 This is a structural diagram of the third convolution module in this embodiment;

[0045] Figure 6 This is a structural diagram of the hybrid attention module in this embodiment;

[0046] Figure 7 This is a structural diagram of the discriminator in this embodiment;

[0047] Figure 8 This is a structural diagram of the extractor of the present invention;

[0048] Figure 9 This is a flowchart of the joint training of the generative adversarial network and the extractor in this invention;

[0049] Figure 10 This is a comparison diagram showing the effects of the present invention and the comparison method in restoring secret images in this embodiment. Detailed Implementation

[0050] The specific embodiments of the present invention will now be described with reference to the accompanying drawings to enable those skilled in the art to better understand the invention. It should be particularly noted that in the following description, detailed descriptions of known functions and designs that might obscure the main content of the invention will be omitted here.

[0051] Example

[0052] Figure 1 This is a flowchart illustrating a specific implementation of the image steganography method based on a hybrid attention mechanism and generative adversarial networks, as described in this invention. Figure 1 As shown, the specific steps of the image steganography method based on hybrid attention mechanism and generative adversarial network of the present invention include:

[0053] S101: Constructing a Generative Adversarial Network:

[0054] Generative adversarial networks are constructed according to actual needs, including a generator and a discriminator. The generator is used to generate a secret image based on the secret image and the carrier image, and the discriminator is used to distinguish between the carrier image and the secret image to obtain a judgment result on whether it is the carrier image.

[0055] Figure 2 This is a structural diagram of the generator in this invention. (Example) Figure 2 As shown, the generator in this invention includes a secret image feature extraction module, a carrier image feature extraction module, a feature fusion module, a first convolution module, a first hybrid attention mechanism module, a second convolution module, a second hybrid attention mechanism module, and a third convolution module, wherein:

[0056] The secret image feature extraction module is used to extract features from the secret image and then sends the extracted secret image feature map to the feature fusion module. For example... Figure 2 As shown, the secret image feature extraction module in this embodiment includes two cascaded convolutional layers. The kernel size of the first convolutional layer is 3×3, and the kernel size of the second convolutional layer is 4×4. The output of each convolutional layer is processed using the ReLU activation function.

[0057] The carrier image feature extraction module is used to extract features from the carrier image and send the extracted carrier image feature map to the feature fusion module. For example... Figure 2 As shown, the carrier image feature extraction module in this embodiment includes two cascaded convolutional layers. The kernel size of the first convolutional layer is 3×3, and the kernel size of the second convolutional layer is 4×4. The output of each convolutional layer is processed using the ReLU activation function.

[0058] The feature fusion module is used to stitch together the secret image feature map and the carrier image feature map, and send the resulting fused feature map to the first convolution module.

[0059] The first convolution module is used to perform convolution operations on the fused feature map and send the resulting feature map to the first hybrid attention module. Figure 3 This is a structural diagram of the first convolutional module in this embodiment. (See diagram below.) Figure 3 As shown, in this embodiment, the first convolutional module includes three cascaded convolutional-batch normalization (BN) layers, wherein the kernel size in the first convolutional layer is 1×1, and the kernel size in the second and third convolutional layers is 3×3. The output of each batch normalization layer is processed using the ReLU activation function.

[0060] The first hybrid attention module processes the received feature map using channel attention and spatial attention mechanisms, and sends the resulting feature map to the second convolution module.

[0061] The second convolution module is used to perform convolution operations on the received feature map and output the resulting feature map to the second hybrid attention module. Figure 4 This is a structural diagram of the second convolutional module in this embodiment. For example... Figure 4 As shown, in this embodiment, the second convolutional module includes three cascaded convolutional-batch normalization layers. The first convolutional layer is a transposed convolutional layer with a kernel size of 4×4. The kernel sizes in the second and third convolutional layers are 3×3. The output of each batch normalization layer is processed using the ReLU activation function.

[0062] The second hybrid attention module processes the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the third convolution module.

[0063] The third convolution module is used to perform convolution operations on the received feature maps and output the resulting feature maps as dense images. Figure 5 This is a structural diagram of the third convolutional module in this embodiment. (See diagram below.) Figure 5 As shown, in this embodiment, the third convolutional module includes three cascaded convolutional-batch normalization layers, where the kernel size in each convolutional layer is 3×3. The outputs of the first and second normalization layers are processed using the ReLU activation function, and the outputs of the third batch normalization layer are all processed using the Tanh activation function.

[0064] In this invention, the hybrid attention module plays an important role in the generation of dense images. In this embodiment, a specific structure of the hybrid attention module is designed to improve the quality of dense images. Figure 6 This is a structural diagram of the hybrid attention module in this embodiment. For example... Figure 6 As shown, the hybrid attention module in this embodiment includes a channel attention module, a channel weight fusion module, a spatial attention module, and a spatial weight fusion module. Each module will be described in detail below.

[0065] The channel attention module is used to process the input feature map based on the channel attention mechanism. The process involves processing, where C, H, and W represent the number of feature channels, height, and width of the input feature map, respectively, resulting in the channel weight vector M. C ∈R C ×1×1 Send to the channel weight fusion module. For example... Figure 6As shown, in this embodiment, the channel attention module includes a channel average pooling module, a channel max pooling module, a convolutional layer, a concatenation module, and a sigmoid layer, wherein:

[0066] The channel average pooling module is used to perform average pooling on the spatial information of the input feature map F, resulting in an average pooled feature map. And send it to the convolutional layer.

[0067] The channel max pooling module is used to input the feature map F and perform max pooling on the spatial information of the feature map to obtain the max pooled feature map. And send it to the convolutional layer.

[0068] Convolutional layers are used to process average pooling feature maps. Max pooling feature map After performing convolutions on each layer, the resulting feature vectors are sent to the concatenation module. In this embodiment, the size of the convolution kernel in the convolutional layer is 3×3.

[0069] The concatenation module is used to concatenate two received vectors to obtain the channel weight vector. And send it to the sigmoid layer.

[0070] The sigmoid layer is used to apply the sigmoid activation function to the channel weight vector. This process maps the weights of each channel to a range of 0 and 1, resulting in a channel weight vector.

[0071] The channel weight fusion module is used to combine the channel weight vectors. The weighted feature map is obtained by element-wise multiplication with the input feature map F. It is then sent to the spatial attention module and the spatial weight fusion module.

[0072] The spatial attention module is used to process the feature map F′ based on the spatial attention mechanism to obtain the spatial weight feature map. Send to the spatial weight fusion module. For example... Figure 6 As shown, in this embodiment, the spatial attention module includes a spatial average pooling module, a spatial max pooling module, a concatenation module, a convolutional layer, and a sigmoid layer, wherein:

[0073] The spatial average pooling module is used to perform average pooling on the channel information of the input feature map F′ to obtain the average pooled feature map. And send it to the splicing module.

[0074] The spatial max pooling module is used to perform max pooling on the channel information of the input feature map F to obtain the max pooled feature map. And send it to the splicing module.

[0075] The stitching module is used to stitch together average pooling feature maps. Max pooling feature map After splicing, the spliced ​​feature map is sent to the convolutional layer.

[0076] Convolutional layers are used to perform convolution operations on the concatenated feature maps, resulting in channel weight vectors. The data is then sent to the sigmoid layer. In this embodiment, the kernel size in the convolutional layer is 7×7.

[0077] The sigmoid layer is used to apply the sigmoid activation function to the channel weight vector. This process maps the weights of each channel to a range of 0 and 1, resulting in a channel weight vector.

[0078] The spatial weight fusion module is used to fuse spatial weight feature maps. The final feature map is obtained by element-wise multiplication with the feature map F′.

[0079] Figure 7 This is a structural diagram of the discriminator in this embodiment. For example... Figure 7 As shown, in this embodiment, the discriminator includes a feature extraction module, an average pooling layer, and a linear layer, wherein:

[0080] The feature extraction module is used to extract features from the input image and send the obtained feature map to the average pooling layer. In this embodiment, the feature extraction module includes a cascaded first convolutional layer, a first batch normalization layer, a second convolutional layer, a second batch normalization layer, a third convolutional layer, and a third batch normalization layer. The kernel size in each convolutional layer is 3×3, and the output of each batch normalization layer is processed using the ReLU activation function.

[0081] The average pooling layer is used to perform average pooling on the received feature map, reducing the spatial dimension of the image to 1×1, and then sending the resulting feature map to the linear layer.

[0082] The linear layer is used to process the received feature map, reduce the output dimension to 1, and obtain the discrimination result of whether the input image is a dense image.

[0083] S102: Constructing the extractor:

[0084] Configure the extractor to extract and recover the secret image from the secret image according to the actual situation. Figure 8 This is a structural diagram of the extractor of this invention. (See diagram below.) Figure 8As shown, the extractor of this invention includes a first convolution module, a first hybrid attention module, a second convolution module, a second hybrid attention module, and a third convolution module. Each module will be described in detail below.

[0085] The first convolutional module performs convolution operations on the dense image and sends the resulting feature map to the first hybrid attention module. In this embodiment, the first convolutional module includes two cascaded convolutional-batch normalization layers, where the kernel size of each convolutional layer is 3×3, and the output of each batch normalization layer is processed using the ReLU activation function.

[0086] The first hybrid attention module processes the received feature map using channel attention and spatial attention mechanisms, and sends the resulting feature map to the second convolution module.

[0087] The second convolutional module performs convolution operations on the received feature maps and sends the resulting feature maps to the second hybrid attention module. In this embodiment, the second convolutional module includes two cascaded convolutional-batch normalization layers, where the kernel size in each convolutional layer is 3×3, and the output of each batch normalization layer is processed using the ReLU activation function.

[0088] The second hybrid attention module processes the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the third convolution module.

[0089] The third convolutional module is used to perform convolution operations on the received feature maps to obtain the recovered secret image. In this embodiment, the second convolutional module includes four cascaded convolutional-batch normalization layers, where the kernel size in each convolutional layer is 3×3. The outputs of the first three batch normalization layers are processed using the ReLU activation function, and the outputs of the fourth batch normalization layer are processed using the Tanh activation function.

[0090] In this embodiment, the first and second hybrid attention modules of the extractor adopt the same structure as the generator, i.e., as shown below. Figure 6 The structure shown.

[0091] S103: Jointly training the generative adversarial network and extractor:

[0092] Since the generative adversarial network and the extractor need to be trained in this invention, an alternating training method is adopted. Figure 9 This is a flowchart of the joint training of the generative adversarial network and the extractor in this invention. For example... Figure 9 As shown, the specific steps for joint training of the generative adversarial network and the extractor in this invention include:

[0093] S901: Obtain the training sample set:

[0094] Several pairs of secret images and carrier images are set up according to actual needs to form a training sample set.

[0095] S902: Initialization parameters:

[0096] Initialize the parameters of the generator and discriminator in the generative adversarial network, and also initialize the parameters of the extractor.

[0097] S903: Training the discriminator:

[0098] With the parameters of the generator and extractor fixed, several pairs of secret images and carrier images are extracted from the training sample set and input into the generator to generate secret images. Then, the secret images and their corresponding carrier images are input into the discriminator for discrimination, and the discrimination loss L is calculated. D The parameters of the discriminator are then updated. This process is repeated several times to update the parameters of the discriminator before proceeding to step S904.

[0099] Similar to conventional generative networks, the discriminator in this invention aims to better distinguish between dense images and carrier images, and its loss function L... D The following formula is generally used for calculation:

[0100] L D =log(1-D(I) C ))+log(D(I C' ))

[0101] Among them, I C I C′ Let D represent the corresponding carrier image and the dense image, respectively, and let D() represent the discrimination result of the discriminator.

[0102] S904: Training the generator and extractor:

[0103] With the discriminator parameters fixed, several pairs of secret images and carrier images are extracted from the training sample set and input into the generator to generate secret images. Then, the secret images are input into the extractor to extract and recover the secret images. The generation-extraction loss L is calculated. T The parameters of the generator and extractor are updated. In this invention, the generation-extraction loss L is calculated by comprehensively considering the steganography loss and adversarial loss of the generator and the recovery loss of the extractor. T The specific calculation formula is as follows:

[0104] L T =λ1L C +λ2L G +L R

[0105] Where λ1 and λ2 represent preset weights, and L CL represents the image hiding loss between the carrier image and the dense image. G L represents the adversarial loss of the generator. R The loss between the secret image and the recovered secret image is calculated using the following formulas:

[0106]

[0107] L G (I C' ) = log(1-D(I C' ))

[0108]

[0109] Where |||2 represents finding the L2 norm, I C I C′ Let D represent the corresponding carrier image and the dense image, respectively, and let I represent the discrimination result of the discriminator. S I S′ These represent the corresponding secret image and the recovered secret image, respectively. C′, H′, and W′ represent the number of feature channels, height, and width of the secret image and the carrier image, respectively.

[0110] S905: Determine if the training termination condition has been met. If it has, training ends; otherwise, return to step S903. There are generally two training termination conditions: the number of iterations reaches a preset threshold, or the network parameters converge. In practice, the training termination condition can be set according to the actual situation.

[0111] S104: Deploy generator and extractor:

[0112] The trained generator is deployed at the sending end, and the extractor is deployed at the receiving end. The sending end inputs the secret image and the carrier image into the generator to obtain the secret image, which is then sent to the receiving end. The receiving end inputs the received secret image into the extractor to extract and recover the secret image.

[0113] To better illustrate the technical solution of this invention, specific examples are used to conduct experimental verification. Three datasets were used in this verification: ImageNet, COCO, and DIV2K. Several state-of-the-art image hiding methods were selected as comparison methods, including HiDDeN, Weng et al., Baluja, and DAH-Net. Details can be found in the literature "Hidden: Hiding data with deep networks", "High-capacity convolutional video steganography with temporal residual modeling", "Hiding images within images", and "Deep adaptive hiding network for image hiding using attentive frequency extraction and gradual depth extraction". Four objective evaluation metrics were used to assess the performance of this invention and the various comparison methods in this verification: Peak Signal-to-Noise Ratio (PSNR), Structural Similarity (SSIM), Mean Absolute Error (MAE), and Root Mean Square Error (RMSE). Table 1 compares the evaluation metrics of this invention and the comparison methods in this embodiment.

[0114]

[0115] Table 1

[0116] As shown in Table 1, the experimental results of the method of this invention on the three datasets are significantly better than other comparative methods. Analysis reveals that this superiority stems from the hybrid attention mechanism employed in this invention, which spans both spatial and channel domains. By cleverly utilizing this hybrid attention mechanism, this invention effectively captures and utilizes relevant information from both the carrier image and the secret image during the generation of the cryptic image. This allows for more accurate fusion of the two images, producing a high-quality cryptic image and ensuring better preservation of the hidden secret image information, thereby improving the accuracy of subsequent secret image recovery.

[0117] Figure 10 This is a comparison diagram showing the effects of the present invention and the comparison method in restoring secret images in this embodiment. For example... Figure 10As shown, the quality of the encrypted image generated by this invention far surpasses that of encrypted images produced by other comparison methods, and the recovery accuracy of the extracted secret image is also significantly higher than that of other comparison methods. Even when the residual image of the encrypted image and the carrier image is magnified 50 times, this invention can still ensure that the information of the secret image is not exposed, thus achieving efficient information security protection.

[0118] Although the illustrative specific embodiments of the present invention have been described above to enable those skilled in the art to understand the invention, it should be understood that the invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the invention as defined and determined by the appended claims, and all inventions utilizing the concept of the present invention are protected.

Claims

1. An image steganography method based on a hybrid attention mechanism and a generative adversarial network, characterized in that, Includes the following steps: S1: Construct a generative adversarial network (GAN) according to actual needs, including a generator and a discriminator. The generator generates a secret image based on the secret image and the carrier image, and the discriminator distinguishes between the carrier image and the secret image to obtain a result indicating whether it is the carrier image. The generator includes a secret image feature extraction module, a carrier image feature extraction module, a feature fusion module, a first convolution module, a first hybrid attention mechanism module, a second convolution module, a second hybrid attention mechanism module, and a third convolution module, wherein: The secret image feature extraction module is used to extract features from secret images and send the extracted secret image feature map to the feature fusion module; The carrier image feature extraction module is used to extract features from the carrier image and send the extracted carrier image feature map to the feature fusion module; The feature fusion module is used to concatenate the secret image feature map and the carrier image feature map, and send the resulting fused feature map to the first convolution module; The first convolutional module is used to perform convolution operations on the fused feature map and send the resulting feature map to the first hybrid attention module. The first hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the second convolution module. The second convolutional module is used to perform convolution operations on the received feature map and output the resulting feature map to the second hybrid attention module. The second hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the third convolution module. The third convolution module is used to perform convolution operations on the received feature map and output the resulting feature map as a dense image. S2: An extractor is configured to extract and recover the secret image from the dense image, based on the actual situation. This includes a first convolutional module, a first hybrid attention module, a second convolutional module, a second hybrid attention module, and a third convolutional module, wherein: The first convolution module is used to perform convolution operations on dense images and send the resulting feature maps to the first hybrid attention module. The first hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the second convolution module. The second convolution module is used to perform convolution operations on the received feature map and send the resulting feature map to the second hybrid attention module. The second hybrid attention module is used to process the received feature map using channel attention and spatial attention mechanisms, and then sends the resulting feature map to the third convolution module. The third convolution module is used to perform convolution operations on the received feature maps to obtain the recovered secret image; S3: The generative adversarial network and the extractor are jointly trained using the following method: S3.1: Set up several pairs of secret images and carrier images according to actual needs to form a training sample set; S3.2: Initialize the parameters of the generator and discriminator in the generative adversarial network, and initialize the parameters of the extractor at the same time; S3.3: Fix the parameters of the generator and extractor, extract several pairs of secret images and carrier images from the training sample set, input them into the generator to generate secret images, and then input the secret images and corresponding carrier images into the discriminator for discrimination, and calculate the discrimination loss L. D The parameters of the discriminator are updated; the above process is repeated several times to update the parameters of the discriminator, and then the process proceeds to step S3.

4. S3.4: With the discriminator parameters fixed, extract several pairs of secret images and carrier images from the training sample set, input them into the generator to generate secret images, and then input the secret images into the extractor to extract and recover the secret images. Calculate the generation-extraction loss L. T The parameters of the generator and extractor are updated; the generation-extraction loss L T The calculation formula is as follows: L T =λ1L C +λ2L G +L R Where λ1 and λ2 represent preset weights, and L C L represents the image hiding loss between the carrier image and the dense image. G L represents the adversarial loss of the generator. R The loss between the secret image and the recovered secret image is calculated using the following formulas: L G (I C' )=log(1-D(I C' )) Where |||2 represents finding the L2 norm, I C I C′ These represent the corresponding carrier image and the dense image, respectively. D() represents the discrimination result of the discriminator, and I S I S′ These represent the corresponding secret image and the recovered secret image, respectively, and C′, H′, and W′ represent the number of feature channels, height, and width of the secret image and the carrier image, respectively. S3.5: Determine whether the training termination condition has been met. If it has, the training ends; otherwise, return to step S3.

3. S4: Deploy the trained generator at the sending end and the extractor at the receiving end; the sending end inputs the secret image and the carrier image into the generator to obtain the secret image and sends it to the receiving end; the receiving end inputs the received secret image into the extractor to extract and recover the secret image.

2. The image steganography method according to claim 1, characterized in that, Each hybrid attention module in steps S1 and S2 includes a channel attention module, a channel weight fusion module, a spatial attention module, and a spatial weight fusion module, wherein: The channel attention module is used to process the input feature map based on the channel attention mechanism. The process involves processing, where C, H, and W represent the number of feature channels, height, and width of the input feature map, respectively, resulting in the channel weight vector M. C ∈R C×1×1 Send to the channel weight fusion module; The channel weight fusion module is used to combine the channel weight vectors. The weighted feature map is obtained by element-wise multiplication with the input feature map F. And send it to the spatial attention module and the spatial weight fusion module; The spatial attention module is used to process the feature map F′ based on the spatial attention mechanism to obtain the spatial weight feature map. Send to the spatial weight fusion module; The spatial weight fusion module is used to fuse spatial weight feature maps. The final feature map is obtained by element-wise multiplication with the feature map F′.

3. The image steganography method according to claim 2, characterized in that, The channel attention module includes a channel average pooling module, a channel max pooling module, convolutional layers, a concatenation module, and a sigmoid layer, wherein: The channel average pooling module is used to perform average pooling on the spatial information of the input feature map F, resulting in an average pooled feature map. And send it to the convolutional layer; The channel max pooling module is used to input the feature map F and perform max pooling on the spatial information of the feature map to obtain the max pooled feature map. And send it to the convolutional layer; Convolutional layers are used to process average pooling feature maps. Max pooling feature map After performing convolution on each component, the resulting feature vectors are sent to the concatenation module. The concatenation module is used to concatenate two received vectors to obtain the channel weight vector. And send it to the sigmoid layer; The sigmoid layer is used to apply the sigmoid activation function to the channel weight vector. This process maps the weights of each channel to a range of 0 and 1, resulting in a channel weight vector.

4. The image steganography method according to claim 2, characterized in that, The spatial attention module includes a spatial average pooling module, a spatial max pooling module, a concatenation module, convolutional layers, and a sigmoid layer, wherein: The spatial average pooling module is used to perform average pooling on the channel information of the input feature map F′ to obtain the average pooled feature map. And send it to the splicing module; The spatial max pooling module is used to perform max pooling on the channel information of the input feature map F to obtain the max pooled feature map. And send it to the splicing module; The stitching module is used to stitch together average pooling feature maps. Max pooling feature map After splicing, the spliced ​​feature map is sent to the convolutional layer; Convolutional layers are used to perform convolution operations on the concatenated feature maps, resulting in channel weight vectors. And send it to the sigmoid layer; The sigmoid layer is used to apply the sigmoid activation function to the channel weight vector. This process maps the weights of each channel to a range of 0 and 1, resulting in a channel weight vector.

5. The image steganography method according to claim 1, characterized in that, The discriminator in step S1 includes a feature extraction module, an average pooling layer, and a linear layer, wherein: The feature extraction module is used to extract features from the input image and send the obtained feature map to the average pooling layer; The average pooling layer is used to perform average pooling on the received feature map, reducing the spatial dimension of the image to 1×1, and then sending the resulting feature map to the linear layer. The linear layer is used to process the received feature map, reduce the output dimension to 1, and obtain the discrimination result of whether the input image is a dense image.