Infrared image generation method and device, equipment and storage medium
By introducing multi-layer convolution and residual structure, multi-head attention mechanism, multi-scale layer residual network, local discriminator and color loss function into the CycleGAN model, the problem of low generation quality is solved, high-quality infrared image generation is achieved, and detection accuracy and reliability are improved.
Patent Information
- Application Number
- CN202510698175.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-09
AI Technical Summary
The existing CycleGAN model has low generation quality when converting color images to infrared images and cannot effectively cope with complex and changeable nighttime environments. In addition, traditional dataset expansion methods rely on manual shooting or physical generation, which makes it difficult to meet system training and optimization requirements.
A generator combining multi-layer convolution and residual structure is introduced into the CycleGAN model. A multi-head attention mechanism and a multi-scale residual network are adopted. In combination with a local discriminator and a CBAM attention mechanism, a color loss function is introduced and the loss function is optimized to improve the generation quality.
The quality of the generated infrared images is significantly improved, which can provide high-quality data sets for target detection, improve detection accuracy and reliability, and effectively improve the problems of feature texture blur and light spot aperture interference.
Smart Images

Figure CN120612387A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an infrared image generation method, apparatus, device and storage medium. Background Art
[0002] As society's attention to people with disabilities, especially the visually impaired, grows, technological innovation plays a significant role in improving their quality of life. The introduction of deep learning technology, in particular, has further enhanced image processing and object recognition capabilities. Through real-time image processing and analysis, computer vision technology can help blind people identify objects and obstacles in their environment, significantly enhancing their ability to live independently and providing adequate support. In real-world scenarios, computer vision technology uses images and videos captured by cameras to identify and analyze them, enabling comprehensive awareness of the surrounding environment, automatically detecting obstacles, recognizing people and objects, and providing timely feedback to the blind through voice devices. This approach effectively improves the system's real-time performance and obstacle recognition accuracy, and provides a solid technical foundation for the intelligent and personalized development of visual assistance systems for the blind. Therefore, the combination of computer vision and deep learning technologies not only enriches the functionality of assistive devices for the blind but also drives the development of more efficient and intelligent visual assistance systems.
[0003] Despite significant progress in computer vision technology for assisting the blind, practical applications still face challenges. The performance of computer vision systems is limited by the quality of the dataset. For blind people traveling at night, infrared camera mode is required to obtain effective visual information for obstacle avoidance. However, current infrared obstacle datasets are limited and cannot meet the requirements for system training and optimization. Consequently, the features learned by the model are incomplete, making it difficult to cope with the complex and changing nighttime environment.
[0004] Traditional dataset expansion methods usually rely on manual photography or physical generation to expand images. However, deep learning methods can generate clear images with different styles by learning the content and structure of the original image without changing the image itself. This provides a new solution for night-time blind obstacle avoidance models that require infrared datasets. However, traditional GAN network models usually require paired datasets when training the generator and discriminator, which is more difficult for practical applications. The emergence of CycleGAN effectively solves this problem. It can learn through asymmetric training without the need for paired image data and generate corresponding infrared images. This provides a solution to the problem that datasets are difficult to match one to one in practical applications. However, the existing CycleGAN model has the problem of low generation quality when generating infrared images from color images. Summary of the Invention
[0005] This application provides an infrared image generation method, apparatus, device, and storage medium that optimize the conversion from color images to infrared images, providing rich data samples for nighttime infrared target detection. The generator network of the ITI-CycleGAN model breaks away from the original simple structure and adopts a combination of multi-layer convolution and residual structures to achieve more accurate feature extraction. To explore the stylistic differences between color and infrared images, a multi-head attention mechanism is introduced into the original generator, focusing on features in different regions and layers simultaneously. This ensures that the generated infrared image retains its basic features while retaining key information related to obstacle detection in the color image. In the discriminator design, a local discriminator is introduced to increase attention to local details, while the CBAM attention mechanism is also introduced. The CBAM attention mechanism increases the receptive field through the dual effects of channel and spatial attention, accurately captures false features, distinguishes false samples, and provides effective feedback for generative model optimization. Finally, the loss function is extended and optimized, introducing a color loss function. During training, the quality of the generated image, its similarity to real infrared images, and the stability of adversarial training are balanced, comprehensively improving model performance and robustness.
[0006] In a first aspect, the present application provides an infrared image generation method, comprising:
[0007] Constructing an image generation model; wherein the image generation model includes two generators and two discriminators, the two generators are respectively a first generator and a second generator, and the two discriminators are respectively a first discriminator and a second discriminator;
[0008] Inputting a color image into a first generator to obtain a target domain image, and inputting the target domain image into a second generator to obtain a source domain image; wherein the target domain image is an infrared image;
[0009] Using the first discriminator to evaluate the quality of converting the color image into the target domain image, and using the second discriminator to evaluate the quality of converting the target domain image into the source domain image;
[0010] The images generated by the two discriminators and the corresponding discrimination results are compared, the loss value is calculated based on the loss function, and the parameters of the generator and the discriminator are updated according to the loss value to obtain the trained image generation model; wherein the loss function includes a color loss function.
[0011] In one possible design, the generator includes a multi-head attention mechanism and a multi-scale residual network; wherein the computation process of the multi-head attention mechanism is expressed as:
[0012] Attention Score(Q,K)=Q·K T
[0013]
[0014] head i =Attention(QW i Q ,KW i K ,VW i V ); i=1,2,...,h
[0015] MultiHead n =Concat(head1,head2,...,head n )
[0016] Final Output=Concat(Output1,Output2,...,Output h )·W O
[0017] Where Attention Score(Q,K) represents the similarity between the query vector and all key vectors, Q represents the feature representation of the "query" sequence, each row corresponds to a query vector, K represents the feature representation of the "key" sequence, each row corresponds to a key vector, T represents the matrix transpose, Attention Weights represents the attention weight, softmax represents the normalization of the dot product score, d k Represents the scaling factor, Attention represents the scaled dot product attention, head i represents the attention output of the i-th head, They represent the projection matrix of the i-th head, h represents the number of attention heads, MultiHead n Represents the final output of the multi-head attention mechanism, Concat represents the operation of merging the outputs of multiple independent attention heads (head) into an overall tensor along the feature dimension, Final Output represents Output1, Output2 and Output h Represents the final output of multi-head attention, W O The output mapping matrix representing the concatenated vectors.
[0018] In one possible design, in the multi-scale layer residual network, the input features are first channel-compressed through the first convolution layer to obtain a first feature map, and multiple convolution operations of different scales are performed on the first feature map. Each convolution operation uses multiple groups to perform multi-scale feature selection and capture local information of different sizes to obtain a second feature map. The second feature map is channel-expanded through the second convolution layer to obtain the output image of the multi-scale layer residual network; wherein the input features are the output after processing by the multi-head attention mechanism.
[0019] In one possible design, the discriminator includes a convolutional layer, an activation function, an instance normalization layer, and a CBAMN attention module; wherein the activation function is applied after the first convolutional layer, the instance normalization layer is used to normalize the input feature map, and the CBAMN attention module is applied after the convolutional layer and the instance normalization layer.
[0020] In one possible design, for the deterministic trend term, the color loss function is expressed as:
[0021]
[0022] Where, Loss color represents color loss, p represents pixel, ANGLE represents angle calculation function, G A Denotes the first generator, G B Denotes the second generator, G B (y) means converting the input y into an intermediate feature representation, y p represents the true color vector of the target image at pixel p, and the subscript p represents the color vector of the generated image at pixel p.
[0023] In one possible design, the loss function is expressed as:
[0024] Loss ITI =Loss GAN +Loss cycle +Loss color
[0025] Where, Loss ITI Represents the loss function, Loss GAN Represents the adversarial loss function, Loss cycle represents the cycle consistency loss function.
[0026] In one possible design, the anti-loss function is expressed as:
[0027]
[0028] Where Dx and D y Represent the discriminators for the source domain X and the target domain Y respectively, represents the global discriminator loss of the source domain X, represents the global discriminator loss of the target domain Y, represents the local discriminator loss of the source domain X, represents the local discriminator loss of the target domain Y;
[0029] The cycle consistency loss function is expressed as:
[0030]
[0031] Where, and Represents the data distribution P data All samples in Pdata(x)(domain X) and Pdata(y)(domain y) take the expectation, F(G(x)) means that the input x∈X is first converted to domain Y through G, and then converted back to domain X through F, G(x) represents the output of the generator G after the input x of the source domain X is converted to the target domain Y, x represents the sample in the source domain X, F(G(y)) means that the input y∈Y is first converted to domain X through F, and then converted back to domain Y through G, G(y) represents the output of the generator G after the input y of the source domain Y is converted to the target domain X, ‖‖1 represents the L1 norm.
[0032] In a second aspect, the present application provides an infrared image generating device, the device comprising a controller, the controller being configured to:
[0033] A model construction unit is configured to construct an image generation model; wherein the image generation model includes two generators and two discriminators, the two generators are respectively a first generator and a second generator, and the two discriminators are respectively a first discriminator and a second discriminator;
[0034] an image generation unit configured to input a color image into a first generator to obtain a target domain image, and input the target domain image into a second generator to obtain a source domain image; wherein the target domain image is an infrared image;
[0035] an image discrimination unit configured to evaluate the quality of converting a color image into a target domain image using the first discriminator, and to evaluate the quality of converting a target domain image into a source domain image using the second discriminator;
[0036] The model training unit is configured to compare the images generated by the two discriminators and the corresponding discrimination results, calculate the loss value based on the loss function, and update the parameters of the generator and the discriminator according to the loss value to obtain a trained image generation model; wherein the loss function includes a color loss function.
[0037] In a third aspect, an embodiment of the present application provides an electronic device comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the infrared image generation method described in the first aspect and various possible designs of the first aspect.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the infrared image generation method described in the first aspect and various possible designs of the first aspect is implemented.
[0039] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the infrared image generation method described in the first aspect and various possible designs of the first aspect.
[0040] The infrared image generation method, apparatus, device, and storage medium provided in this application have at least the following beneficial effects:
[0041] This application addresses the key issue of low generation quality when generating infrared images from color images. Based on the original CycleGAN model, a series of improvements are made from three core aspects: the generator, the discriminator, and the loss function. The overall construction of the ITI-CycleGAN model is realized, and experiments are carried out to verify it. The results show that compared with the original CycleGAN model, the images generated by ITI-CycleGAN have been greatly improved in visual effects and quantitative indicators. It effectively improves problems such as feature texture blur and light spot aperture interference, and the generation quality is relatively high. Based on the image generation effect of this model, it can provide a high-quality and effective infrared data set for the target detection algorithm, effectively guarantee the image data foundation of the target detection task, and improve the detection accuracy and reliability of infrared images. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] Figure 1 A flowchart of the infrared image generation method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of the CycleGAN model structure in the prior art provided in the embodiments of this application;
[0045] Figure 3The overall framework diagram of the ITI-CycleGAN model provided in the embodiment of this application;
[0046] Figure 4 This is a diagram of the generator network structure in the CycleGAN model provided in an embodiment of the present application;
[0047] Figure 5 A structural diagram of the multi-head attention model provided in an embodiment of the present application;
[0048] Figure 6 A structural diagram of the residual block model provided in an embodiment of the present application;
[0049] Figure 7 A structural diagram of a multi-scale convolutional residual block model provided in an embodiment of the present application;
[0050] Figure 8 This is a diagram of the discriminator model structure in the CycleGAN model provided in an embodiment of the present application;
[0051] Figure 9 This is a diagram of the CBAM attention mechanism structure provided in the embodiment of this application;
[0052] Figure 10 A module diagram of the channel attention mechanism provided in an embodiment of the present application;
[0053] Figure 11 A diagram of the spatial attention mechanism module provided in an embodiment of the present application;
[0054] Figure 12 A diagram showing the structure of a discriminator integrating the CBAM attention mechanism provided in an embodiment of the present application;
[0055] Figure 13 Comparison chart of experimental results provided in the embodiments of the present application, where (a)-(d) represent different input images;
[0056] Figure 14 This is a structural diagram of the infrared image generation device provided in an embodiment of the present application.
[0057] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0059] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0060] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned. They should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0061] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0062] Example 1:
[0063] The embodiment of the present application provides a method for generating an infrared image. Figure 1 As shown, it is a flowchart for implementing the infrared image generation method provided in an embodiment of the present application. The infrared image generation method includes the following steps S10-S40.
[0064] S10: Constructing an image generation model; wherein the image generation model includes two generators and two discriminators, the two generators are respectively a first generator and a second generator, and the two discriminators are respectively a first discriminator and a second discriminator;
[0065] S20: Inputting the color image into the first generator to obtain a target domain image, and inputting the target domain image into the second generator to obtain a source domain image; wherein the target domain image is an infrared image;
[0066] S30: using the first discriminator to evaluate the quality of converting the color image into the target domain image, and using the second discriminator to evaluate the quality of converting the target domain image into the source domain image;
[0067] S40: Compare the images generated by the two discriminators and the corresponding discrimination results, calculate the loss value based on the loss function, and update the parameters of the generator and the discriminator according to the loss value to obtain a trained image generation model; wherein the loss function includes a color loss function.
[0068] This infrared image generation method utilizes the generative adversarial network framework of CycleGAN, introducing two generators Ga and Gb (a first generator and a second generator) and two discriminators Dx and Dy (a first discriminator and a second discriminator) to achieve unsupervised conversion of color images into infrared images. Step S10 constructs the image generation model, step S20 processes the data for the generator, step S30 processes the data for the discriminator, and step S40 trains the image generation model. Based on this trained image generation model, infrared images can be generated more accurately.
[0069] like Figure 2 As shown, it is a schematic diagram of the CycleGAN model structure in the prior art provided by an embodiment of the present application. In the CycleGAN model, a color image x is input into the generator Ga to generate a corresponding infrared image Y'. Then, the generated infrared image Y' is input into the generator Gb to obtain a generated color image x'. The task of the discriminator Dy is to determine whether the input image belongs to the infrared domain Y. Finally, by comparing the generated image and the discrimination result, the loss function is calculated, and the parameters of the generator and the discriminator are updated according to the loss value, thereby optimizing the performance of the generation model.
[0070] In this embodiment, Figure 2 The CycleGAN model shown in the figure is improved to establish an image generation model named ITI-CycleGAN. The overall framework of the ITI-CycleGAN model is as follows: Figure 3 As shown in Figure 2, the original generator networks Ga and Gb use a combination of multi-layer convolution and residual structures to extract features from the input image. Building on this, a multi-head attention mechanism is introduced and the residual network is improved to capture the style differences between color and infrared images and extract feature information at different levels.
[0071] The discriminator networks Dx and Dy are responsible for determining whether an image is real. Their inputs include real samples y from the target domain Y and fake samples G(x) generated by the generator Ga. Real and generated samples are classified. To improve the discriminator's assessment of the quality of the generated image, real samples are assigned a higher "realism score" and fake samples are assigned a lower score. A local discriminator and the CBAM attention mechanism are introduced to increase the receptive field, enabling the discriminator to more accurately distinguish fake samples, thereby driving the generative model towards even better performance. Finally, this chapter expands and optimizes the loss function based on the original model. The original model used an adversarial loss function and a cycle consistency loss function to ensure that the generated image not only passes the discriminator's detection but also remains consistent with the input image. However, relying solely on the adversarial loss and cycle consistency loss may not fully capture the details and texture features in the image. Therefore, this example further introduces a color loss function to enhance the texture details of the generated image by optimizing the matching of color information.
[0072] The generator structure in the CycleGAN model is based on an unsupervised learning framework that aims to achieve a mapping relationship between two image domains. The generator in the CycleGAN model adopts a variant of the U-Net architecture and combines it with the design of the residual block (ResNet) to achieve efficient and stable image conversion. The generator network structure in the original CycleGAN model is as follows: Figure 4 shown.
[0073] The generator in the CycleGAN model consists of multiple convolutional layers, residual blocks, and deconvolutional layers. First, the input image passes through three convolutional layers for feature extraction and spatial dimensionality reduction. Second, the core structure of the generator employs six connected residual blocks, which capture long-range dependencies in the image. These residual connections allow the input feature map to be directly added to the convolutional feature map, reducing the risk of vanishing gradients during training and accelerating network convergence. The core structure extracts and transforms high-level image features by stacking multiple residual blocks, enabling the generator to effectively learn the complex mapping relationship between the input image and the target domain. To further improve image reconstruction quality, the generator employs two deconvolutional layers to gradually restore the spatial resolution of the image, generating high-quality images similar to those in the target domain. Finally, the generator uses a convolutional layer to adjust the number of channels in the output image to that of the target image, resulting in an image that matches the characteristics of the target domain. However, the residual network used in the original CycleGAN model still has certain drawbacks:
[0074] (1) The generator in the original CycleGAN model may not be able to accurately focus on the key information or areas in the image when generating images, resulting in the loss or inaccuracy of important details in the generated results.
[0075] (2) Infrared images usually lack the rich texture information of color images, so the generator needs to extract image features at multiple scales to enhance the global and local consistency of the generated results. The ResNet residual network cannot meet this requirement.
[0076] Based on this, this embodiment introduces a multi-head attention mechanism and a multi-scale residual network into the ITI-CycleGAN model.
[0077] The multi-head attention mechanism was first proposed by Vaswani et al. in the Transformer model for natural language processing tasks. Its core idea is to obtain rich representation capabilities by calculating multiple attention heads in parallel, focusing on different parts of the input features. Specifically, the multi-head attention mechanism maps the query (q), key (k), and value (v) generated by the self-attention mechanism to multiple attention subspaces for attention calculation. It can learn independent related information from different representation subspaces. Based on the similarity between the query and the key, an attention matrix is generated to indicate the degree of attention of each query to all keys. Softmax is applied to convert it into a probability distribution. The values are weighted and summed according to the attention weights to obtain the final output. The calculation process is expressed as:
[0078] Attention Score(Q,K)=Q·K T (1)
[0079]
[0080]
[0081] MultiHead n =Concat(head1,head2,...,head n ) (4)
[0082] Multiple attention heads calculate the output of each attention in parallel, then concatenate the outputs of each head and undergo a linear transformation to obtain the final feature representation. The calculation process is expressed as:
[0083] Final Output=Concat(Output1,Output2,..,Output h )·W O (5)
[0084] In formulas (1)-(5), Attention Score (Q, K) represents the similarity between the query vector and all key vectors, Q represents the feature representation of the “query” sequence, and each row corresponds to a query vector, K represents the feature representation of the “key” sequence, and each row corresponds to a key vector, T represents the matrix transpose, Attention Weights represents the attention weight, softmax represents the normalization of the dot product score, and d k Represents the scaling factor, Attention represents the scaled dot product attention, head i represents the attention output of the i-th head, They represent the projection matrix of the i-th head, h represents the number of attention heads, MultiHead n Represents the final output of the multi-head attention mechanism, Concat represents the operation of merging the outputs of multiple independent attention heads (head) into an overall tensor along the feature dimension, Final Output represents Output1, Output2 and Output h Represents the final output of multi-head attention, W O The output mapping matrix representing the concatenated vectors.
[0085] Later, it was introduced into the image generation task. The multi-head attention mechanism can help the network focus on multiple areas of the image at the same time and focus on different feature dimensions through different attention heads. CycleGAN combined with the multi-head attention mechanism can better capture the mapping relationship between color images and infrared images. Each attention head can learn important information in different spatial regions or channel dimensions in the image, so that it can effectively integrate features at different levels and thus improve the quality of the generated image. The multi-head attention mechanism model structure is as follows: Figure 5 As shown in the figure, the entire module is divided into two parts: one part calculates the attention mechanism of the feature map, and the other part calculates the same attention mechanism on the sample results, and finally separates and classifies the two. First, the Q vector is obtained from the convolution of the Conv1 layer, the K vector is obtained from the convolution of the Conv2 layer, and the V vector is obtained from the convolution of the Conv3 layer. Similarly, the feature map generated by the DeConv1 layer is deconvolved to obtain the Q vector, and the feature map generated by the DeConv2 layer is deconvolved to obtain the K vector. Since there are two deconvolution layers, the V vector is obtained by adding and averaging the Q and K vectors.
[0086] The generator in the improved ITI-CycleGAN model can focus more accurately on the key information and areas in the image when generating images, enriching some detailed features in the generated results.
[0087] In the original model CycleGAN, the ResNet residual network is used in the network structure of the generator and discriminator to improve the generation effect and training stability. ResNet is an architecture that improves the training and performance of deep neural networks through residual learning. ResNet solves some challenges faced in deep network training, such as the problem of gradient disappearance and the problem of performance degradation with increasing depth. By introducing residual connections, ResNet enables gradients to flow directly during the backpropagation process, thereby facilitating the training of deeper models. The basic unit of ResNet is the residual block. The residual block model structure is as follows: Figure 6 shown.
[0088] Each residual block consists of three convolutional layers, including one 3x3 convolutional layer and two 1x1 convolutions, and the ReLU activation function is introduced after the convolution operation, which can effectively enhance the nonlinear expression ability of the network. Secondly, a jump connection is added between the output and input of each residual block, so that the learning goal of the network is transformed into learning the residual mapping between input and output rather than directly learning the output. X represents the number of channels of the input feature, L determines the number of convolution kernels, and X / L can balance the computational efficiency and the expression ability of the model. The advantage of this structural design is that the network can focus on learning smaller changes (ie residuals) instead of learning the entire complex mapping function from scratch. However, when the color image is converted to an infrared image, the texture structure is quite different, and a network architecture that can extract image features at multiple scales is required. Therefore, multi-scale feature extraction is improved in the original residual module. The improved multi-scale convolution residual module is as follows. Figure 7 shown.
[0089] In the improved multi-scale residual module, the input features first undergo channel compression through the first convolutional layer to reduce the feature map dimensionality and computational complexity. Subsequently, the feature map undergoes convolution operations of three different scales (3x3, 5x5, and 7x7 kernels), each using 32 groups (Group=32) to select features at multiple scales and capture local information of varying sizes. Finally, the feature map undergoes channel dilation through the second convolutional layer to restore and enhance the expressive power of the features. This multi-scale convolution and channel dilation design strategy improves the conversion from color to infrared images, better capturing spatial information at different scales in color images and thus enhancing the preservation of multi-level details when generating infrared images. Furthermore, the channel compression operation reduces computational complexity while effectively mitigating the risk of overfitting, while the channel dilation enhances the expressive power of the generator, helping to restore rich feature information and thus improving the visual quality of the generated images. Through group convolution technology, the generator can share parameters in multiple local areas, which not only improves computational efficiency but also ensures that more effective features can be retained during the efficient generation process. The final generated infrared image has stronger detail expression and higher authenticity.
[0090] In the CycleGAN model, the core task of the discriminator is to evaluate the quality of the generated image and determine whether it is close enough to the real image of the target domain. CycleGAN has two discriminators, Dx and Dy, one for evaluating the quality of the source domain image converted to the target domain image, and the other for evaluating the quality of the target domain image converted to the source domain image. The goal of these two discriminators is to force the generator to continuously improve through adversarial training and generate more realistic images. Since the main function of the discriminator is to discriminate the generated sample images, its structural function is not as complex as that of the generator. The network structures of Dx and DY discriminators are as follows: Figure 8 shown.
[0091] In CycleGAN, the discriminator plays a key role in distinguishing real images from generated images through a series of convolutional layers, activation functions, and normalization techniques. The network structure typically begins with a convolutional layer (Conv2d), which extracts features from the input image and reduces its spatial dimensionality. To introduce nonlinearity and enhance feature learning, a LeakyReLU activation function is typically applied after each convolutional layer. Furthermore, instance normalization (InstanceNorm2d) is used to normalize feature maps to ensure style consistency and mitigate instabilities during training. Average pooling (AvgPool2d) is also commonly used to downsample feature maps, reducing computational complexity and focusing on higher-level abstract features. However, when generating infrared images, the background color differs significantly from the real image, necessitating varying degrees of enhancement for different image components. To achieve this, a global-local discriminator scheme is employed.
[0092] The global discriminator's task is to judge the entire image, analyzing the entire input image to determine whether it is real or generated. It captures global contextual information and comprehensively considers the structure and details of the entire image to make accurate authenticity judgments. In contrast, the local discriminator focuses on small regions within the image, using random 64x64 image patches with 5 pixel values. It is able to make detailed judgments within a smaller range, better capturing local background details and providing more information to assist the global discriminator. This combined global and local approach enables the model to more comprehensively judge image authenticity at different scales, improving the quality and realism of generated images.
[0093] The discriminator in CycleGAN is typically based on a convolutional neural network (CNN) architecture. It is designed to classify input images and output a scalar value indicating the image's authenticity. The discriminator's goal is to learn how to distinguish between generated images and real images. In terms of network structure, the discriminator uses a series of convolutional layers to continuously extract local features of the image, gradually improving its ability to discern image authenticity. In this way, the discriminator can effectively capture the detailed features of the image and determine whether the generated image conforms to the distribution of the target domain.
[0094] Due to the limitations of their receptive field, traditional convolution operations can only perceive local regions within an image. This makes it difficult for the discriminator to capture global contextual information when processing complex images, affecting its discriminative performance and accuracy. To address this shortcoming, the attention mechanism has been introduced in recent years. This mechanism dynamically assigns different weights to different regions of an image, allowing the network to more effectively focus on important areas while suppressing the influence of irrelevant parts. Therefore, by introducing the attention mechanism, the discriminator's receptive field can be expanded, enabling it to capture global image features over a larger range, thereby improving image generation quality and discrimination accuracy.
[0095] The CBAM attention mechanism is a lightweight and efficient attention mechanism module that aims to improve the model's ability to express key features by enhancing the saliency of feature maps in convolutional neural networks (CNNs). CBAM adaptively adjusts the representation of feature maps by introducing two independent modules: channel attention and spatial attention. The CBAM structure is as follows: Figure 9 shown.
[0096] The channel attention module generates the weight coefficient of the channel dimension by performing global average pooling and global maximum pooling on the feature map, thereby strengthening the information of important channels. The channel attention mechanism module is as follows Figure 10 As shown in the figure, the spatial attention module generates an attention map of spatial dimension by convolution operation through channel aggregation, highlighting the key areas in the image. The spatial attention mechanism module is shown in the figure. Figure 11 Through this joint channel and spatial attention mechanism, CBAM improves the discriminative effect of ITI-CycleGAN in image generation. The module has a simple structure and can be seamlessly integrated into the existing network architecture, and has shown superior results in multiple tasks.
[0097] In this embodiment, the CBAMN attention module is applied to the convolution layer (Conv2d) and the instance normalization layer (InstanceNorm2d) to further enhance the network’s feature representation capabilities. CBAM adaptively adjusts the importance of each channel and spatial position in the feature map through the channel attention mechanism and the spatial attention mechanism, thereby effectively strengthening the representation of key information. This enhancement can help the network further optimize the expression of features in the feature map after preliminary convolution and normalization, reduce the impact of noise, and accelerate the convergence process of the model. The discriminator structure integrating the CBAM attention mechanism is as follows: Figure 12 shown.
[0098] Embedding CBAM into the discriminator not only allows it to better identify the global structure of an image, but also allows it to focus on subtle local features within the image. This fusion approach effectively improves the discriminator's ability to distinguish between real and generated images, reducing errors caused by minor inconsistencies in generated images, thereby enhancing the training effect of the generator and improving the quality and diversity of generated images.
[0099] In the traditional CycleGAN network model, by introducing the adversarial loss (Loss GAN ), cycle consistency loss (Loss cycle ) is used to train the generator and discriminator, thereby realizing the mapping transformation between the source image and the generated image. The original loss function L is shown in formula (6).
[0100] L=Loss GAN +Loss cycle (6)
[0101] However, in practical applications, there is a more obvious light source phenomenon in the generated infrared image. This is because in the image conversion task, the color difference between the source domain and the target domain is often large, which may cause the generated image to have unnatural color deviation in visual effects. Relying solely on the original adversarial loss and cycle consistency loss is often not enough to ensure the authenticity of the generated image in color and texture details. Therefore, based on the traditional CycleGAN, this application introduces a color loss term to promote the consistency of the color distribution of the generated image. Color loss measures the color difference between the generated image and the target image, forcing the model to better maintain the color characteristics of the target domain when performing inter-domain conversion, thereby improving the color naturalness and realism of the generated image.
[0102] The adversarial loss function is the core component of the CycleGAN model. It usually consists of two parts: the global generator loss and the global discriminator loss. They jointly promote the iterative optimization of the network. The adversarial loss function is shown in formulas (7) and (8). It optimizes the model performance through adversarial training of the global generator and the global discriminator. In this training process, the goal of the global generator is to generate images that are as realistic as possible, while the global discriminator attempts to distinguish the difference between real images and generated images. Specifically, there are two global generator networks G A and G B , two global discriminator networks D x and D y The global generator network A transforms the image in the x domain into the image in the y domain, while the global generator network B transforms the image in the y domain back into the image in the x domain. It continuously optimizes itself by minimizing the probability that its generated image is recognized as "fake" by the global discriminator. Global Discriminator D xIt is used to distinguish the real target image from the network generated image, and the global discriminator D y It is used to distinguish source domain images from network-generated images. The global discriminator enhances the discrimination performance by maximizing its ability to correctly identify real images and fake images.
[0103]
[0104]
[0105] In order to enable the ITI-CycleGAN model to focus on the local features of the input image rather than relying solely on global features, thereby improving the quality of the generated image, especially in terms of image details and texture, the local generator loss and local discriminator loss are further introduced into the original adversarial loss function. The local adversarial loss function is shown in formulas (9) and (10).
[0106]
[0107]
[0108] Finally, the adversarial loss function Loss GAN As shown in formula (11):
[0109]
[0110] Where, D x and D y Represent the discriminators for the source domain X and the target domain Y respectively, represents the global discriminator loss of the source domain X, represents the global discriminator loss of the target domain Y, represents the local discriminator loss of the source domain X, represents the local discriminator loss of the target domain Y.
[0111] The cycle consistency loss function is one of the core components of the CycleGAN loss function. Its purpose is to ensure that the generated image can effectively restore the style or features of the original image, so as to maintain the structure and content of the image without loss, as shown in formula (12). Specifically, after converting a daytime sofa photo into an infrared sofa photo, we hope to convert the infrared sofa photo back to a daytime sofa photo, not into other types of photos. If there is no constraint of the cycle consistency loss function, it will be converted into other types of photos. The principle is to convert the image from the x source domain to the y domain, and then pass it through the generator G B By converting it back to the x source domain, we can get an image that is close to the original image. Similarly, another group converts the image from the y domain to the x source domain and then passes it through the generator GA By converting it back to the y domain, we can get an image that is close to the original image.
[0112]
[0113] Where, and Represents the data distribution P data All samples in Pdata(x)(domain X) and Pdata(y)(domain y) take the expectation, F(G(x)) means that the input x∈X is first converted to domain Y by G, and then converted back to domain X by F, G(x) represents the output of the generator G after the input x of the source domain X is converted to the target domain Y, x represents the sample in the source domain X, F(G(y)) means that the input y∈Y is first converted to domain X by F, and then converted back to domain Y by G, G(y) represents the output of the generator G after the input y of the source domain Y is converted to the target domain X, ‖‖1 represents the L1 norm. By retaining the cycle consistency loss function of the original model, ITI-CycleGAN can pay more attention to maintaining the authenticity of the content when generating images, rather than just generating images that "look like".
[0114] The infrared images generated by the original CycleGAN model partially have light source artifacts. To make the generated images closer to the target images in color, this application introduces a color loss function, as shown in formula (13). Since the CycleGAN network does not rely on paired real images, this color adjustment loss function can force the generator to generate images with the same color distribution as the infrared images, and can also avoid color distortion and reduce light source artifacts in the generated images.
[0115]
[0116] Among them, Loss color represents color loss, p represents pixel, ANGLE represents angle calculation function, G A Denotes the first generator, G B Denotes the second generator, G B (y) means converting the input y into an intermediate feature representation, y p The subscript p represents the true color vector of the target image at pixel p, and the subscript p represents the color vector of the generated image at pixel p. The ANGLE function is an angle calculation function. In HSV space, RGB can be viewed as a three-dimensional color vector. The function's purpose is to calculate the angle between two colors. y represents the generated infrared image. The formula calculates the color vector of each pixel in image y and adds them together to obtain the color loss function.
[0117] Final ITI-CycleGAN loss function Loss ITI The formula is shown in (14):
[0118] Loss ITI =Loss GAN +Loss cycle +Loss color (14)
[0119] Example 2:
[0120] Based on the infrared image generation method proposed in Example 1, this example provides an experimental case to further illustrate the feasibility and advancement of this method.
[0121] In this example, the CycleGAN model was trained using Python 3.7 within the PyTorch framework on a four-GPU 4090 GPU in the lab. During training, batch_size and epochs are key hyperparameters. Batch_size refers to the number of samples fed into the model at each iteration, and epochs refers to the number of times the entire training dataset passes through the model. In this experiment, batch_size was set to 8 and epochs to 200 to evaluate the model's performance with these parameters. Analysis of the training results demonstrates the applicability and effectiveness of this parameter combination in the color-to-infrared generation task, providing a reference for other image style generation and transfer tasks.
[0122] The goal of this example is to train a CycleGAN network model capable of generating infrared images. To improve the adaptability and accuracy of the model, the dataset used consists of two main parts: a self-made color dataset and a small infrared target dataset partially derived from a HIT-UAV.
[0123] This custom color dataset is based on the COCO dataset. To better simulate the diverse obstacles encountered in real-world applications, this example adds 22 new obstacle categories to the original dataset. Some of these images are sourced from the data sharing platform Kaggle, covering obstacle information and categories in various scenarios and angles. Other data was captured using an Orbbec Gemini2 camera, ensuring data reliability while significantly enhancing the dataset's diversity.
[0124] After acquiring all the image data, in order to ensure the consistency of the data and the effectiveness of model training, this embodiment performs a series of preprocessing operations on all images. First, the size of all images is uniformly adjusted to 256x256. In order to further improve the robustness and generalization ability of the model and better cope with various complex situations that may arise in practical applications, we adopt a variety of data enhancement techniques. These include color transformation and brightness adjustment for color images, and scale transformation and rotation transformation for infrared images. By randomly rotating the image, the performance of obstacles under different perspectives is simulated, so that the model can learn the characteristics of obstacles at different angles. Scale transformation and rotation transformation can effectively enrich the infrared image samples. Color transformation adjusts the color distribution of the image so that the model does not rely on specific colors, thereby improving its adaptability in different lighting and color environments. Brightness adjustment technology simulates scene changes under different lighting conditions to ensure that the model can accurately identify and generate infrared images under various light intensities.
[0125] The above-mentioned dataset and data processing process provide a high-quality, diverse, and robust data foundation for the training of the CycleGAN network model.
[0126] When using the CycleGAN network to convert color images into infrared images, commonly used objective evaluation indicators include peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM). PSNR is the ratio of image signal to noise calculated based on mean square error (MSE). The higher the value, the closer the generated image is to the real image. The mean square MSE is an indicator based on pixel difference calculation. It measures the difference between the generated image and the real infrared image by taking the square average of the pixel difference between the two. The MSE calculation formula is shown in (15):
[0127]
[0128] Where m and n are the height and width of the image respectively, is to generate an image, is a real image. The PSNR calculation formula is shown in (16):
[0129]
[0130] Among them MAX I is the maximum possible value of the image pixel value (for example, for a 16-bit image, MAX I =65535).
[0131] SSIM evaluates the similarity between images from three aspects: brightness, contrast and structure. 48]The closer its value is to 1, the more similar the two images are in visual perception, which is more consistent with the human eye's judgment of image quality. The SSIM calculation formula is shown in (17):
[0132]
[0133] where μ x and μ y are the mean of image x and y respectively, and They are variance, σ xy is the covariance, C1 and C2 are constants used to avoid the denominator being zero.
[0134] In this experiment, based on the characteristics of the GAN model, generating infrared images from color images requires the input of paired color-infrared image data. However, due to data acquisition resource limitations at this stage, paired color-infrared image data cannot be provided. The CycleGAN model can perform image-to-image conversion without paired data, so the CycleGAN network was selected as the experimental model, using the above dataset as input data, and using PSRN and SSIM as evaluation indicators. At the same time, in order to further improve the model performance, this embodiment made targeted improvements to the model and verified these improved modules in the experiment. The experimental data is shown in Table 1.
[0135] Table 1 Experimental data table
[0136]
[0137] When the original CycleGAN model generates infrared images, the PSNR is 22.18 and the SSIM is only 0.62, resulting in low quality of the generated images, blurred feature textures, and often large-area light spots, apertures and other unnatural phenomena. By optimizing the generator, discriminator structure and loss function, the ITI-CycleGAN model is proposed. After the improvement, the ITI-CycleGAN has been significantly improved in image quality, with a PSNR value of 28.66 and an SSIM value of 0.83. Compared with the original model, it effectively improves the feature texture details of the generated image and significantly reduces the appearance of impurity phenomena such as light spots and apertures. These improvements not only improve the visual effect of infrared images, but also provide a higher quality infrared image dataset for target detection applications, effectively enhancing the usability and reliability of the model in actual application scenarios. The experimental results show that Figure 13 shown.
[0138] Example 3:
[0139] The present application also provides an infrared image generating device, such as Figure 14 As shown, the infrared image generating device includes:
[0140] The model construction unit 1401 is configured to construct an image generation model; wherein the image generation model includes two generators and two discriminators, the two generators are respectively a first generator and a second generator, and the two discriminators are respectively a first discriminator and a second discriminator;
[0141] The image generation unit 1402 is configured to input the color image into the first generator to obtain a target domain image, and input the target domain image into the second generator to obtain a source domain image; wherein the target domain image is an infrared image;
[0142] The image discriminator 1403 is configured to evaluate the quality of converting the color image into the target domain image using the first discriminator, and to evaluate the quality of converting the target domain image into the source domain image using the second discriminator;
[0143] The model training unit 1404 is configured to compare the images generated by the two discriminators and the corresponding discrimination results, calculate the loss value based on the loss function, and update the parameters of the generator and the discriminator according to the loss value to obtain a trained image generation model; wherein the loss function includes a color loss function.
[0144] An embodiment of the present application provides an electronic device, which may include a processor and a memory, wherein the processor and the memory can communicate with each other; illustratively, the processor and the memory communicate with each other via a communication bus.
[0145] The processor executes the computer-executable instructions stored in the memory, so that the processor implements the solutions in the above embodiments. The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0146] The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. System buses can be categorized as address buses, data buses, and control buses. Transceivers enable communication between the database access device and other computers (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) or non-volatile memory.
[0147] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.
[0148] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the infrared image generation method of the above embodiment.
[0149] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, it can implement the technical solution of the infrared image generation method in the above embodiment.
[0150] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.
[0151] Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of these modules may be selected to implement the solution of this embodiment based on actual needs.
[0152] In addition, the functional modules in the various embodiments of the present application may be integrated into a single processing unit, or each module may exist physically separately, or two or more modules may be integrated into a single unit. The above-mentioned modules may be implemented in the form of hardware or hardware plus software functional units.
[0153] The above-mentioned integrated module implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0154] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0155] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.
[0156] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be divided into address buses, data buses, and control buses.
[0157] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0158] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.
[0159] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating an infrared image, characterized in that: The method comprises: Constructing an image generation model; wherein the image generation model includes two generators and two discriminators, the two generators are respectively a first generator and a second generator, and the two discriminators are respectively a first discriminator and a second discriminator; Inputting a color image into a first generator to obtain a target domain image, and inputting the target domain image into a second generator to obtain a source domain image; wherein the target domain image is an infrared image; Using the first discriminator to evaluate the quality of converting the color image into the target domain image, and using the second discriminator to evaluate the quality of converting the target domain image into the source domain image; The images generated by the two discriminators and the corresponding discrimination results are compared, the loss value is calculated based on the loss function, and the parameters of the generator and the discriminator are updated according to the loss value to obtain the trained image generation model; wherein the loss function includes a color loss function.
2. The infrared image generation method according to claim 1, characterized in that: The generator includes a multi-head attention mechanism and a multi-scale layer residual network; wherein the calculation process of the multi-head attention mechanism is expressed as: Attention Score(Q,K)=Q·K T head i =Attention(QW i Q ,KW i K ,VW i V );i=1,2,...,h MultiHead n =Concat(head1,head2,...,head n ) Final Output=Concat(Output1,Output2,...,Output h )·W O Where Attention Score(Q,K) represents the similarity between the query vector and all key vectors, Q represents the feature representation of the "query" sequence, each row corresponds to a query vector, K represents the feature representation of the "key" sequence, each row corresponds to a key vector, T represents the matrix transpose, Attention Weights represents the attention weight, softmax represents the normalization of the dot product score, d k Represents the scaling factor, Attention represents the scaled dot product attention, head i represents the attention output of the i-th head, They represent the projection matrix of the i-th head, h represents the number of attention heads, MultiHead n Represents the final output of the multi-head attention mechanism, Concat represents the operation of merging the outputs of multiple independent attention heads (head) into an overall tensor along the feature dimension, Final Output represents Output1, Output2 and Output h Represents the final output of multi-head attention, W O The output mapping matrix representing the concatenated vectors.
3. The infrared image generation method according to claim 2, characterized in that: In the multi-scale layer residual network, the input features are first channel-compressed through the first convolution layer to obtain a first feature map, and multiple convolution operations of different scales are performed on the first feature map. Each convolution operation uses multiple groups to perform multi-scale feature selection and capture local information of different sizes to obtain a second feature map. The second feature map is channel-expanded through the second convolution layer to obtain the output image of the multi-scale layer residual network; wherein the input features are the output after processing by the multi-head attention mechanism.
4. The infrared image generation method according to claim 1, characterized in that: The discriminator includes a convolutional layer, an activation function, an instance normalization layer and a CBAMN attention module; wherein the activation function is applied after the first convolutional layer, the instance normalization layer is used to normalize the input feature map, and the CBAMN attention module is applied after the convolutional layer and the instance normalization layer.
5. The infrared image generation method according to claim 1, characterized in that: For the deterministic trend term, the color loss function is expressed as: Where, Loss color represents color loss, p represents pixel, ANGLE represents angle calculation function, G A Denotes the first generator, G B Denotes the second generator, G B (y) means converting the input y into an intermediate feature representation, y p represents the true color vector of the target image at pixel p, and the subscript p represents the color vector of the generated image at pixel p.
6. The infrared image generation method according to claim 5, characterized in that: The loss function is expressed as: Loss ITI =Loss GAN +Loss cycle +Loss color Where, Loss ITI Represents the loss function, Loss GAN Represents the adversarial loss function, Loss cycle represents the cycle consistency loss function.
7. The infrared image generation method according to claim 6, characterized in that: The adversarial loss function is expressed as: Where, D x and D y : represents the discriminator for the source domain X and the target domain Y, represents the global discriminator loss of the source domain X, represents the global discriminator loss of the target domain Y, represents the local discriminator loss of the source domain X, represents the local discriminator loss of the target domain Y; The cycle consistency loss function is expressed as: Where, and Represents the data distribution P data All samples in Pdata(x)(domain X) and Pdata(y)(domain y) take the expectation, F(G(x)) means that the input x∈X is first converted to domain Y through G, and then converted back to domain X through F, G(x) represents the output of the generator G after the input x of the source domain X is converted to the target domain Y, x represents the sample in the source domain X, F(G(y)) means that the input y∈Y is first converted to domain X through F, and then converted back to domain Y through G, G(y) represents the output of the generator G after the input y of the source domain Y is converted to the target domain X, ‖‖1 represents the L1 norm.
8. An infrared image generating device, characterized in that: The device comprises: A model construction unit is configured to construct an image generation model; wherein the image generation model includes two generators and two discriminators, the two generators are respectively a first generator and a second generator, and the two discriminators are respectively a first discriminator and a second discriminator; an image generation unit configured to input a color image into a first generator to obtain a target domain image, and input the target domain image into a second generator to obtain a source domain image; wherein the target domain image is an infrared image; an image discrimination unit configured to evaluate the quality of converting a color image into a target domain image using the first discriminator, and to evaluate the quality of converting a target domain image into a source domain image using the second discriminator; The model training unit is configured to compare the images generated by the two discriminators and the corresponding discrimination results, calculate the loss value based on the loss function, and update the parameters of the generator and the discriminator according to the loss value to obtain a trained image generation model; wherein the loss function includes a color loss function.
9. An electronic device, characterized in that: include: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the infrared image generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the infrared image generation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image data set generation method
CN114092827A
Infrared weak and small moving target generation algorithm based on fusion attention GAN
CN117036875A
Infrared image generation method based on improved generative adversarial network
CN117541665A
Image generation method and device for improving self-attention generative adversarial network and medium
CN118485736A
Infrared image generation method based on multi-scale perception
CN119648831A
Cited By
Tablet abnormal image generation method based on regional attention mechanism
CN121033592A
