Infrared image colorization method and system based on large kernel convolution and graph contrast learning
Through large kernel convolution and graph contrast learning technology, combined with generative adversarial networks and topology-aware features, the deficiencies in complex texture and color change processing in infrared image colorization are solved, high-quality colorization effects are achieved, and colorization is significantly improved. The results are realistic and rich in detail.
Patent Information
- Application Number
- CN202410923906.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-11
AI Technical Summary
Existing infrared image colorization technology cannot effectively capture complex textures and color changes, resulting in unsatisfactory colorization results and a lack of topological consistency processing of high-level image features.
Using methods based on large kernel convolution and graph contrast learning, through generating adversarial networks and multi-scale discriminators, combined with feature selection extraction modules, residual refinement modules, upsampling modules and attention gate modules, high-level features are extracted and images are reconstructed. Improving the quality of colorization results using topology-aware features and contrast loss functions.
It significantly improves the quality and realism of the colorization results, retains the image structure and semantic information, enhances the representation ability of the network, avoids information loss, and generates color images that are more realistic and rich in details.
Smart Images

Figure CN118470153B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and more particularly to an infrared image colorization method and system based on large kernel convolution and graph contrast learning. Background Art
[0002] Infrared images have disadvantages such as low resolution, lack of color information, and missing details. As a key technology for thermal infrared image enhancement, infrared image colorization technology can significantly enhance the visibility and recognition of infrared images, and improve the information content and utilization value of infrared images. However, infrared image colorization is a challenging and highly ill-posed problem, because the same infrared image may have different colorization results. This limitation increases the complexity of implementing infrared image colorization. Existing work only focuses on the single point-by-point matching of each pair without considering the topological structure with neighbors. At the same time, the infrared colorization network needs to take into account global contextual information, including the shape, texture, and background of the object. The processing of complex textures is very important for restoring true colors. Small convolution kernels cannot capture the details and color changes of complex textures well, resulting in information loss and affecting the accuracy of colorization.
[0003] The Chinese patent publication number is "CN118097241A", and the name is "A method and system for true color conversion of infrared images based on residual attention network and contrastive learning". First, the infrared image collected by the infrared imaging device is input into the infrared image true color conversion network, and the residual attention module based on spatial and channel attention is used to capture the spatial features of the input infrared image, and to mix and integrate different features; at the same time, the channel attention module is used to make the channel with a large amount of information get more attention, and the spatial attention module is used to cluster the features of each position to enhance the representation ability of the network; then the generator is used to reconstruct the corresponding visible light image according to the input infrared image; finally, the multi-scale discriminator is used to divide the generated visible light image into several small blocks, and the authenticity is evaluated for each small block, and the output is output after passing the evaluation. This method only focuses on the single point-by-point matching of each pair, and many details of the original input image are lost, resulting in unsatisfactory colorization results. Therefore, how to use the topological consistency of high-level features of the image is a problem that technicians in this field urgently need to solve. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the shortcomings of the prior art, the present invention provides an infrared image colorization method and system based on large kernel convolution and graph contrast learning, which can improve the representation ability of the network and the topological consistency of color features, and improve the quality of the colorization results.
[0006] (II) Technical solution
[0007] In order to achieve the above-mentioned purpose, the present invention specifically adopts the following technical solutions:
[0008] The infrared image colorization method based on large kernel convolution and graph contrast learning includes the following steps:
[0009] Step 1, preprocessing the data set: preprocessing the first infrared image data set and the second infrared image data set, adjusting the size of each image in the data set, and fixing the size of the input image;
[0010] Step 2: Build a network model: The entire generative adversarial network includes a generator and a discriminator;
[0011] Step 3, training the network model: training the infrared image colorization model, inputting the data set prepared in step 1 into the network model constructed in step 2 for training;
[0012] Step 4, calculate network loss: by minimizing the loss function of the network output image and label, until the number of training times reaches the set threshold or the value of the loss function reaches the set range, the model parameters are considered to have been trained and saved;
[0013] Step 5, evaluate network performance: select the optimal evaluation index to measure the accuracy of the algorithm, evaluate the performance of the network, and make corresponding improvements and optimizations;
[0014] Step 6, save the network weights: solidify the final model parameters, and when the infrared image colorization operation is needed, directly input the image into the network to obtain the final colorized image;
[0015] Further, the generator includes an initial module, a feature selection extraction module, a downsampling module, a residual refinement module, a feature refinement block, an upsampling module, an attention gate module and a reconstruction module;
[0016] The initial module increases the expressiveness of the model by increasing the dimension, so that the network can better learn the complex features of the input data;
[0017] The feature selection and extraction module increases the receptive field, can effectively and accurately extract the fuzzy features of thermal infrared images, and improve the network's ability to extract advanced features;
[0018] The downsampling module reduces the size of the feature map and extracts and retains important feature information;
[0019] The residual refinement module gradually refines and enhances the feature representation, so that the network can learn higher-level and more abstract feature representations, thereby improving the network's ability to understand input data;
[0020] The feature refinement block expands the receptive field of each convolutional layer, enriches the output features, and extracts features at multiple scales, providing powerful representation capabilities;
[0021] The upsampling module gradually restores the size of the original image and retains more detail information and position information;
[0022] The attention gate module can operate on feature maps with large receptive fields to avoid information loss caused by the sampling process;
[0023] The reconstruction module better reconstructs the details and texture of the image and prevents the overflow of the image pixel value.
[0024] Furthermore, the discriminator is composed of multiple convolutional layers, L-type functions and S-type functions; it can better focus on the detailed information of the image and improve the performance of the generator. By processing the image in blocks, a more realistic and detailed image can be generated.
[0025] Furthermore, the first infrared image dataset is a KAIST dataset, and the second infrared image dataset is a FLIR dataset. By preprocessing the images in the datasets, the size of each image in the datasets is adjusted, and the size of the input image is fixed.
[0026] Furthermore, the preset thresholds in the training network model include a preset value of the loss function and a preset value of the number of training times.
[0027] Furthermore, the loss function is a composite loss function, and the loss functions adopted by the generator include adversarial loss, image contrast loss and perceptual loss; the discriminator adopts adversarial loss.
[0028] The graph contrast loss uses the graph formed by the semantic relationship of image blocks to study topologically aware features and improve the consistency of block semantic connections in input and output images; the topologically aware image block features are captured by GNN, where the image block connections are determined by a shared adjacency matrix. Given, then get the node features and , and maximize the node-wise mutual information by contrastive loss;
[0029] First, for the input image Construction diagram, where is the adjacency matrix, To represent the node features of the image block; from the pre-trained feature extraction network The dense features obtained by the intermediate layer , and randomly select Image patch features ;Will The feature is set to graph The node (i.e. ); Then, the adjacency matrix is obtained based on the cosine similarity of the image block features ; If the similarity is above a predefined threshold , then connect the image blocks, otherwise disconnect the image blocks; feature , The adjacency matrix of The following relationship exists:
[0030]
[0031] Then, the output graph is constructed in a similar way ; Maintain the topological correspondence between image blocks, and the output graph inherits the adjacency matrix from the input graph ; Pool the graph nodes to exploit the task-related focused attention of the graph; Pool the nodes according to their relevance to the task , Downsampling is performed and the graph is constructed with fewer nodes to focus on nodes relevant to the task; is the normalized adjacency matrix, is a shared parameter; following top-K pooling, the similarity score ,from Nodes Select nodes, of which is a learnable pooling vector; therefore, by The connections of non-selected nodes are excluded, and then the scores of the nodes are weighted and then the S-type function is used. , there is the following relationship:
[0032]
[0033]
[0034] Given the input of generator G and output The topological correspondence between them uses infoNCE loss to maximize the mutual information between nodes in the pool graph. The following relationship exists:
[0035]
[0036] Furthermore, the process of training the network model also includes evaluating the quality of the algorithm colorization results, the image similarity and the image distortion through evaluation indicators.
[0037] An infrared image colorization system based on large kernel convolution and graph contrast learning, the system comprising:
[0038] Image acquisition module, acquiring infrared image data and visible light data;
[0039] The image processing module receives the collected infrared image data and visible light data, and performs preprocessing such as filtering, enhancement and denoising to improve the image quality while retaining the key details in the image;
[0040] The network training module trains these images, learns the mapping relationship between infrared images and color images, and generates the final colorization result;
[0041] The quality assessment module uses some image quality assessment indicators to measure the similarity between the colorized image and the real color image, which helps to judge the performance of the network model and perform subsequent optimization and improvement;
[0042] The quality improvement module uses some restoration and enhancement techniques to further improve the quality of the colorized image based on the feedback from the quality assessment module;
[0043] The visualization module presents the colorized infrared image to the user in a visual manner, allowing the user to intuitively observe and analyze the image and process or apply it as needed.
[0044] (III) Beneficial effects
[0045] Compared with the prior art, the present invention provides an infrared image colorization method and system based on large kernel convolution and graph contrast learning, which has the following beneficial effects:
[0046] The present invention compares and matches the input infrared image and the colorized image at the image block level to extract topologically aware semantic information therefrom, thereby effectively retaining the structural and semantic information in the image, thereby improving the quality and realism of the colorized image.
[0047] The feature selection extraction module proposed in the present invention can better handle the local invariance in the input data and better extract the high-level semantic information and local features in the image, thereby providing more accurate feature representation for the subsequent colorization process.
[0048] The feature refinement block proposed in the present invention helps the convolutional network learn discriminative representation by adding basic convolution transformations at each layer, which can effectively expand the receptive field of each spatial position, thereby better capturing the contextual information and global features in the image and improving the image details and quality during the colorization process.
[0049] The attention gate module proposed in the present invention utilizes the relative strength of the channel-attention dynamic coordination fusion feature map, and can operate on feature maps with a large receptive field, avoiding the information loss easily caused by the sampling process, and improving the accuracy and quality of the colorized image.
[0050] The present invention proposes a composite loss function composed of adversarial loss, image contrast loss and perceptual loss, which can learn the implicit relationship between infrared images and color images, and helps to drive the network to generate high-quality colorized images. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a flow chart of the infrared image colorization method based on large kernel convolution and graph contrast learning;
[0052] Figure 2 This is a working principle diagram of the infrared image colorization method based on large kernel convolution and graph contrast learning;
[0053] Figure 3 This is the generator structure diagram of the generative adversarial network in the infrared image colorization method based on large kernel convolution and graph contrast learning;
[0054] Figure 4 This is a schematic diagram of the specific composition of the initial module of the present invention;
[0055] Figure 5 This is a schematic diagram of the specific composition of all feature selection and extraction modules described in the present invention;
[0056] Figure 6 This is a schematic diagram of the specific composition of all large-kernel convolution blocks described in the present invention;
[0057] Figure 7 A schematic diagram of the specific composition of all feature enhancement blocks described in the present invention;
[0058] Figure 8 It is a schematic diagram of the specific composition of all feature refinement blocks described in the present invention;
[0059] Fig. 9 This is a schematic diagram of the specific structure of all downsampling modules described in the present invention;
[0060] Fig.10 This is a schematic diagram of the specific structure of all residual refinement modules described in the present invention;
[0061] Fig.11 This is a schematic diagram of the specific structure of all upsampling modules described in the present invention;
[0062] Fig.12 This is a schematic diagram of the specific structure of all attention gate modules described in the present invention;
[0063] Fig.13 This is a schematic diagram of the specific structure of the reconstruction module of the present invention;
[0064] Fig.14The discriminator structure diagram of the generative adversarial network in the infrared image colorization method based on large kernel convolution and graph contrast learning;
[0065] Fig.15 This is a schematic diagram for comparing relevant indicators of the method proposed in the present invention;
[0066] Fig.16 Schematic diagram of the main modules of the infrared image colorization system based on large kernel convolution and graph contrast learning;
[0067] Fig.17 Schematic diagram of the internal structure of an electronic device for infrared image colorization method based on large kernel convolution and graph contrast learning. DETAILED DESCRIPTION
[0068] Embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. These and other aspects of the embodiments of the present invention will be clear with reference to the following description and drawings. In these descriptions and drawings, some specific implementations in the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0069] Example 1
[0070] like Figure 1 As shown in FIG. 1 , an infrared image colorization method based on large kernel convolution and graph contrast learning includes the following steps:
[0071] Step 1, preprocess the dataset; the KAIST dataset contains 95,328 images, each of which contains two versions: RGB color image and infrared image. It covers various common traffic scenes such as campus, streets, and villages. The size of each image is 640×480. The dataset was cleaned, and the cleaned dataset contains 4755 images in the training set and 1459 images in the test set. The FLIR dataset contains 9711 thermal images and 9233 RGB images, including various scenes such as roads, vehicles, and pedestrians. The dataset was cleaned, and the cleaned dataset contains 3918 images in the training set and 428 images in the test set; in order to save computing resources, the image resolution is limited to 256×256.
[0072] In step 1, the image of the data set is enhanced, a random diffraction transformation is performed on the same image, and the image is cropped to the size of the input image as the input of the entire network; wherein the random size and position can be achieved through a software algorithm; wherein the processed image in the data set is used as input in order to allow the network to learn better feature extraction capabilities, and ultimately achieve a better colorization effect;
[0073] Step 2: Build a network model, such as Figure 2 As shown, the working principle diagram of the infrared image colorization method based on large kernel convolution and graph contrast learning, specifically including the generator and the discriminator;
[0074] like Figure 3 As shown in FIG, the generator consists of an initial module, a feature selection extraction module 1, a downsampling module 1, a feature selection extraction module 2, a downsampling module 2, a feature selection extraction module 3, a downsampling module 3, a feature selection extraction module 4, a residual refinement module 1, a residual refinement module 2, a residual refinement module 3, a residual refinement module 4, a residual refinement module 5, a residual refinement module 6, a residual refinement module 7, a residual refinement module 8, a residual refinement module 9, an upsampling module 1, an attention gate module 1, an upsampling module 2, an attention gate module 2, an upsampling module 3, an attention gate module 3 and a reconstruction module; the initial module increases the expression ability of the model by increasing the dimension, so that the network can better learn the complex features of the input data. It consists of a convolutional layer, an instance normalization layer and an L-type function. The convolution kernel size is 7×7. The specific composition of the initial module is as follows: Figure 4 As shown in the figure, the feature selection and extraction module increases the receptive field, can effectively and accurately extract the fuzzy features of thermal infrared images, and improve the network's ability to extract advanced features. It consists of a large kernel convolution block, a feature enhancement block, and a feature refinement block. The specific composition of each feature selection and extraction module is shown in the figure. Figure 5 As shown in the figure, the large kernel convolution block consists of an instance normalization layer, a convolution layer 1, a depth convolution layer, a convolution layer 2, and an addition operation. The convolution kernel sizes are 1×1 and 13×13. The specific structure of each large kernel convolution block is as follows: Figure 6 As shown in the figure, the feature enhancement block consists of an instance normalization layer, a convolution layer 1, a G-type function, a convolution layer 2, and an addition operation. The convolution kernel size is 1×1. The specific composition of each feature enhancement block is as follows: Figure 7 As shown in the figure, the feature refinement block consists of global average pooling, bilinear interpolation, convolution layer 1, convolution layer 2, convolution layer 3, convolution layer 4, S-type function, addition operation, multiplication operation and feature concatenation operation. The convolution kernel size is 3×3. The specific composition of each feature refinement block is as follows: Figure 8 As shown in the figure, the downsampling module reduces the size of the feature map, extracts and retains important feature information, and consists of a convolution layer, an instance normalization layer, an L-type function, and a feature refinement block. The convolution kernel size is 3×3 and the step size is 2. The specific composition of each downsampling module is as follows: Fig. 9 As shown in the figure, the residual refinement module gradually refines and enhances the feature representation. The network can learn higher-level and more abstract feature representations, thereby improving the network's ability to understand the input data. It consists of convolution layer 1, instance normalization layer 1, convolution layer 1, instance normalization layer 1, L-type function and feature refinement block. The convolution kernel size is 3×3. The specific composition of each residual refinement module is as follows: Fig.10 As shown in the figure, the upsampling module gradually restores the size of the original image, retains more detail information and position information, and consists of a transposed convolution layer, an instance normalization layer, an L-type function, a channel attention block, and a feature refinement block. The convolution kernel size is 4×4 and the step size is 2. The specific composition of each upsampling module is as follows: Fig.11 As shown in Figure 1, the attention gate module can operate on feature maps with large receptive fields to avoid information loss caused by the sampling process. It consists of convolution layer 1, convolution layer 2, average pooling, addition operation, multiplication operation and feature concatenation operation. The convolution kernel size is 3×3. The specific composition of each attention gate module is as follows: Fig.12 As shown in the figure, the reconstruction module better reconstructs the details and texture of the image and prevents the overflow of the image pixel value. It consists of a convolution layer and a T-type function. The convolution kernel size is 7×7. The specific composition of the reconstruction module is as follows: Fig.13 As shown; the size of the feature map is finally kept consistent with the input image size.
[0075] like Fig.14 As shown in the figure, the discriminator can better focus on the details of the image and improve the performance of the generator. By dividing the image into blocks, a more realistic and detailed image can be generated; it consists of convolution layer 1, convolution layer 2, convolution layer 3, convolution layer 4, convolution layer 5, L-type function and S-type function, with a convolution kernel size of 4×4 and a step size of 2 and 1.
[0076] In order to ensure the robustness of the network, retain more structural information, and fully extract image features, the present invention uses four activation functions, namely L-type function, S-type function, G-type function and T-type function. The definitions of L-type function, S-type function, G-type function and T-type function are as follows:
[0077]
[0078]
[0079]
[0080]
[0081] Step 3, training the network model: training the infrared image colorization model, inputting the data set prepared in step 1 into the network model constructed in step 2 for training;
[0082] All experiments were conducted on an Ubuntu 22.04.1 LTS system, and the algorithm was accelerated using an NVIDIA Tesla V100 GPU 16GB. The training cycle was set to 400 rounds, and the learning rates of the generator and discriminator were set to 1e−4 and 2e−4 respectively; the upper limit of the number of images input to the network each time is mainly determined by the performance of the computer graphics processor. Generally, the number of images input to the network each time is in the range of 4-8, which can make the network training more stable and the training results better, and can ensure fast network fitting; the Adam optimizer is selected as the network parameter optimizer; its advantages are mainly simple implementation, efficient calculation, low memory requirements, and parameter updates are not affected by the scaling transformation of the gradient, making the parameters relatively stable; when the discriminator's ability to judge fake images is balanced with the generator's ability to generate images that deceive the discriminator, the network is considered to have been basically trained;
[0083] Step 4, calculate the network loss; by minimizing the loss function of the network output image and label, until the number of training times reaches the set threshold or the value of the loss function reaches the set range, the model parameters can be considered to have been trained and the model parameters are saved; the loss functions used by the generator include adversarial loss, image contrast loss and perceptual loss; the discriminator uses adversarial loss.
[0084] In order to help the network restore the overall brightness and chromaticity of the color image and learn the implicit relationship between the colorized image and the color image, adversarial loss is adopted, and the formula is as follows:
[0085]
[0086] in, To input infrared image, and The generator and discriminator respectively.
[0087] In order to enhance the ability in infrared image colorization, the topology-aware features are studied by using the graph formed by the semantic relationship of image patches to improve the consistency of the semantic connection of patches in the input and output images. The topology-aware image patch features are captured by GNN, where the image patch connections are represented by a shared adjacency matrix. Given, then get the node features and , and maximize the node-wise mutual information via contrastive loss.
[0088] First, for the input image Construction diagram, where is the adjacency matrix, is the node feature representing the image block. Specifically, from the pre-trained feature extraction network The dense features obtained by the intermediate layer , and randomly select Image patch features .Will The feature is set to graph The node (i.e. ). Then, the adjacency matrix is obtained based on the cosine similarity of the image block features. If the similarity is above a predefined threshold , then connect the image blocks, otherwise disconnect the image blocks. Features , The adjacency matrix of The formula is as follows:
[0089]
[0090] Then, the output graph is constructed in a similar way In order to maintain the topological correspondence between image patches, the output graph inherits the adjacency matrix from the input graph. . Pooling graph nodes to exploit task-related focused attention of the graph. Pooling nodes based on their relevance to the task , Downsampling is performed and the graph is constructed with fewer nodes to focus on nodes relevant to the task. is the normalized adjacency matrix, is a shared parameter. Specifically, following the top-K pooling, the similarity score ,from Nodes Select nodes, of which is a learnable pooling vector. Therefore, by The connections of non-selected nodes are excluded, and then the scores of the nodes are weighted and then the S-type function is used. The specific operations are as follows:
[0091]
[0092]
[0093] In order to strengthen the input of a given generator G and output The topological correspondence between them is obtained by using infoNCE loss to maximize the mutual information between nodes in the pool graph, as shown below:
[0094]
[0095] In order to compensate for the singularity of global feature recovery during adversarial loss colorization, the pre-trained VGG-16 is used to identify and extract features from the input image, and the Manhattan distance between the colorization result and the input image feature map is calculated, making the resulting image more realistic and of better quality. The formula for perceptual loss is as follows:
[0096]
[0097] in, Indicates the first The feature map of the layer, , , They represent the number of channels, height, and width of the layer respectively.
[0098] The present invention combines the above losses to improve the quality of colorization results. The overall loss function is as follows:
[0099]
[0100] in , ,and They represent the weights of controlling different loss shares in the overall loss function. The weights are set based on preliminary experiments on the training data set. By optimizing the final overall loss function, it helps the network learn clearer edges and more detailed textures, making the colorized image more natural, more realistic, and with better visual effects;
[0101] Step 5, evaluate the network performance; appropriate evaluation indicators include peak signal-to-noise ratio, structural similarity, perceptual image similarity, Fréchet distance, natural image quality assessment and general quality index; peak signal-to-noise ratio is used to measure the difference between the colorized result and the real image. The higher the peak signal-to-noise ratio, the better the colorization quality; structural similarity quantifies the contour preservation in the colorization process by calculating the structural similarity between the colorized result and the real image. The higher the structural similarity, the smaller the difference; perceptual image similarity focuses on the perceptual similarity between the colorized result and the real image. The lower the perceptual image similarity, the more similar the colorized result and the real image are; Fréchet distance compares the distribution between the colorized result and the real image in the deep feature embedding The perceptual quality of the generated image is evaluated by the Fréchet distance. The lower the Fréchet distance, the higher the similarity and the better the colorization quality. The natural image quality assessment is based on a set of "quality-perceptual" features and fits them to a multivariate Gaussian model. The quality-perceptual features are derived from a simple but highly regularized natural statistical feature model. Then, the natural image quality assessment index of a given test image is expressed as the distance between the multivariate Gaussian model of natural statistical features extracted from the test image and the multivariate Gaussian model of quality-perceptual features extracted from the natural image corpus. The universal quality index measures the similarity between the colorization result and the real image by examining the structural information of the image. The universal quality index can be in the range of [0,1]. The closer the value is to 1, the higher the similarity. Peak signal-to-noise ratio, structural similarity, perceptual image similarity, Fréchet distance, natural image quality assessment, and universal quality index are defined as follows:
[0102] ,
[0103] ,
[0104] ,
[0105] ,
[0106] ,
[0107]
[0108] in , Respectively represent images and The mean and variance of and Respectively represent images and The standard deviation of Representing images and The covariance of and is a constant; for and The distance between is a trainable weight parameter; and represent the generated image and the real image respectively, and represents the mean of each eigenvector, and represents the covariance matrix of the respective eigenvectors, represents the trace of a matrix; and Represent the mean vector and covariance matrix of the natural multivariate Gaussian model and the distorted image multivariate Gaussian model respectively; and represents the mean of the original image and the filtered image, and Represents the variance of the original image and the filtered image.
[0109] Step 6, save the network weights; after the network training is completed, all the parameters in the network need to be saved, and then the infrared image to be colored is input into the network to obtain the colored image; the network has no requirements on the size of the input image, and any size is acceptable;
[0110] Among them, the implementation of convolution, activation function, splicing operation and batch normalization are algorithms well known to those skilled in the art, and the specific processes and methods can be found in corresponding textbooks or technical literature;
[0111] The present invention constructs an infrared image colorization method based on large kernel convolution and graph contrast learning, which can directly generate a colorized image from an infrared image without going through other intermediate steps, thus avoiding the manual design of relevant colorization rules. Under the same conditions, the feasibility and superiority of the method are further verified by calculating the relevant indicators of the image obtained by the existing method. The relevant indicators of the existing technology and the method proposed by the present invention are compared. Fig.15 As shown;
[0112] from Fig.15 It can be seen that the method proposed in the present invention has a higher peak signal-to-noise ratio, higher structural similarity, lower perceived image similarity, lower Fréchet distance, and higher general quality index than the existing methods. These indicators also further illustrate that the method proposed in the present invention has better colorization quality.
[0113] Example 2
[0114] like Fig.16As shown, the present invention also provides an infrared image colorization system based on large kernel convolution and graph contrast learning, which mainly includes an image acquisition module, an image processing module, a network training module, a quality assessment module, a quality improvement module and an image visualization module;
[0115] Image acquisition module, acquiring infrared image data and visible light data;
[0116] The image processing module receives the collected infrared image data and visible light data, and performs preprocessing such as filtering, enhancement and denoising to improve the image quality while retaining the key details in the image;
[0117] The network training module trains these images, learns the mapping relationship between infrared images and color images, and generates the final colorization result;
[0118] The quality assessment module uses some image quality assessment indicators to measure the similarity between the colorized image and the real color image, which helps to judge the performance of the network model and perform subsequent optimization and improvement;
[0119] The quality improvement module uses some restoration and enhancement techniques to further improve the quality of the colorized image based on the feedback from the quality assessment module;
[0120] The visualization module presents the colorized infrared image to the user in a visual manner, allowing the user to intuitively observe and analyze the image and perform further processing or application as needed.
[0121] Furthermore, the image to be colored acquired by the image acquisition module is an infrared image and a visible light image, and the infrared image may also be replaced by a normal grayscale image;
[0122] Furthermore, the preprocessing in the image processing module mainly includes image cropping, image flipping and image translation, etc., and the ratio of the training set and the test set is 5:1;
[0123] Furthermore, the model training module resizes each image from any size in the dataset to a fixed size of 256×256; a total of 400 rounds of training are performed with a batch size of 4; the number of filters in the first convolutional layer in the generator and discriminator is set to 64; the Adam optimizer is used; the discriminator and the generator are alternately trained until the composite loss function converges;
[0124] Furthermore, the evaluation indicators of the quality assessment module are peak signal-to-noise ratio, structural similarity, perceived image similarity, Fréchet distance, natural image quality assessment and universal quality index.
[0125] Example 3
[0126] like Fig.17As shown, the present invention also provides an infrared image colorization electronic device based on large kernel convolution and image contrast learning, which mainly includes a memory, a processor, a communication interface and a bus; wherein the memory, the processor and the communication interface are connected to each other through the bus;
[0127] The memory may be a ROM, a static storage device, a dynamic storage device or a RAM; the memory may store a program, and when the program stored in the memory is executed by the processor, the processor and the communication interface are used to execute the various steps of the training method for the infrared image colorization network of the embodiment of the present invention;
[0128] The processor may be a CPU, a microprocessor, an ASIC, a GPU or one or more integrated circuits, and is used to execute relevant programs to implement the functions that the units in the infrared image colorization training system of the present invention need to perform, or to perform the infrared image colorization training method of the present invention;
[0129] The processor may also be an integrated circuit chip with signal processing capability; in the implementation process, each step of the infrared image colorization training method of the present invention may be completed by an integrated logic circuit of hardware in the processor or by instructions in the form of software; the above-mentioned processor may also be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component; the infrared image colorization method, steps and logic block diagram of the present invention may be implemented or executed; the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.; the steps of the infrared image colorization method of the present invention may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in the decoding processor; the software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc.; the storage medium is located in a memory, the processor reads the information in the memory, and in combination with its hardware completes the functions required to be executed by the units included in the infrared image colorization training system of the present invention, or executes the infrared image colorization training method of the present invention;
[0130] The communication interface uses a transceiver system such as, but not limited to, a transceiver to achieve communication between the system and other devices or a communication network; for example, an image to be processed or an initial feature map of the image to be processed can be obtained through the communication interface;
[0131] The bus may include a pathway for transferring information between various components of the system (e.g., memory, processor, communication interface);
[0132] The present invention also provides a computer-readable storage medium for infrared image colorization based on large kernel convolution and image contrast learning. The computer-readable storage medium may be a computer-readable storage medium included in the system in the above-mentioned embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device; the computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present invention;
[0133] It should be noted that although Fig.17 The electronic device shown only shows a memory, a processor, and a communication interface. However, in the specific implementation process, those skilled in the art should understand that the system also includes other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the system may also include hardware devices for implementing other additional functions. In addition, those skilled in the art should understand that the system may also include only the devices necessary for implementing the embodiments of the present invention, and does not necessarily include Fig.17 All devices shown in;
[0134] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An infrared image colorization method based on large kernel convolution and graph contrast learning, characterized in that: The specific steps are: S1. Preprocessing the data set: preprocessing the first infrared image data set and the second infrared image data set, adjusting the size of each image in the data set, and fixing the size of the input image; The first infrared image dataset is the KAIST dataset, and the second infrared image dataset is the FLIR dataset. The images in the dataset are preprocessed, the size of each image in the dataset is adjusted, and the size of the input image is fixed; S2. Build network model: The entire generative adversarial network includes a generator and a discriminator; The generator includes an initial module, a feature selection extraction module, a downsampling module, a residual refinement module, a feature refinement block, an upsampling module, an attention gate module, and a reconstruction module; The initial module increases the expressiveness of the model by increasing the dimension, so that the network can better learn the complex features of the input data; The feature selection and extraction module increases the receptive field, can effectively and accurately extract the fuzzy features of thermal infrared images, and improve the network's ability to extract advanced features; The downsampling module reduces the size of the feature map and extracts and retains important feature information; The residual refinement module gradually refines and enhances the feature representation, so that the network can learn higher-level and more abstract feature representations, thereby improving the network's ability to understand input data; The feature refinement block expands the receptive field of each convolutional layer, enriches the output features, and extracts features at multiple scales, providing powerful representation capabilities; The upsampling module gradually restores the size of the original image and retains more detail information and position information; The attention gate module can operate on feature maps with large receptive fields to avoid information loss caused by the sampling process; The reconstruction module better reconstructs the details and texture of the image and prevents the overflow of the image pixel value; The discriminator consists of multiple convolutional layers, L-type functions, and S-type functions; it can better focus on the details of the image and improve the performance of the generator; by dividing the image into blocks, it can generate more realistic and detailed images; S3, training the network model: training the infrared image colorization model, inputting the data set prepared in step 1 into the network model constructed in step 2 for training; preset thresholds in the training network model include preset values of the loss function and preset values of the number of training times; S4. Calculate network loss: By minimizing the loss function of the network output image and label, until the number of training times reaches the set threshold or the value of the loss function reaches the set range, the model parameters are considered to have been trained and saved; the loss function is a composite loss function, and the loss functions used by the generator include adversarial loss, image contrast loss and perceptual loss; the discriminator uses adversarial loss; The graph contrast loss uses the graph formed by the semantic relationship of image blocks to study the topology-aware features and improve the consistency of the block semantic connections in the input and output images; the topology-aware image block features are captured by GNN, where the image block connections are given by the shared adjacency matrix A, and then the node features are obtained and And maximize the node intelligent mutual information through contrast loss; First, for the input image g i ={A,F i }Construct a graph, where A is the adjacency matrix, F i is the node feature representing the image block; the dense feature obtained from the middle layer of the pre-trained feature extraction network E And randomly extract N image block features Set N features to graph g i The node of F i =[f1,…,f N ]; Then, the adjacency matrix is obtained based on the cosine similarity of the image block features If the similarity is higher than a predefined threshold t, the image block is connected, otherwise the image block is disconnected; feature f i 、f j The adjacency matrix A ij The following relationship exists: Then, the output graph g is constructed in a similar way o ={A,F o }; Maintain the topological correspondence between image patches, and the output graph inherits the adjacency matrix A from the input graph; Pool the graph nodes to exploit the task-related focused attention of the graph; Pool the nodes according to their relevance to the task Downsampling is performed and the graph is constructed with fewer nodes to focus on nodes relevant to the task; is the normalized adjacency matrix, W is a shared parameter; following top-K pooling, the similarity score s i =p T z i , from N nodes Z=[z1,…,z N ], where p is a learnable pooling vector; therefore, by excluding the connections of non-selected nodes from the original matrix A, and then weighting the scores of the nodes, and then passing the S-type function σ, there is the following relationship: WITH p,in =σ(S)Z, V p,in =σ(S)V, Given the topological correspondence between the input X and output G(X) of the generator G, the infoNCE loss is used to maximize the mutual information between nodes in the pool graph. The following relationship exists: S5. Evaluate network performance: Select the best evaluation index to measure the accuracy of the algorithm, evaluate the performance of the network, and make corresponding improvements and optimizations; in the process of training the network model, it also includes evaluating the quality of the algorithm colorization results, image similarity and image distortion through evaluation indicators; S6. Save network weights: solidify the final model parameters. When the infrared image colorization operation is needed, the image can be directly input into the network to obtain the final colorized image.
2. The system for applying the infrared image colorization method based on large kernel convolution and graph contrast learning according to claim 1, characterized in that: The system comprises: Image acquisition module, acquiring infrared image data and visible light data; An image processing module receives the collected infrared image data and visible light data, and performs filtering, enhancement and denoising preprocessing to improve image quality while retaining key details in the image; The network training module trains these images, learns the mapping relationship between infrared images and color images, and generates the final colorization result; The quality assessment module uses some image quality assessment indicators to measure the similarity between the colorized image and the real color image, which helps to judge the performance of the network model and optimize and improve it; The quality improvement module uses some restoration and enhancement techniques to further improve the quality of the colorized image based on the feedback from the quality assessment module; The visualization module presents the colorized infrared image to the user in a visual manner, allowing the user to intuitively observe and analyze the image and process or apply it as needed.
Citation Information
Patent Citations
Infrared image true color conversion method and system based on residual attention network and contrast learning
CN118097241A
Image deblurring method based on multi-scale frequency separation network
CN115272113A
Unpaired infrared image colorization method based on comparative learning
CN116503502A
Infrared image colorization method and system based on reference image
CN117876530A
Monocular unsupervised depth estimation method based on contextual attention mechanism
US20210390723A1
