Method for recovering infrared image to visible light image
By building a color enhancement adversarial network, using global loss function, brightness discriminator and color discriminator, the problem of poor detail characteristics and true color recovery during infrared image recovery is solved, and the high-quality recovery effect from infrared image to visible light image is achieved.
Patent Information
- Application Number
- CN202410892712.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-11-01
AI Technical Summary
The prior art is difficult to accurately restore the detailed features and true colors of the image when the infrared image is restored to the visible light image, resulting in poor recovery effect.
The global loss function, brightness discriminator and color discriminator were designed to build a color enhancement adversarial network, generate predicted images through feature encoder, intermediate layer and feature decoder, and provide feedback through brightness and color discriminators to train the global loss function. Until it no longer descends, the final color image is generated.
It effectively improves the image recovery quality, enhances color information and detailed information, and realizes high-quality recovery from infrared images to visible light images.
Smart Images

Figure CN118887110A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for restoring an infrared image to a visible light image. Background Art
[0002] Traditional methods of restoring infrared images to visible light images usually use specific color mapping techniques, based on manually preset parameters, using mathematical models and feature extraction to adjust the color balance and contrast of the image. In addition, interpolation algorithms are used to increase the resolution of the image. Although these methods improve the visual effect of the image to a certain extent, they often ignore the restoration of detailed features and true colors in the image.
[0003] In deep learning, image color enhancement has achieved remarkable results, such as the convolutional network architecture, which extracts different features in the image by stacking multiple convolutional layers and using different convolutional kernels. As the network level deepens, these simple features will be further combined to extract more complex features. Through the deep network model, color correction and restoration can be performed more accurately, significantly improving the visual quality and color richness of the image. However, there are still some challenges in the current technology. For example, it is difficult for neural networks to predict the color information and detail information of the image in the image restoration task, which is crucial to the quality and realism of the image. Summary of the invention
[0004] In view of the above-mentioned deficiencies of the prior art, the purpose of the present invention is to propose a method for restoring infrared images to visible light images, which effectively solves the distortion problem of detail feature restoration and the unreality of image color restoration through the designed global loss function, brightness discriminator and color discriminator.
[0005] Technical solution: In order to solve the above technical problems, the present invention adopts the following technical solution:
[0006] Step 1: Obtain an image data pair under an infrared image and a visible light image, and perform image preprocessing on the image data pair, that is, convert the infrared image and the visible light image under the image data pair from being displayed based on the RGB color space to being displayed based on the Lab color space, and decompose the image displayed under the Lab color space into a single brightness channel and a double color channel of the image, and then use a bilinear interpolation method to normalize the pixel values of the image data pair and scale them to a range of 0 to 1, and then divide the image data pair into an image training set and an image test set according to a ratio of 9:1, wherein the image training set includes paired infrared training images and visible light training images, and the image test set includes paired infrared test images and visible light test images;
[0007] Step 2: Construct a color enhancement adversarial network, which includes a color generator, a brightness discriminator and a color discriminator. Input the infrared training image into the color generator to generate a predicted image displayed based on the Lab color space; input the single brightness channel of the predicted image and the single brightness channel of the visible light training image into the brightness discriminator for judgment, and feed back the judgment result to the color generator; at the same time, input the color dual channels of the predicted image and the color dual channels of the visible light training image into the color discriminator for judgment, and feed back the judgment result to the color generator;
[0008] Step 3: Repeat step 2 to train the color enhancement adversarial network, that is, calculate the global loss function S including color enhancement and detail enhancement, and continue training until the value of the global loss function S no longer decreases, so as to obtain a trained color generator;
[0009] Step 4: Input the infrared test image into the trained color generator to generate the final restored color image.
[0010] In the step 1, the image data pairs under the infrared image and the visible light image are obtained from the KAIST public data set;
[0011] In the step 2, the color enhancement adversarial network includes a color generator, a brightness discriminator and a color discriminator;
[0012] The color generator is composed of a feature encoder, an intermediate layer and a feature decoder in sequence; wherein the infrared training image is input into the feature encoder of the color generator to extract the feature information of the infrared training image, then passes through the intermediate layer to further extract the deep feature information of the infrared training image, and finally passes through the feature decoder to obtain a predicted image;
[0013] The feature encoder is composed of three downsampling layers, each of which includes a convolution layer and a ReLU activation function; the convolution layer parameters of the three downsampling layers are 3, 64 and 128 channel inputs, 64, 128 and 256 channel outputs, and the convolution kernel sizes are 7×7, 3×3 and 3×3 respectively;
[0014] The intermediate layer is composed of eight residual blocks, and each residual block is connected by a jump connection; each residual block is composed of two convolutional layers, and the parameters of each convolutional layer in the residual block are 256.
[0015] The feature decoder is composed of two upsampling layers and an output layer, each upsampling layer includes a deconvolution and a ReLU activation function, and the output layer includes a convolution layer and a Tanh activation function; wherein the deconvolution layer parameters included in the two upsampling layers are 256 and 128 channel inputs, 128 and 64 channel outputs, and the convolution kernel size is 3×3; wherein the convolution layer parameters included in the output layer are 64 channel inputs, 3 channel outputs, and the convolution kernel size is 7×7;
[0016] The single brightness channel of the predicted image and the single brightness channel of the visible light training image are input into the brightness extraction layer under the brightness discriminator to extract the local brightness information of the predicted image and the visible light training image, and then the distribution difference of the local brightness information of the predicted image and the visible light training image is compared through the brightness judgment layer;
[0017] At the same time, the color dual channels of the predicted image and the color dual channels of the visible light training image are input into the color extraction layer under the color discriminator to extract the local color information of the predicted image and the visible light training image. Then, the color judgment layer is used to compare the distribution difference of the local color information of the predicted image and the visible light training image.
[0018] The brightness discriminator is composed of a brightness extraction layer and a brightness judgment layer in sequence, and the color discriminator is composed of a color extraction layer and a color judgment layer in sequence;
[0019] The brightness extraction layer and the color extraction layer are both composed of four convolutional layers, wherein the parameters of the convolutional layers are the same, which are 3, 64, 128 and 256 channel inputs, 64, 128, 256 and 512 channel outputs, respectively, and the convolution kernel size is 4×4, wherein each convolutional layer is followed by a Leaky ReLU activation function;
[0020] The brightness judgment layer and the color judgment layer are both composed of a downsampling layer, wherein the downsampling layer includes a convolution layer and a Sigmoid activation function, and the convolution layer parameters in the downsampling layer are consistent, all of which are 512-channel input, 1-channel output, and the convolution kernel size is 4×4;
[0021] The present invention uses four activation functions, namely ReLU activation function, Leaky ReLU activation function, Tanh activation function and Sigmoid activation function, which are defined as follows:
[0022]
[0023]
[0024] In step 3, the global loss function S is composed of the detail loss SH , color perception loss S C , brightness adversarial loss S L , color adversarial loss S ab Composition; the global loss function S is:
[0025] S=S H +S C +S L +S ab ;
[0026] The detail loss S H , applying high-pass Gaussian filtering to the predicted image and the visible light training image to obtain a detail pixel matrix of the predicted image and a detail pixel matrix of the visible light training image, and calculating the angle between the detail pixel matrix of the predicted image and the detail pixel matrix of the visible light training image by cosine similarity; the high-pass Gaussian filtering is used to obtain the detail pixel matrix of the image, wherein the Gaussian kernel standard deviation is set to 1.5, and the Gaussian convolution kernel size is set to 5×5;
[0027] The color perception loss S C , use the VGG-19 network on the predicted image and the visible light training image to obtain the predicted image structure pixel matrix and the visible light training image structure pixel matrix, and calculate the sum of the squares of the differences between the predicted image structure pixel matrix and the visible light training image structure pixel matrix by the 2 norm; the VGG-19 network was developed by the Visual Geometry Group of the University of Oxford, and contains 16 convolutional layers for feature extraction and 3 fully connected layers for classification. The convolutional layer extracts the edge, texture, shape and other features of the image layer by layer, and the fully connected layer integrates these features;
[0028] The brightness resistance loss S L , perform logarithmic operations on the brightness single channel of the predicted image and the brightness single channel of the visible light training image, calculate the brightness discriminator to judge the authenticity of the brightness single channel of the predicted image and the brightness single channel of the visible light training image, and the output tends to 0 for false, and the output tends to 1 for true;
[0029] The color adversarial loss S ab , perform logarithmic operations on the color dual channels of the predicted image and the color dual channels of the visible light training image, calculate the authenticity of the color dual channels of the predicted image and the color dual channels of the visible light training image by the color discriminator, and the output tends to 0 for false, and the output tends to 1 for true.
[0030] Compared with the prior art, the present invention has the following beneficial technical effects:
[0031] Currently, traditional algorithms and deep learning algorithms have poor effects on color conversion and detail enhancement of infrared images, resulting in missing restored image information. The present invention provides a method for restoring infrared images to visible light images, constructs a color enhancement adversarial network, trains a color generator, a brightness discriminator, and a color discriminator, and trains until the value of the global loss function no longer decreases, thereby enhancing the color information and detail information of the image, thereby improving the image restoration quality and realizing the restoration of infrared images to visible light images.
[0032] The invention has a simple structure, is easy to implement, has a wide application range and is highly universal. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 The invention discloses a flow chart of a method for restoring an infrared image to a visible light image.
[0034] Figure 2 It is the infrared test image I1 described in the example of the present invention.
[0035] Figure 3 It is the visible light test image I2 described in the example of the present invention.
[0036] Figure 4 It is the final restored color image I3 described in the example of the present invention. DETAILED DESCRIPTION
[0037] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0038] like Figure 1 As shown, a method for restoring an infrared image to a visible light image comprises the following steps:
[0039] Step 1: Obtain image data pairs under infrared images and visible light images, convert the infrared images and visible light images under the image data pairs from RGB color space display to Lab color space display, decompose the images under Lab color space display into image brightness single channel and image color dual channel, then use bilinear interpolation method to adjust the size of infrared images and visible light images under the image data pairs from the original 640×512 to 256×256, and then normalize the pixel values of the images and scale them to the range of 0 to 1; then divide the 3000 pairs of image data pairs into image training set and image test set according to 9:1, where the image training set contains 2700 pairs of infrared training images and visible light training images, and the image test set contains 300 pairs of infrared test images and visible light test images;
[0040] Step 2: construct a color enhancement adversarial network, which includes a color generator, a brightness discriminator and a color discriminator. Input the infrared training image into the color generator to generate a predicted image displayed based on the Lab color space; input the brightness single channel of the predicted image and the brightness single channel of the visible light training image into the brightness discriminator for judgment, and feed back the judgment result to the color generator; at the same time, input the color dual channels of the predicted image and the color dual channels of the visible light training image into the color discriminator for judgment, and feed back the judgment result to the color generator;
[0041] Step 3: Repeat step 2 to train the color enhancement adversarial network, that is, calculate the global loss function S including color enhancement and detail enhancement, and continue training until the value of the global loss function S no longer decreases, to obtain a trained color generator;
[0042] Step 4: Input the infrared test image into the trained color generator to generate the final restored color image.
[0043] In a specific embodiment, a method for restoring an infrared image to a visible light image is provided, wherein:
[0044] In step 1, the image data pairs of infrared images and visible light images are obtained from the KAIST public dataset.
[0045] In step 2, the color generator is composed of a feature encoder, an intermediate layer, and a feature decoder in sequence; wherein the infrared training image is input into the feature encoder of the color generator to extract feature information of the infrared training image, then passes through the intermediate layer to further extract deep feature information of the infrared training image, and finally passes through the feature decoder to obtain a predicted image;
[0046] The feature encoder consists of three downsampling layers, each of which contains a convolutional layer and a ReLU activation function;
[0047] The intermediate layer is composed of eight residual blocks, and each residual block is connected by a jump connection; wherein the residual block is composed of two convolutional layers, and each convolutional layer is followed by a Leaky ReLU activation function;
[0048] The feature decoder consists of two upsampling layers and an output layer, each upsampling layer includes a deconvolution and a ReLU activation function, and the output layer includes a convolution layer and a Tanh activation function;
[0049] The brightness discriminator is composed of a brightness extraction layer and a brightness judgment layer in sequence; the color discriminator is composed of a color extraction layer and a color judgment layer in sequence;
[0050] The brightness extraction layer and the color extraction layer are both composed of four convolutional layers, wherein each convolutional layer is followed by a Leaky ReLU activation function; wherein the parameter θ in the Leaky ReLU activation function is set to 0.01;
[0051] The brightness judgment layer and the color judgment layer are both composed of a downsampling layer, and the downsampling layer includes a convolution layer and a Sigmoid activation function;
[0052] The single brightness channel of the predicted image and the single brightness channel of the visible light training image are input into the brightness extraction layer under the brightness discriminator to extract the local brightness information of the predicted image and the visible light training image, and then the distribution difference of the local brightness information of the predicted image and the visible light training image is compared through the brightness judgment layer;
[0053] The color dual channels of the predicted image and the color dual channels of the visible light training image are input into the color judgment
[0054] In the color extraction layer under the detector, it is used to extract the local color information of the predicted image and the visible light training image, and then pass through the color judgment layer to compare the distribution difference of the local color information of the predicted image and the visible light training image;
[0055] The present invention uses four activation functions, namely ReLU activation function, Leaky ReLU activation function, Tanh activation function and Sigmoid activation function, which are defined as follows:
[0056]
[0057] In step 3, the global loss function S is composed of the detail loss S H , color perception loss S C , brightness adversarial loss S L , color adversarial loss S ab Composition; the global loss function S is:
[0058] S=S H +S C +S L +S ab ;
[0059] The detail loss S H , applying high-pass Gaussian filtering to the predicted image and the visible light training image to obtain a detail pixel matrix of the predicted image and a detail pixel matrix of the visible light training image, and calculating the angle between the detail pixel matrix of the predicted image and the detail pixel matrix of the visible light training image by cosine similarity; the high-pass Gaussian filtering is used to obtain the detail pixel matrix of the image, wherein the Gaussian kernel standard deviation is set to 1.5, and the Gaussian convolution kernel size is set to 5×5;
[0060] The color perception loss S C , use the VGG-19 network on the predicted image and the visible light training image to obtain the predicted image structure pixel matrix and the visible light training image structure pixel matrix, and calculate the sum of the squares of the differences between the predicted image structure pixel matrix and the visible light training image structure pixel matrix by the 2 norm; the VGG-19 network was developed by the Visual Geometry Group of the University of Oxford, and contains 16 convolutional layers for feature extraction and 3 fully connected layers for classification. The convolutional layer extracts the edge, texture, shape and other features of the image layer by layer, and the fully connected layer integrates these features;
[0061] The brightness resistance loss S L , perform logarithmic operations on the brightness single channel of the predicted image and the brightness single channel of the visible light training image, calculate the brightness discriminator to judge the authenticity of the brightness single channel of the predicted image and the brightness single channel of the visible light training image, and the output tends to 0 for false, and the output tends to 1 for true;
[0062] The color adversarial loss S ab , perform logarithmic operations on the color dual channels of the predicted image and the color dual channels of the visible light training image, calculate the authenticity of the color dual channels of the predicted image and the color dual channels of the visible light training image by the color discriminator, and the output tends to 0 for false, and the output tends to 1 for true.
[0063] Figure 2 are three infrared test images I1 in the example of the present invention, Figure 3 are three visible light test images I2 in the example of the present invention, Figure 4 These are the three final restored color images I3 in the example of the present invention.
[0064] In the example of the present invention, the peak signal-to-noise ratio is used as the evaluation index:
[0065] The peak signal-to-noise ratio of the infrared test image I1 in the example of the present invention and the visible light test image I2 in the example of the present invention is 8.27, and the peak signal-to-noise ratio of the final restored color image I3 in the example of the present invention and the visible light test image I2 in the example of the present invention is 20.29;
[0066] Finally, it should be noted that the above implementation methods are only used to illustrate the technical solution of the patent rather than to limit it. Ordinary technicians in this field can make several modifications and improvements without departing from the principle of this patent, which should also be regarded as the scope of protection of this patent.
Claims
1. A method for restoring an infrared image to a visible light image. It is characterized in that The method comprises the following steps: Step 1: Obtain image data pairs under infrared images and visible light images, perform image preprocessing on the image data pairs, and then divide the image data pairs into an image training set and an image test set in a ratio of 9:1, wherein the image training set includes paired infrared training images and visible light training images, and the image test set includes paired infrared test images and visible light test images; The image preprocessing includes converting the infrared image and the visible light image under the image data pair from the RGB color space display to the Lab color space display, decomposing the image under the Lab color space display into a single brightness channel and a double color channel of the image, and then using a bilinear interpolation method to adjust the size of the infrared image and the visible light image under the image data pair from the original 640×512 to 256×256, and then normalizing the pixel values of the images and scaling them to a range of 0 to 1; Step 2: construct a color enhancement adversarial network, which includes a color generator, a brightness discriminator and a color discriminator; Input the infrared training image into the color generator to generate a predicted image based on the Lab color space display; input the single brightness channel of the predicted image and the single brightness channel of the visible light training image into the brightness discriminator for judgment, and the judgment result is fed back to the color generator; at the same time, input the color dual channels of the predicted image and the color dual channels of the visible light training image into the color discriminator for judgment, and the judgment result is fed back to the color generator; Step 3: Repeat step 2 to train the color enhancement adversarial network, that is, calculate the global loss function S including color enhancement and detail enhancement, and continue training until the value of the global loss function S no longer decreases, so as to obtain a trained color generator; Step 4: Input the infrared test image into the trained color generator to generate the final restored color image.
2. The method for restoring an infrared image to a visible light image according to claim 1, It is characterized in that In the step 1, the image data pairs of the infrared image and the visible light image are obtained from the KAIST public dataset.
3. The method for restoring an infrared image to a visible light image according to claim 1, It is characterized in that In the step 2, the color generator is composed of a feature encoder, an intermediate layer and a feature decoder in sequence; The infrared training image is input into the feature encoder of the color generator to extract the feature information of the infrared training image, and then passes through the intermediate layer to further extract the deep feature information of the infrared training image, and finally passes through the feature decoder to obtain the predicted image.
4. The method for restoring an infrared image to a visible light image according to claim 3, It is characterized in that The feature encoder is composed of three downsampling layers, each of which contains a convolutional layer and a ReLU activation function; the intermediate layer is composed of eight residual blocks, each of which is connected by a jump connection, wherein the residual block is composed of two convolutional layers, and each convolutional layer is followed by a Leaky ReLU activation function; The feature decoder consists of two upsampling layers and an output layer, each upsampling layer includes a deconvolution and a ReLU activation function, and the output layer includes a convolution layer and a Tanh activation function.
5. The method for restoring an infrared image to a visible light image according to claim 1, It is characterized in that In the step 2, the brightness discriminator is composed of a brightness extraction layer and a brightness judgment layer in sequence; the color discriminator is composed of a color extraction layer and a color judgment layer in sequence; The single brightness channel of the predicted image and the single brightness channel of the visible light training image are input into the brightness extraction layer under the brightness discriminator to extract the local brightness information of the predicted image and the visible light training image, and then pass through the brightness judgment layer to compare the distribution difference of the local brightness information of the predicted image and the visible light training image; at the same time, the color dual channels of the predicted image and the color dual channels of the visible light training image are input into the color extraction layer under the color discriminator to extract the local color information of the predicted image and the visible light training image, and then pass through the color judgment layer to compare the distribution difference of the local color information of the predicted image and the visible light training image.
6. The method for restoring an infrared image to a visible light image according to claim 5, It is characterized in that The brightness extraction layer and the color extraction layer are both composed of four convolutional layers, wherein each convolutional layer is followed by a Leaky ReLU activation function; the brightness judgment layer and the color judgment layer are both composed of a downsampling layer, which includes a convolutional layer and a Sigmoid activation function.
7. The method for restoring an infrared image to a visible light image according to claim 1, It is characterized in that In step 3, the global loss function S is composed of the detail loss S H , color perception loss S C , brightness adversarial loss S L , color adversarial loss S ab Composition; the global loss function S is: S=S H +S C +S L +S ab 。 8. The method for restoring an infrared image to a visible light image according to claim 7, It is characterized in that The detail loss S H , use high-pass Gaussian filtering on the predicted image and the visible light training image to obtain the predicted image detail pixel matrix and the visible light training image detail pixel matrix, and calculate the angle between the predicted image detail pixel matrix and the visible light training image detail pixel matrix by cosine similarity; The color perception loss S C , using the VGG-19 network for the predicted image and the visible light training image to obtain the predicted image structure pixel matrix and the visible light training image structure pixel matrix, and calculating the sum of squares of the differences between the predicted image structure pixel matrix and the visible light training image structure pixel matrix by the 2 norm; the VGG-19 network includes 16 convolutional layers for feature extraction and 3 fully connected layers for classification, the convolutional layers extract features such as edges, textures, and shapes of the image layer by layer, and the fully connected layers integrate these features; The brightness resistance loss S L , perform logarithmic operation on the brightness single channel of the predicted image and the brightness single channel of the visible light training image, calculate the brightness discriminator to judge the authenticity of the brightness single channel of the predicted image and the brightness single channel of the visible light training image, and the output tends to 0 for false, and the output tends to 1 for true; The color adversarial loss S ab , perform logarithmic operations on the color dual channels of the predicted image and the color dual channels of the visible light training image, calculate the authenticity of the color dual channels of the predicted image and the color dual channels of the visible light training image by the color discriminator, and the output tends to 0 for false, and the output tends to 1 for true.
