Method for generating image based on generative adversarial network

By introducing a dynamic uniform sampling layer in the decoding layer of the generative adversarial network, the problem of alternating patterns in images generated by GAN is solved, the quality and authenticity of the image are improved, the computational burden is reduced, and the flexibility of the network is enhanced.

CN118710759AActive Publication Date: 2024-09-27南昌大学第一附属医院
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411210605.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-09-27
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

The alternating patterns generated by Generative Adversarial Networks (GAN) in the process of generating images lead to a decrease in image quality, especially in fields with high accuracy requirements such as rehabilitation medical image analysis, which may lead to misjudgments, and the existing technology increases the network The complexity and computational burden limit flexibility.

Method used

A dynamic uniform sampling layer is introduced in the decoding layer of the generative adversarial network to reduce the generation of alternating textures through dynamic uniform sampling under constrained states, ensuring the quality and authenticity of image generation.

Benefits of technology

It effectively reduces the alternating patterns in the generated images, improves the realism and quality of the images, reduces the computational burden, and enhances the flexibility of the network and the accuracy of the generated images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710759A
    Figure CN118710759A
Patent Text Reader

Abstract

The invention discloses a method for generating an image based on a generative adversarial network, and the method comprises the steps: setting a dynamic uniform sampling layer in a decoding layer in an image generation model based on the generative adversarial network, and carrying out the dynamic uniform sampling of an image of an input model in a constraint state, thereby reducing the alternate reticulate patterns of a reconstructed image generated by the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image generation, and in particular relates to an image generation method based on a generative adversarial network. Background Art

[0002] Generative adversarial networks can generate completely new images. In rehabilitation medical imaging, researchers have used GANs for reconstruction, segmentation, image synthesis, classification, detection and other tasks. However, images generated by GANs may have unique textures, namely alternating reticulations. These artifacts may distort the information collected in rehabilitation medical images, disrupt the judgment of medical staff, and diagnose recovery when the patient is not fully recovered, which may have serious consequences.

[0003] In addition, alternating reticulations can also have an adverse effect on the visual perception of the generated image, making the image look incomplete and have obvious artificial traces. In other words, alternating reticulations not only destroy the integrity of the image, but also reduce the quality of the information it carries. The existing technology first has significant complexity and redundancy problems. In order to reduce alternating reticulations, the current common method is to repeatedly introduce additional steps before specific operations, such as rigidly adding fixed convolutional layers in upsampling and downsampling layers, or rigidly adding resize operations before performing transposed convolutions. Although these practices can alleviate the artifact problem to a certain extent, they significantly increase the number of layers and parameters of the network, thereby greatly increasing the computational burden. This not only makes practical applications difficult, but also limits the flexibility of the network when deployed. Secondly, the existing technology does not specifically solve the problem of uneven sampling of transposed convolutions on key objects. Treating all areas equally will lead to inevitable omissions that may appear in key areas, thereby affecting the quality and anti-forensic capabilities of the entire generated image. In addition, the existing technology still needs to be improved in the effect of eliminating alternating reticulations. This is especially true in areas that require increasingly higher precision, such as rehabilitation image analysis or autonomous driving. These areas have extremely high requirements for image quality, and any subtle artifacts may affect the accuracy of decision-making.

[0004] By deeply studying and learning different GAN-related technologies, the present invention designs a unique method to eliminate alternating textures, thereby significantly improving the quality and realism of generated images.

[0005] In order to generate new images, the generator in GAN often adopts an encoder-decoder framework. In this framework, the data is first downsampled by the encoder to convert high-dimensional information into a low-dimensional feature vector; then, the decoder upsamples this feature vector to reconstruct the original image. Among the many upsampling methods, transposed convolution is favored for its efficiency and intuitiveness, and is widely used in various GAN models. However, the transposed convolution layer is also the main reason for the generation of alternating reticulation in GAN, which is caused by the "uneven sampling" phenomenon of transposed convolution, making the color of some areas in the image darker than other areas. As an unnatural product of GAN, alternating reticulation seriously affects the authenticity of the generated image and can even be regarded as the introduction of false information. Especially in the field of rehabilitation medical image analysis, which requires extremely high accuracy, the existence of alternating reticulation will seriously interfere with the key medical information in the image, causing medical staff to misjudge the rehabilitation status, which brings great risks to patients. Summary of the invention

[0006] In view of the technical problem in the prior art that a generative adversarial network will generate alternating patterns due to non-uniform sampling during the image generation process, the present invention provides an image generation method based on a generative adversarial network.

[0007] A method for generating an image based on a generative adversarial network, comprising the following steps: Step S1: construct a data set, the data set includes several groups of images, and the images include input images and label images; Step S2: construct an image generation model based on a generative adversarial network. The image generation model based on a generative adversarial network includes a generator and a discriminator. The generator includes an encoding layer, a conversion layer, and a decoding layer. The input image in step S1 is encoded through the encoding layer to obtain low-dimensional feature information. Step S3: Import the low-dimensional feature information in step S2 into the conversion layer of the image generation model to obtain conversion feature information; Step S4: import the converted image features in step S3 into the decoding layer of the image generation model to obtain a reconstructed image, and the discriminator in step S2 determines the authenticity of the reconstructed image; Wherein, in acquiring the reconstructed image, the decoding layer performs dynamic uniform sampling through the dynamic uniform sampling layer in a constrained state; Step S5: Train an image generation model based on a generative adversarial network according to the label image in step S1, construct a loss function and minimize the loss function to optimize the parameters of the model.

[0008] Furthermore, the encoding layer in step S2 is composed of the first convolutional layer, the second convolutional layer and the third convolutional layer connected in series. In step S2, the input feature is input into the encoder of the generator to obtain the low-dimensional feature information as follows: The encoding layer consists of three convolutional layers: the first convolutional layer, the second convolutional layer, and the third convolutional layer. These three convolutional layers extract the input features of the input in turn, which can be expressed as: ; in, Represents low-dimensional feature information, Indicates that 3 downsampling feature extraction operations are performed. Represents the input image.

[0009] Furthermore, the conversion layer in step S3 includes 9 residual network blocks connected in series, each residual network block consists of two convolutional layers connected in series, and the input data of each block is added to the output of each block, ensuring that the input data of the previous layer can directly affect the output of the last layer, thereby minimizing the difference between the original input and the corresponding output; step S3 is specifically: The residual network block of the conversion layer extracts and fuses the low-dimensional feature information in turn to obtain the conversion feature information, which is expressed as: ; in, Represents the conversion feature information, Indicates that 9 residual structure block downsampling feature conversion operations are performed.

[0010] Further, the decoding layer in step S4 includes a first transposed convolutional layer, a second transposed convolutional layer, and a dynamic uniform sampling layer in a constrained state, which are sequentially connected in series; Step S4 is specifically as follows: Step S41: Define a 3*3 kernel as the first grid in the first convolution transpose layer and express it as: ; in, represents the first grid of the first convolutional transposed layer, represents the coordinates of each point in the grid of the first convolutional transposed layer; Input the transformed image features on the grid of the first convolutional transpose layer and weight them with the convolution kernel to obtain the first output feature map, which is expressed as: ; in, represents the first output feature map, represents the first transposed convolution kernel, represents the transformed image features, Represents each point of the first output feature map; Step S42: In the second convolution transpose layer, a 3*3 kernel is defined as the second grid, and is expressed as: ; in, The second grid representing the second convolutional transposed layer, represents the coordinates of each point in the second grid; The first output feature map is input on the second grid and weighted with the second transposed convolution kernel to obtain the second output feature map, which is expressed as: ; in, represents the second output feature map, represents the second transposed convolution kernel, Represents each point of the second output feature map, represents the first output feature map; Step S43: The dynamic uniform sampling layer performs dynamic uniform sampling on the second output feature map in a constrained state by setting an offset, that is: ; in, represents the offset matrix, Indicates the offset matrix offset, Represents a predefined positive real number threshold, which is used to limit the size of the offset. Indicates conditional restrictions, ensuring that ( , )and( , )The Euclidean distance between two points will not exceed the preset parameters , Indicates the horizontal axis offset, Indicates the vertical coordinate offset; For each offset, first the following is calculated: ,then: ; in, express( , )and( , )The Euclidean distance between two points; The calculation method for each point on the second output feature map becomes: ; in, represents the reconstructed image, represents the convolution kernel of the dynamic uniform sampling layer under the constrained state, Represents each point of the reconstructed image; Since the offset may be a non-integer, bilinear interpolation is used to solve the pixel value of the offset point: ; in represents the pixel value corresponding to point Q, , represents the bilinear interpolation function, represents integer spatial position; The gradient formula of the offset is: ∂ Y ( P 3 ) ∂ △ x i = ∑ ( x i , y i ) ∈ G [ w ( x i , y i ) ∑ R ∂ X ( Q ) ∂ △ x i ] ; ∂ Y ( P 3 ) ∂ △ y i = ∑ ( x i , y i ) ∈ G [ w ( x i , y i ) ∑ R ∂ X ( Q ) ∂ △ y i ] ; in, Relative to of The gradient of Represents the corresponding point The weight of Relative to of The gradient of Relative to of The gradient of Relative to of gradient.

[0011] Further, the input image is a PET image, and the label image and the reconstructed image are CT images; or, the input image is a vascular tree image, and the label image and the reconstructed image are retinal images.

[0012] The positive and progressive effects of the present invention are:

[0013] The present invention sets a dynamic uniform sampling layer in a decoding layer in an image generation model based on a generative adversarial network, and performs dynamic uniform sampling under a constrained state on an image of an input model, thereby reducing alternating reticulations of a reconstructed image generated by the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 The present invention is a flowchart of an image generation method based on a generative adversarial network. DETAILED DESCRIPTION

[0015] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.

[0016] Reference Figure 1 , a method for generating an image based on a generative adversarial network, in one example, comprises the following steps: Step S1: construct a data set, the data set includes several groups of images, and the images include input images and label images; Step S2: construct an image generation model based on a generative adversarial network. The image generation model based on a generative adversarial network includes a generator and a discriminator. The generator includes an encoding layer, a conversion layer, and a decoding layer. The input image in step S1 is encoded through the encoding layer to obtain low-dimensional feature information. Step S3: Import the low-dimensional feature information in step S2 into the conversion layer of the image generation model to obtain conversion feature information; Step S4: import the converted image features in step S3 into the decoding layer of the image generation model to obtain a reconstructed image, and the discriminator in step S2 determines the authenticity of the reconstructed image; Wherein, in acquiring the reconstructed image, the decoding layer performs dynamic uniform sampling through the dynamic uniform sampling layer in a constrained state; Step S5: Train an image generation model based on a generative adversarial network according to the label image in step S1, construct a loss function and minimize the loss function to optimize the parameters of the model.

[0017] Furthermore, in one example, the encoding layer in step S2 is composed of a first convolutional layer, a second convolutional layer, and a third convolutional layer connected in series. In step S2, the input feature is input into the encoder of the generator to obtain the low-dimensional feature information as follows: The encoding layer consists of three convolutional layers: the first convolutional layer, the second convolutional layer, and the third convolutional layer. These three convolutional layers extract the input features of the input in turn, which can be expressed as: ; in, Represents low-dimensional feature information, Indicates that 3 downsampling feature extraction operations are performed. Represents the input image.

[0018] Furthermore, in one example, the conversion layer in step S3 includes 9 residual network blocks connected in series, each residual network block is composed of two convolutional layers connected in series, and the input data of each block is added to the output of each block, ensuring that the input data of the previous layer can directly affect the output of the last layer, thereby minimizing the difference between the original input and the corresponding output; step S3 is specifically: The residual network block of the conversion layer extracts and fuses the low-dimensional feature information in turn to obtain the conversion feature information, which is expressed as: ; in, Represents the conversion feature information, Indicates that 9 residual structure block downsampling feature conversion operations are performed.

[0019] Further, in one example, the decoding layer in step S4 includes a first transposed convolution layer, a second transposed convolution layer, and a dynamic uniform sampling layer in a constrained state, which are sequentially connected in series; Step S4 is specifically as follows: Step S41: Define a 3*3 kernel as the first grid in the first convolution transpose layer and express it as: ; in, represents the first grid of the first convolutional transposed layer, represents the coordinates of each point in the grid of the first convolutional transposed layer; Input the transformed image features on the grid of the first convolutional transpose layer and weight them with the convolution kernel to obtain the first output feature map, which is expressed as: ; in, represents the first output feature map, represents the first transposed convolution kernel, represents the transformed image features, Represents each point of the first output feature map; Step S42: In the second convolution transpose layer, a 3*3 kernel is defined as the second grid, and is expressed as: ; in, The second grid representing the second convolutional transposed layer, represents the coordinates of each point in the second grid; The first output feature map is input on the second grid and weighted with the second transposed convolution kernel to obtain the second output feature map, which is expressed as: ; in, represents the second output feature map, represents the first transposed convolution kernel, Represents each point of the second output feature map, represents the first output feature map; Step S43: The dynamic uniform sampling layer performs dynamic uniform sampling on the second output feature map in a constrained state by setting an offset, that is: ; in, represents the offset matrix, Indicates the offset matrix offset, Represents a predefined positive real number threshold, which is used to limit the size of the offset. Indicates conditional restrictions, ensuring that ( , )and( , )The Euclidean distance between two points will not exceed the preset parameters , Indicates the horizontal axis offset, Indicates the vertical coordinate offset; For each offset, first the following is calculated: ,then: ; in, express( , )and( , )The Euclidean distance between two points; The calculation method for each point on the second output feature map becomes: ; in, represents the reconstructed image, represents the convolution kernel of the dynamic uniform sampling layer under the constrained state, Represents each point of the reconstructed image; Since the offset may be a non-integer, bilinear interpolation is used to solve the pixel value of the offset point: ; in represents the pixel value corresponding to point Q, , represents the bilinear interpolation function, represents integer spatial position; The gradient formula of the offset is: ∂ Y ( P 3 ) ∂ △ x i = ∑ ( x i , y i ) ∈ G [ w ( x i , y i ) ∑ R ∂ X ( Q ) ∂ △ x i ] ; ∂ Y ( P 3 ) ∂ △ y i = ∑ ( x i , y i ) ∈ G [ w ( x i , y i ) ∑ R ∂ X ( Q ) ∂ △ y i ] ; in, Relative to of The gradient of Represents the corresponding point The weight of Relative to of The gradient of Relative to of The gradient of Relative to of gradient.

[0020] Furthermore, in one example, the input image is a PET image, and the label image and the reconstructed image are CT images; or, the input image is a vascular tree image, and the label image and the reconstructed image are retinal images.

[0021] The present invention is described in detail above in conjunction with the embodiments of the drawings, and those skilled in the art can make various variations of the present invention according to the above description. Therefore, certain details in the embodiments should not constitute limitations on the present invention, and the present invention shall be protected by the scope defined by the attached claims.

Claims

1. A method for generating images based on a generative adversarial network, characterized in that: The following steps are involved: Step S1: construct a data set, the data set includes several groups of images, and the images include input images and label images; Step S2: construct an image generation model based on a generative adversarial network. The image generation model based on a generative adversarial network includes a generator and a discriminator. The generator includes an encoding layer, a conversion layer, and a decoding layer. The input image in step S1 is encoded through the encoding layer to obtain low-dimensional feature information. Step S3: Import the low-dimensional feature information in step S2 into the conversion layer of the image generation model to obtain conversion feature information; Step S4: import the converted image features in step S3 into the decoding layer of the image generation model to obtain a reconstructed image, and the discriminator in step S2 determines the authenticity of the reconstructed image; Wherein, in acquiring the reconstructed image, the decoding layer performs dynamic uniform sampling through the dynamic uniform sampling layer in a constrained state; Step S5: Train an image generation model based on a generative adversarial network according to the label image in step S1, construct a loss function and minimize the loss function to optimize the parameters of the model.

2. A method for generating images based on a generative adversarial network as claimed in claim 1, characterized in that: The encoding layer in step S2 is composed of the first convolutional layer, the second convolutional layer and the third convolutional layer connected in series. In step S2, the input feature is input into the encoder of the generator to obtain the low-dimensional feature information as follows: The encoding layer consists of three convolutional layers: the first convolutional layer, the second convolutional layer, and the third convolutional layer. These three convolutional layers extract the input features of the input in turn, which can be expressed as: ; in, Represents low-dimensional feature information, Indicates that 3 downsampling feature extraction operations are performed. Represents the input image.

3. A method for generating images based on a generative adversarial network as claimed in claim 2, characterized in that: The conversion layer in step S3 includes 9 residual network blocks connected in series. Each residual network block consists of two convolutional layers connected in series. The input data of each block will be added to the output of each block, ensuring that the input data of the previous layer can directly affect the output of the last layer, thereby minimizing the difference between the original input and the corresponding output. Step S3 is specifically as follows: The residual network block of the conversion layer extracts and fuses the low-dimensional feature information in turn to obtain the conversion feature information, which is expressed as: ; in, Represents the conversion feature information, Indicates that 9 residual structure block downsampling feature conversion operations are performed.

4. The method for generating an image based on a generative adversarial network as claimed in claim 3, characterized in that: The decoding layer in step S4 includes a first transposed convolutional layer, a second transposed convolutional layer, and a dynamic uniform sampling layer in a constrained state, which are sequentially connected in series; Step S4 is specifically as follows: Step S41: Define a 3*3 kernel as the first grid in the first convolution transpose layer and express it as: ; in, represents the first grid of the first convolutional transposed layer, represents the coordinates of each point in the grid of the first convolutional transposed layer; Input the transformed image features on the grid of the first convolutional transpose layer and weight them with the convolution kernel to obtain the first output feature map, which is expressed as: ; in, represents the first output feature map, represents the first transposed convolution kernel, represents the transformed image features, Represents each point of the first output feature map; Step S42: In the second convolution transpose layer, a 3*3 kernel is defined as the second grid, and is expressed as: ; in, The second grid representing the second convolutional transposed layer, represents the coordinates of each point in the second grid; The first output feature map is input on the second grid and weighted with the second transposed convolution kernel to obtain the second output feature map, which is expressed as: ; in, represents the second output feature map, represents the second transposed convolution kernel, Represents each point of the second output feature map, represents the first output feature map; Step S43: The dynamic uniform sampling layer performs dynamic uniform sampling on the second output feature map in a constrained state by setting an offset, that is: ; in, represents the offset matrix, Indicates the offset matrix offset, Represents a predefined positive real number threshold, which is used to limit the size of the offset. Indicates conditional restrictions, ensuring that ( , )and( , )The Euclidean distance between two points will not exceed the preset parameters , Indicates the horizontal axis offset, Indicates the vertical coordinate offset; For each offset, first the following is calculated: ,then: ; in, express( , )and( , )The Euclidean distance between two points; The calculation method for each point on the second output feature map becomes: ; in, represents the reconstructed image, represents the convolution kernel of the dynamic uniform sampling layer under the constrained state, Represents each point of the reconstructed image; Since the offset may be a non-integer, bilinear interpolation is used to solve the pixel value of the offset point: ; in represents the pixel value corresponding to point Q, , represents the bilinear interpolation function, represents integer spatial position; The gradient formula of the offset is: ; ; in, Relative to of The gradient of Represents the corresponding point The weight of Relative to of The gradient of Relative to of The gradient of Relative to of gradient.

5. The method for generating images based on a generative adversarial network according to claim 1, characterized in that: The input image is a PET image, and the label image and the reconstructed image are CT images; or, the input image is a vascular tree image, and the label image and the reconstructed image are retinal images.

Citation Information

Patent Citations

  • Electronic data generation method and system based on deformable convolutional generative adversarial network

    CN116071270A

  • Self-adaptive domain medical image cross-modal conversion method based on generative adversarial network

    CN117333371A

  • Multi-modal magnetic resonance image generation method, system and device based on generative adversarial network and medium

    CN117710754A

  • Techniques to use a neural network to expand an image

    US20210279841A1

  • Image processing method and system, and application of image processing method

    WO2023000244A1