Endoscope image enhancement method and system based on Retinex theory and GAN
Through the endoscopic image enhancement method based on Retinex theory and GAN, the problems of uneven illumination and low contrast in endoscopic images are solved, and the image quality is improved. Through the combination of decomposition network and generator, self-attention is used mechanism and pyramid structure, ensuring higher quality image output.
Patent Information
- Application Number
- CN202410778340.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-08-30
AI Technical Summary
During endoscopy, the images obtained often suffer from uneven illumination, low contrast, and insufficient brightness, causing doctors to face challenges in the diagnosis and surgical decision-making process.
An endoscopic image enhancement method based on Retinex theory and GAN is used to construct an endoscopic image enhancement model by acquiring low-quality and high-quality image data sets, and the fine-tuned decomposition network, generator and discriminator are used for image decomposition and reconstruction. , combined with the self-attention mechanism and pyramid structure, to achieve illumination correction and image detail improvement.
Improves image contrast and brightness, enhances image quality, avoids catastrophic forgetting, and ensures higher quality image output.
Smart Images

Figure CN118570084A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image enhancement technology, and more specifically to an endoscopic image enhancement method and system based on Retinex theory and GAN. Background Art
[0002] As one of the most widely used medical devices today, endoscopes play an important role in achieving non-invasive, precise and personalized treatment plans. An endoscope is a miniature tool equipped with a large number of optical and imaging devices that can enter the body through natural cavities or tiny incisions to obtain direct visual observation of the body's internal structures and organs. However, during the endoscopic examination process, due to the complexity of the internal environment of the human body, such as light attenuation, difficult-to-observe areas, and noise interference, the images obtained often have unavoidable problems such as uneven lighting, low contrast, and insufficient brightness, which will pose certain challenges to doctors in the diagnosis and surgical decision-making process.
[0003] In order to overcome these limitations and improve the effect of endoscopic technology, it is of great significance to study endoscopic image enhancement algorithms. Existing studies have proposed many medical image enhancement methods, which are mainly divided into traditional medical image enhancement methods and image enhancement methods based on deep learning. Among them, the deep learning generative adversarial network (GAN) algorithm has shown outstanding performance in image super-resolution and low-light image enhancement in recent years, which has greatly promoted the development of deep learning technology in the field of image enhancement.
[0004] Therefore, how to use generative adversarial networks to avoid uneven lighting, low contrast, insufficient brightness, etc. in images is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] In view of this, the present invention provides an endoscopic image enhancement method and system based on Retinex theory and GAN, which solves the problems existing in the background technology.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] An endoscopic image enhancement method based on Retinex theory and GAN includes the following steps:
[0008] Obtain low-quality and high-quality images collected by different endoscopes to build an endoscopic image dataset;
[0009] The endoscope image dataset is divided into a training set and a test set according to a preset ratio;
[0010] An endoscopic image enhancement model is constructed, and the training set is input into the endoscopic image enhancement model for training until the loss function converges, thereby obtaining a trained endoscopic image enhancement model;
[0011] The trained endoscopic image enhancement model is used to perform image enhancement on the test set to obtain the target enhanced image.
[0012] Optionally, the endoscopic image enhancement model includes: a fine-tuned decomposition network Retinex-Net, a generator, and a discriminator;
[0013] The fine-tuned decomposition network Retinex-Net is used to perform Retinex decomposition on the input low-quality image and high-quality image respectively to obtain the corresponding illumination component and reflection component;
[0014] The generator is used to learn the characteristics and details of the illumination components in low-quality images and generate pictures similar to high-quality images to deceive the discriminator;
[0015] The discriminator detects whether the illumination components of the images produced by the generator are similar to those in the high-quality images.
[0016] Optionally, the fine-tuned decomposition network Retinex-Net is obtained by retraining the pre-trained Retinex-Net using the training set and fine-tuning the network weights.
[0017] Optionally, the generator adopts a three-layer pyramid structure guided by a self-attention mechanism, starts feature extraction from the image with the lowest resolution, multiplies the final extracted feature map with the attention weight map, and finally performs channel splicing with the features extracted from the previous layer of branches, repeats the above operation to reconstruct the image in the branch of the original size image to obtain the normal lighting component.
[0018] Optionally, the generator performs multi-scale pooling operations on the input feature map by introducing a pyramid pooling module, and concatenates the pooling results of each scale to fuse image information of different scales.
[0019] Optionally, the discriminator adopts a self-supervised method based on image rotation, using the rotation angle as a manual label and predicting the rotation angle of the image as a self-supervised task.
[0020] Optionally, the loss function is calculated as:
[0021]
[0022] Where: L G represents the generator loss, L Drepresents the discriminator loss; V(G,D) represents the original value function of GAN training; α and β represent weight parameters; x = G(z), represents the deterministic mapping given by the generator; P G represents the distribution obtained by transforming the simple distribution z~P(z) using the deterministic mapping x=G(z) given by the generator, P data represents the real data distribution, P D represents the Bernoulli distribution of the discriminator on the label, Indicates that x is in P G The expected value under the distribution, Indicates that x is in P data The expected value under the distribution; r∈R, R represents the rotation angle; Q D (R = rx r ) represents the predicted distribution of the discriminator on the sample rotation angle; E r~R represents the expected value of r.
[0023] An endoscopic image enhancement system based on Retinex theory and GAN for implementing the above method comprises:
[0024] A data acquisition module is used to acquire low-quality images and high-quality images collected by different endoscopes and construct an endoscopic image dataset;
[0025] A partitioning module, used for partitioning the endoscope image data set into a training set and a test set in a preset ratio;
[0026] The model building and training module is used to build an endoscopic image enhancement model, input the training set into the endoscopic image enhancement model for training, until the loss function converges, and obtain a trained endoscopic image enhancement model;
[0027] The image enhancement module is used to perform image enhancement on the test set using the trained endoscopic image enhancement model to obtain a target enhanced image.
[0028] It can be seen from the above technical solutions that, compared with the prior art, the present invention provides an endoscopic image enhancement method and system based on Retinex theory and GAN, which has the following beneficial effects:
[0029] (1) The present invention retrains Retinex-Net on an endoscopic image dataset to fine-tune the decomposition network weights, thereby improving the universality of the decomposition network on the endoscopic image dataset and providing a suitable decomposition image for illumination correction;
[0030] (2) The present invention starts feature extraction from the image with the lowest resolution through a pyramid structure generator, then multiplies the final feature map extracted by the attention weight map, and finally performs channel splicing with the features extracted from the previous layer branch, repeats the above operation to reconstruct the image in the branch of the original size image, and obtains the normal illumination component;
[0031] (3) The present invention introduces a pyramid pooling module to perform multi-scale pooling operations on the input feature map, and splices the pooling results of each scale, so as to fuse image information of different scales while maintaining the original feature resolution;
[0032] (4) The present invention avoids catastrophic forgetting by adding self-supervision information to the discriminator, so that the discriminator can learn more stable feature information, thereby obtaining higher quality images. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0034] Figure 1 A network architecture diagram of the endoscopic image enhancement method based on Retinex theory and GAN provided by the present invention;
[0035] FIG2( a ) is a training set provided by the present invention;
[0036] FIG2( b ) is a test set provided by the present invention;
[0037] Figure 3 A decomposition network model diagram provided by the present invention;
[0038] Figure 4 A structural diagram of a generator of a pyramid structure provided by the present invention;
[0039] Figure 5 A structural diagram of a discriminator based on self-supervision provided by the present invention;
[0040] Figure 6 A structural diagram of the pyramid pooling module provided by the present invention;
[0041] Figure 7 This is a result diagram for qualitative comparison between the present invention and other typical model methods. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] The embodiment of the present invention discloses an endoscopic image enhancement method based on Retinex theory and GAN, comprising the following steps:
[0044] Obtain low-quality and high-quality images collected by different endoscopes to build an endoscopic image dataset;
[0045] The endoscope image dataset is divided into a training set and a test set according to a preset ratio;
[0046] An endoscopic image enhancement model is constructed, and the training set is input into the endoscopic image enhancement model for training until the loss function converges, thereby obtaining a trained endoscopic image enhancement model;
[0047] The trained endoscopic image enhancement model is used to perform image enhancement on the test set to obtain the target enhanced image.
[0048] Furthermore, if Figure 1 As shown, the endoscopic image enhancement model includes: a fine-tuned decomposition network Retinex-Net, a generator, and a discriminator;
[0049] The fine-tuned decomposition network Retinex-Net is used to perform Retinex decomposition on the input low-quality image and high-quality image respectively to obtain the corresponding illumination component and reflection component;
[0050] The generator is used to learn the characteristics and details of the illumination components in low-quality images and generate pictures similar to high-quality images to deceive the discriminator;
[0051] The discriminator is used to detect whether the illumination component of the image generated by the generator is similar to the illumination component in the high-quality image, thereby inducing the generator to produce a better quality image and achieving the effect of improving the quality of the input image.
[0052] In this embodiment, due to the difficulty in obtaining access due to human privacy, there is currently no dedicated human endoscopy image data set for image enhancement. This technical solution uses a CMOS (complementary metal oxide semiconductor) image sensor dedicated to endoscopes and an endoscope system developed by Hefei Deming Electronics Co., Ltd. to obtain a total of 147 low-light and normal-light images of various parts of the chicken for the training set, as shown in Figure 2(a). In addition, in order to ensure the generalization of the proposed algorithm, in cooperation with the First Affiliated Hospital of Anhui Medical University, the Second Affiliated Hospital of Anhui Medical University and other hospitals, 40 endoscopic images of poor quality were saved frame by frame from minimally invasive surgery videos as a test set, as shown in Figure 2(b).
[0053] Furthermore, the fine-tuned decomposition network Retinex-Net is obtained by retraining the pre-trained Retinex-Net using the training set, fine-tuning the network weights, improving the universality of the decomposition network on endoscopic images, and providing a suitable decomposition image for illumination correction. Figure 3 As shown in the figure, the two images are decomposed using the same network weights, f1-f7 are the extracted feature maps, the number of feature channels of f1-f6 is 64, the number of feature channels of f7 is 4, the first three channels are reflection components, and the last channel is the illumination component; the first layer of the model is a 9*9 convolution, and the rest are 3*3 convolutions.
[0054] Furthermore, if Figure 4 As shown in Figure 1, the generator adopts a three-layer pyramid structure guided by the self-attention mechanism, which adjusts the input L1 into two downsampled versions, which are 1 / 2 and 1 / 4 times the original size, named L2 and L3. Figure 4 In the example, CONV is a 3*3 convolutional neural network. 1 It is a 1*1 convolutional neural network, CONV R is the CONV+RELU activation function; downsampling uses the maximum pooling with a kernel size of 2 and a step size of 2. These three inputs first start feature extraction from the image with the lowest resolution, multiply the final feature map extracted by the attention weight map, and finally perform channel splicing with the features extracted from the previous branch. Repeat the above operation to reconstruct the image in the branch of the original size image to obtain the normal illumination component. Among them, since the resolution of the two bottom branches is small, a higher receptive field can be obtained without special convolution processing. Therefore, there are a small number of 3*3 convolution layers in the two branches with lower resolution. In addition, in order to reduce the amount of calculation, this embodiment uses 1*1 convolution to halve the number of channels after each feature splicing.
[0055] In order to ensure that in the feature extraction process of the original size image, not only the network receptive field can be improved, but also the global feature information can be effectively integrated, this embodiment not only uses a small number of 3*3 convolutional layers in the feature extraction process, but also adds a pyramid pooling module (PPM) to better retain detail information. Figure 5 As shown in the figure, this module uses adaptive average pooling operation to generate feature maps of four sizes: 1*1, 2*2, 3*3 and 6*6. After these feature maps are subjected to 1*1 convolution, the number of channels is compressed, and then the feature maps are upsampled using bilinear interpolation to make them consistent with the size of the original image. Finally, they are spliced on the channels so that the network can extract more feature information that is beneficial to image reconstruction.
[0056] Furthermore, if Figure 6 As shown, the discriminator is a classifier in which the distribution of one class (fake samples) changes as the generator changes during training. In a non-stationary online environment, the neural network will forget the previous task. If the discriminator forgets the previous classification boundary, the training may become unstable or loop. One way to solve this problem is to enhance the discriminator with additional supervision information so that the discriminator learns more stable feature information, thereby avoiding catastrophic forgetting. Therefore, this embodiment adopts a self-supervised method based on image rotation, in which the image is rotated, the rotation angle becomes an artificial label, and the self-supervised task is to predict the rotation angle of the image.
[0057] like Figure 6 As shown in the figure, the discriminator D performs two tasks: true and false binary classification and rotation classification. The fake images and real images are rotated by 0, 90, 180, and 270 degrees respectively. The colored arrows indicate the generation of "upright" images, which are then rotated and fed to the discriminator; on the other hand, the training discriminator only detects the rotation angle based on the real data, that is, the parameters of the discriminator are only updated according to the rotation loss on the real data, thus, the following loss function is obtained:
[0058]
[0059] Where: L G represents the generator loss, L D represents the discriminator loss; V(G,D) represents the original value function of GAN training; α and β represent weight parameters; x = G(z), represents the deterministic mapping given by the generator; P G represents the distribution obtained by transforming the simple distribution z~P(z) using the deterministic mapping x=G(z) given by the generator, P data represents the real data distribution, P D represents the Bernoulli distribution of the discriminator on the label, Indicates that x is in P G The expected value under the distribution, Indicates that x is in P data The expected value under the distribution; r∈R, R represents the rotation angle; Q D (R = rx r ) represents the predicted distribution of the discriminator on the sample rotation angle; E r~R represents the expected value of r.
[0060] Next, qualitative and quantitative experiments are used to verify the endoscopic image enhancement method based on Retinex theory and GAN. In the experiment, the method of this embodiment is compared with 6 different typical methods, including: CLAHE, MSRCR, deep Retinex decomposition for low-light enhancement, Zero-DCE++, EnlightenGAN, and the application of brightness-aware pyramid network in low-light image enhancement. Figure 7 From the visual comparison between the method of this embodiment and different competing methods, it can be qualitatively seen that the method of this embodiment is obviously superior to the other six classic image enhancement algorithms in terms of contrast improvement, brightness optimization, illumination correction, and detail preservation.
[0061] In this experiment, the full reference indicators peak signal-to-noise ratio (PSNR), structural similarity (SSIM) and the reference-free indicators learning perceptual image patch similarity (LPIPS) and natural image quality (NIQE) can also be used to quantitatively evaluate the image enhancement performance. In order to verify the universality and generalization of the proposed algorithm, the four evaluation indicators of the proposed algorithm and the other six algorithms on the entire test set (a total of 40 endoscopic images) are calculated and the results are averaged. As shown in Table 1, the objective evaluation indicators of the algorithm proposed in this embodiment exceed the indicator values of the comparative experiment, which clearly shows that the proposed algorithm is superior to other comparative algorithms in enhancing endoscopic images.
[0062] Table 1 Comparison of average indicators of different algorithms
[0063]
[0064]
[0065] Corresponding to the above method, an embodiment of the present invention further provides an endoscopic image enhancement system based on Retinex theory and GAN, which is used for the specific implementation of the method. An endoscopic image enhancement system based on Retinex theory and GAN provided by an embodiment of the present invention can be applied to a computer terminal or various mobile devices, and specifically includes:
[0066] A data acquisition module is used to acquire low-quality images and high-quality images collected by different endoscopes and construct an endoscopic image dataset;
[0067] A partitioning module, used for partitioning the endoscope image data set into a training set and a test set in a preset ratio;
[0068] The model building and training module is used to build an endoscopic image enhancement model, input the training set into the endoscopic image enhancement model for training, until the loss function converges, and obtain a trained endoscopic image enhancement model;
[0069] The image enhancement module is used to perform image enhancement on the test set using the trained endoscopic image enhancement model to obtain a target enhanced image.
[0070] In summary, this embodiment obtains corresponding illumination components and reflection components by performing Retinex decomposition on low-quality images and high-quality images respectively; the generator generates pictures similar to high-quality images by learning the characteristics and detail information of the illumination components in low-quality images to deceive the discriminator; the discriminator detects whether the illumination components generated by the generator are similar to the illumination components in normal illumination images, thereby inducing the generator to generate better quality images; the corrected illumination components and the corresponding reflection components are reconstructed to achieve the effect of enhancing the low-quality images.
[0071] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0072] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An endoscopic image enhancement method based on Retinex theory and GAN, characterized in that: The following steps are involved: Obtain low-quality and high-quality images collected by different endoscopes to build an endoscopic image dataset; The endoscope image dataset is divided into a training set and a test set according to a preset ratio; An endoscopic image enhancement model is constructed, and the training set is input into the endoscopic image enhancement model for training until the loss function converges, thereby obtaining a trained endoscopic image enhancement model; The trained endoscopic image enhancement model is used to perform image enhancement on the test set to obtain the target enhanced image.
2. According to claim 1, the endoscopic image enhancement method based on Retinex theory and GAN is characterized in that: The endoscopic image enhancement model includes: a fine-tuned decomposition network Retinex-Net, a generator, and a discriminator; The fine-tuned decomposition network Retinex-Net is used to perform Retinex decomposition on the input low-quality image and high-quality image respectively to obtain the corresponding illumination component and reflection component; The generator is used to learn the characteristics and details of the illumination components in low-quality images and generate pictures similar to high-quality images to deceive the discriminator; The discriminator detects whether the illumination components of the images produced by the generator are similar to those in the high-quality images.
3. The endoscopic image enhancement method based on Retinex theory and GAN according to claim 2 is characterized in that: The fine-tuned decomposition network Retinex-Net is obtained by retraining the pre-trained Retinex-Net using the training set and fine-tuning the network weights.
4. The endoscopic image enhancement method based on Retinex theory and GAN according to claim 2, characterized in that: The generator adopts a three-layer pyramid structure guided by the self-attention mechanism. It starts feature extraction from the image with the lowest resolution, multiplies the final extracted feature map with the attention weight map, and finally performs channel splicing with the features extracted from the previous layer of branches. Repeat the above operation to reconstruct the image in the branch of the original size image to obtain the normal lighting component.
5. The endoscopic image enhancement method based on Retinex theory and GAN according to claim 2, characterized in that: The generator introduces a pyramid pooling module to perform multi-scale pooling operations on the input feature map, and splices the pooling results of each scale to fuse image information of different scales.
6. The endoscopic image enhancement method based on Retinex theory and GAN according to claim 2, characterized in that: The discriminator adopts a self-supervised method based on image rotation, with the rotation angle as the manual label and predicting the rotation angle of the image as the self-supervised task.
7. The endoscopic image enhancement method based on Retinex theory and GAN according to claim 1, characterized in that: The loss function is calculated as: Where: L G represents the generator loss, L D represents the discriminator loss; V(G,D) represents the original value function of GAN training; α and β represent weight parameters; x = G(z), represents the deterministic mapping given by the generator; P G represents the distribution obtained by transforming the simple distribution z~P(z) using the deterministic mapping x=G(z) given by the generator, P data represents the real data distribution, P D represents the Bernoulli distribution of the discriminator on the label, Indicates that x is in P G The expected value under the distribution, Indicates that x is in P data The expected value under the distribution; r∈R, R represents the rotation angle; Q D (R = rx r ) represents the predicted distribution of the discriminator on the sample rotation angle; E r~R represents the expected value of r.
8. An endoscopic image enhancement system based on Retinex theory and GAN that implements the method according to any one of claims 1 to 7, characterized in that: include: A data acquisition module is used to acquire low-quality images and high-quality images collected by different endoscopes and construct an endoscopic image dataset; A partitioning module, used for partitioning the endoscope image data set into a training set and a test set in a preset ratio; The model building and training module is used to build an endoscopic image enhancement model, input the training set into the endoscopic image enhancement model for training, until the loss function converges, and obtain a trained endoscopic image enhancement model; The image enhancement module is used to perform image enhancement on the test set using the trained endoscopic image enhancement model to obtain a target enhanced image.
