A method for contrast enhancement of temperature-sensitive paint images
Through the improved U-Net structure and bilateral spatial affine model, combined with Patch-GAN and GAN networks, efficient contrast enhancement of temperature-sensitive paint images is achieved, solving the problems of insufficient generator parameter training and insufficient overall image coordination. Improved image enhancement effects and speed.
Patent Information
- Application Number
- CN202410939684.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-07-15
AI Technical Summary
In the existing generative adversarial network model for contrast enhancement of temperature-sensitive paint images, the generator parameter training is insufficient, resulting in local area parameters not being updated, the test image enhancement effect is not obvious enough, and the overall coordination and detailed supervision of the image are ignored.
Using the improved U-Net structure as the generator, combined with the discriminator of Patch-GAN and GAN network, the mapping of low-resolution images to high-resolution images is realized through the bilateral space affine model, and supervised training of secondary generated images is performed. Ensure image quality improvement.
It effectively reduces the method's dependence on models and hardware, improves the speed and contrast enhancement effect of image enhancement, solves the problem of insufficient target contrast in the image, and reduces errors in subsequent processing.
Smart Images

Figure CN118469888B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine vision graphics and image processing, and more specifically, to a method for enhancing the contrast of a temperature-sensitive paint image. Background Art
[0002] Thermosensitive paint is based on the principle of thermal quenching. After being excited by light of a specific wavelength, the thermosensitive probe emits light of another wavelength. The light intensity is inversely proportional to the temperature of the thermosensitive paint. Thermosensitive paint is widely used in temperature distribution measurement and transition position measurement in wind tunnel tests to verify the drag reduction design and thermal protection design of aircraft. In the transition position measurement test, it is necessary to identify the transition position based on the temperature step area. Since the bit depth of the thermosensitive paint image is generally 16 bits, and it is affected by the uneven concentration of the coating and the intensity of the excitation light, the thermosensitive paint image exhibits the characteristics of a wide dynamic range. The combination of machine learning technology with weak signal enhancement and thermosensitive paint technology provides possibilities for many novel measurement applications.
[0003] The existing generative adversarial network model is based on CGAN and uses the U-Net structure. By improving the U-Net structure, the network effect can be effectively improved, and the result will converge faster. However, due to problems with the dataset itself during the training process, such as the real image in the paired image is a processed image, or there are not many datasets, the parameters of the final generator are not fully trained, and the parameters of the local area are not updated, resulting in an improvement in the final test image enhancement effect, but the contrast enhancement is not obvious enough in practical applications. At present, most of the generators of generative adversarial networks choose Patch-GAN at the same time. Although it can control the accuracy of details, it ignores the overall coordination of the image. However, the same conventional judgment of whether an image is good lacks supervision of image details. Summary of the invention
[0004] An object of the present invention is to solve at least the above problems and / or disadvantages and to provide at least the advantages which will be described hereinafter.
[0005] In order to achieve these purposes and other advantages of the present invention, a method for enhancing contrast of a temperature-sensitive paint image is provided, comprising:
[0006] S1, preprocessing the original high-resolution image X used by the camera to obtain a low-resolution original image x;
[0007] S2, construct a network training model to process x to output the corresponding discriminant image z;
[0008] S3, taking X, x, and z as inputs to construct a fitted bilateral space affine model to find the mapping relationship between x and z;
[0009] The mapping relationship is applied to X to generate the final contrast-enhanced image Z.
[0010] Preferably, in S1, the preprocessing includes: denoising and enhancing X, image cropping, and downsampling the cropped X by convolution.
[0011] Preferably, in S2, the network training model includes:
[0012] A generator built on top of U-net;
[0013] A discriminator D1 built on patch-GAN;
[0014] A discriminator D2 built on the basis of the GAN network binary classification discriminator;
[0015] Among them, both the discriminator D1 and the discriminator D2 include three convolutional layers and an IR module.
[0016] Preferably, during the process of the generator generating images twice, the discriminator D1 supervises the generator to generate two high-quality target images G(x) and G(G(x));
[0017] Discriminator D2 selects the image with better quality among G(x) and G(G(x)) as the z output.
[0018] Preferably, the construction of the generator includes the following contents:
[0019] Use single convolution instead of conventional double convolution in each layer of U-net;
[0020] Add spatial attention gates to all layers of the U-net encoder instead of the second convolutional layer;
[0021] Use instance normalization in each layer of U-net;
[0022] Use transposed convolution in the decoding layer of U-net instead of direct upsampling;
[0023] The standard convolution kernel of size 3 used in U-Net is replaced by a convolution kernel of size 7.
[0024] In S3, the method of constructing the fitted bilateral space affine model includes:
[0025] S30, dividing x and z respectively to obtain a plurality of corresponding regions I, so that the two images are in a linear mapping relationship based on the region I;
[0026] S31, respectively obtaining a 7*7 region I from x and z to obtain a comparison interval, obtaining a mapping relationship between the comparison intervals through a linear mapping function, and saving the mapping relationship in a mapping matrix;
[0027] S32, select the next region I in x with a step size of 1, and repeat S31 until all regions I are traversed;
[0028] S33, based on the size ratio of x to X, select region II from X that has a ratio corresponding to region I, apply the corresponding mapping relationship in the mapping relationship matrix, and calculate the pixel value of the region corresponding to region II in Z;
[0029] S34, select the next region II in X with a step size of 1, and repeat S33 until all regions I are traversed;
[0030] Among them, in S33-S34, if there are multiple regional pixel values for the same area II, after obtaining all the regional pixel values of the same area II position, all the regional pixel values are added together, the proportion of each regional pixel value is calculated, and the proportion value is used as the proportional coefficient for the addition of each regional pixel value to obtain a unique value corresponding to a single area II position.
[0031] The present invention includes at least the following beneficial effects: the present invention realizes the mapping of low-resolution images to high-resolution images by constructing a fitted bilateral space affine model, thereby effectively reducing the method's dependence on models and hardware, improving the speed of image enhancement, and being able to solve the problem of insufficient target contrast in images during image acquisition, thereby reducing errors in subsequent image processing.
[0032] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 Schematic diagram of the processing flow of the temperature-sensitive paint image contrast enhancement method of the present invention;
[0034] Figure 2 It is a structural schematic diagram of the improved U-net generator of the present invention;
[0035] Figure 3 Schematic diagram of the multi-spatial attention structure of the present invention;
[0036] Figure 4 Schematic diagram of the processing flow of the discriminator D1 of the present invention;
[0037] Figure 5 Schematic diagram of the processing flow of the discriminator D2 of the present invention;
[0038] Figure 6 It is a schematic diagram of the processing flow of the feature extraction module (Inception-Reduction (IR)) of the present invention;
[0039] Figure 7 A schematic diagram of the process flow of fitting a bilateral space affine model in the present invention;
[0040] Figure 8 is an original image according to an embodiment of the present invention;
[0041] Fig. 9 This is a contrast enhanced image according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.
[0043] In order to improve the final contrast enhancement effect and supervise the detail information of the image, the present invention proposes a temperature-sensitive paint image contrast enhancement method, using an improved U-Net structure as a generator and Patch-GAN as a discriminator. By constructing a self-adversarial network structure, the generator is used to generate images twice, and the two discriminators are used to supervise the details and the whole of the generated image at the same time, so as to enhance the stability of the image generated by the generator, and grasp the detail information of the image and the coordination of the image as a whole, including:
[0044] First, the original high-resolution image is denoised, resized, and then downsampled to reduce the image resolution and reduce the excessive reliance on computer hardware resources during image processing; the generator structure is a U-Net architecture. Generator G is trained twice so that more parameters in the generator are optimized and updated in the second training; discriminator D1 is a Patch-GAN to judge the quality of the two images generated by generator G; discriminator D2 is a binary discriminator to determine the better image of the two images generated by generator G, forming a self-adversarial process. By imposing new constraints on the generator to provide unsupervised training, the generator is prompted to update additional parameters to ensure that the image quality gradually improves; fitting the bilateral space affine model is to realize the mapping relationship between low-resolution images and high-resolution images, and finally obtain high-resolution and high-contrast images.
[0045] The processing flow of the temperature-sensitive paint image contrast enhancement method is as follows: Figure 1 As shown, specifically including:
[0046] S1, preprocessing of image before input;
[0047] Before the image captured by the camera is directly input into the network model, it needs to be processed by denoising and enhancement to obtain the original high-definition image with less interference from the external environment. At the same time, image cropping and downsampling are also required to facilitate model processing, reduce model parameters and reduce the model's demand for hardware. Therefore, the specific process of S1 is as follows:
[0048] S11. Eliminate the influence of sensor material properties, working environment, electronic components and circuit structure during the image acquisition process of image sensors CCD and CMOS;
[0049] S12, adjusting the size of the original image to obtain the required input image X′, and downsampling by convolution to obtain a low-resolution original image x of appropriate size.
[0050] S2. Construct an improved U-net generator G and a network training model with two discriminator structures; the generator generates images twice, one of which is supervised by a discriminator to generate two high-quality target images, and the other discriminator selects the image z with better quality among the two generated images for output, forming a self-adversarial process. By imposing new constraints on the generator to provide unsupervised training, additional parameters in the generator are updated to ensure that the image quality gradually improves;
[0051] Among them, the model structure of the U-net generator G is as follows Figure 2 As shown, the contents of the construction are as follows:
[0052] (1) Based on U-net, a generator is constructed, using single convolution instead of conventional double convolution in each layer of U-net, which significantly reduces the running time and reduces the usage of GPU memory without significantly affecting the image quality.
[0053] (2) Add spatial attention gates (multi-spatial attention mechanism) to all layers of the U-net encoder to replace the second convolutional layer. Figure 3 As shown in the figure, the multi-spatial attention mechanism uses a pooling layer that combines maximum pooling and average pooling to downsample the image and generate a spatial feature map. This combination helps to amplify important areas of the input, suppress less relevant areas, and maintain the clarity and lighting consistency of the background. The specific operation of the pooling layer is to aggregate the information of the input image to generate a low-resolution feature map; then the low-resolution feature map is assigned weights to each feature through a convolutional layer; then the obtained weight map is multiplied with the original feature map to obtain the output of the spatial attention gate.
[0054] (3) Using instance normalization (InstanceNorm) in each layer of U-net solves the overall whitening and color distortion caused by batch normalization (BatchNorm), and a larger dynamic color range can be obtained.
[0055] (4) Using transposed convolution instead of direct upsampling in the decoding layer of U-net increases the number of trainable parameters and enables better parameter fine-tuning.
[0056] (5) Replacing the standard kernel used in U-Net with a larger kernel can obtain more contextual information, retain minor details, and help preserve complex details.
[0057] Through the modification of the above contents, the U-net generator G with improved local structure is improved on the basis of U-net.
[0058] Input the low-resolution original real image x into the generator G, and obtain the first generated image G(x) after training; input the first generated image G(x) into the generator G again to obtain the second generated image G(G(x));
[0059] S3. Input the real image Y corresponding to the original high-resolution real image X and the first generated image G(x) into the discriminator D1 to judge the quality of the first generated image G(x); input the real image Y and the second generated image G(G(x)) into the discriminator D1 to judge the quality of the second generated image G(G(x)); input the image G(x) and the image G(G(x)) into the discriminator D2 to determine whether the image quality of the image G(G(x)) is better than that of the image G(x), and obtain the output image z of the network.
[0060] The structure of the discriminator D1 is as follows Figure 4 The specific contents are as follows:
[0061] Based on patch-GAN, the first discriminator D1 is constructed. The purpose of discriminator D1 is to judge the quality of the image generated by generator G, so that the generated image is closer to the real image and has richer feature information. Patch-GAN determines the authenticity of each local patch of the image. By using a small receptive field, discriminator D1 can make a more fine-grained decision about the realism of the image. The first image G(x) generated by generator G is input into discriminator D1. After discriminator D1 judges that the image is "real", the first generated image G(x) is input into generator G to obtain the second generated image G(G(x)), which is input into discriminator D1 again. After discriminator D1 judges that it is "real", the twice generated images can be input into discriminator D2.
[0062] The structure of the discriminator D2 is as follows Figure 5 The specific contents are as follows:
[0063] Based on the binary classification discriminator of the GAN network, a second discriminator D2 is constructed. The purpose of the discriminator D2 is to determine whether the image quality of the secondary generated image G(G(x)) is better than that of the primary generated image G(x). The higher quality discriminant image z is output by the network and input into the fitted bilateral space affine model for subsequent processing. The entire image generation is a self-adversarial process. Unlike traditional methods, the self-adversarial model provides unsupervised training by imposing new constraints on the generator, prompting additional parameters in the generator to be updated to ensure that the image quality gradually improves.
[0064] It should be noted that the discriminator D1 and the discriminator D2 have similar structures and the same feature extraction module, such as Figure 6 As shown in the figure, it includes three convolutional layers and a feature extraction module (Inception-Reduction (IR) module). The output results of the three convolutional layers are concatenated and input into the Inception-Reduction (IR) module to help the model obtain richer feature information. The combination of the two discriminators realizes the recognition of the overall and detailed aspects of the generated image, which is conducive to the generation of beautiful images.
[0065] The total loss of this model is composed of two loss functions L final1 and L final2 constitute. L final1 It consists of three parts: the original loss of the generative adversarial network, the L1 loss, and the perceptual loss.
[0066]
[0067] In the above formula, Lad 1 is the adversarial loss of the first generated image, L 11 is the L1 loss of the first generated image, L p1 is the perceptual loss of the first generated image, α express L 11 The weight of β express L p1 The weight of represents the output of the discriminator for the real data, and the probability that the discriminator considers the data to be real data. represents the output of the discriminator for the first generated data, the probability that the discriminator considers the first generated data to be true data, N is the total number of pixels in the image, i represents the i-th pixel, x i represents the pixel value of the i-th pixel, represents the jth feature layer, n represents the number of feature layers, Lad 1To maximize the correct classification probability of the real image Y, while minimizing the misclassification probability of the generated image G(x); L1 loss ( L 11 ) can measure the difference between the generated image G(x) and the real image Y. Using L1 loss can get a smoother and more natural generated result; Perceptual loss ( L p1 ) can measure the difference between the generated image and the target image in the high-level feature space, focusing not only on the difference at the pixel level but also on the similarity of images at a higher level, which helps to improve the quality of the generated image.
[0068] L final2 It consists of four parts, namely Lad s is the adversarial loss between the first generated image and the second generated image, Lad 2 is the adversarial loss of the second generated image, L 12 is the L1 loss of the second generated image, L p2 The perceptual loss for the second generated image;
[0069]
[0070] Lad 2. L1 loss and perceptual loss ( L p2 )and L final1 has the same effect, while Lad s The purpose is to maximize the correct classification probability of the secondary generated image G(G(x)) and minimize the incorrect classification probability of the primary generated image G(x). The result can be used to determine whether the secondary generated image is better than the primary generated image.
[0071] S4, find the mapping relationship between the low-resolution original image x and its corresponding discriminant image z; apply the mapping relationship to the original high-resolution image X to generate the final contrast-enhanced image Z. In S4, based on the original high-resolution image X and the corresponding down-sampled low-resolution original image x, the discriminant image z with better quality in the secondary generated image corresponding to the low-resolution original image x is used as the input of the contrast-enhanced image, and a fitting bilateral space affine model is constructed to find the mapping relationship between the low-resolution original image x and its corresponding discriminant image z.
[0072] By constructing a bilateral space affine model, the mapping of low-resolution images to high-resolution images is achieved, which effectively reduces the method's dependence on models and hardware and improves the speed of image enhancement. The structure of the bilateral space affine model is as follows: Figure 7 The specific contents include:
[0073] Specific content includes:
[0074] S41, when the paired area of the two images is small enough, it can be seen that the mapping relationship between the two areas is linear. Obtain 7*7 areas from the two low-resolution images x and z in turn, calculate the linear mapping function of the two areas, and save the mapping relationship in a new matrix.
[0075] Then, the next area is selected with a step size of 1, and the linear mapping relationship between the two is calculated and saved. After repeating the above operation, a mapping relationship matrix can be obtained.
[0076] S42, applying the mapping relationship matrix to the high-resolution image X. According to the size ratio of the low-resolution image X to the high-resolution image X, select a region of corresponding proportion from the high-resolution image X, apply the first mapping relationship in the mapping relationship matrix, and calculate the regional pixel value of the high-resolution contrast enhancement image Z; then select the next region of the image X with a step size of 1 and apply the second mapping relationship in the mapping relationship matrix to calculate the image Z result.
[0077] Repeating the above process, multiple values will appear at the position of a single pixel in the result of image Z, and the number of values at each position may also be different; in order to obtain a unique value, the traditional method will average all values, but will ignore the differences in mapping relationships between different regions, and the final effect is not very obvious. In order to obtain a unique value, the mapping relationship between different regions is reflected in the final result and considering the difference in the number of values at different positions, an adaptive method is used to obtain a unique value.
[0078] The specific method is to add up all the values at the same position after obtaining them, calculate the ratio of each value, and use the ratio value as the proportional coefficient for adding each value, so as to finally obtain the unique value of a single pixel position.
[0079] By constructing and fitting a bilateral space affine model, the mapping matrix between image x and image z is obtained. The mapping matrix is then applied to image Z to obtain the final high-resolution and high-contrast image Z in an adaptive way.
[0080] Since the original high-resolution image is large in size, directly using the high-resolution image as the network input takes a long time to train the model, and a large number of parameters will be generated during the process, which places high demands on the model itself and hardware resources. By constructing a fitted bilateral space affine model, the mapping of low-resolution images to high-resolution images is achieved, which effectively reduces the method's dependence on the model and hardware resources and improves the speed of image enhancement.
[0081] Example:
[0082] This application proposes a multi-spatial attention self-adversarial generative adversarial network model for contrast enhancement. First, the original high-resolution image is denoised, resized, and then downsampled to reduce the resolution of the image, thereby reducing excessive reliance on computer hardware resources during image processing; the generator structure is a U-Net architecture. The generator G is trained twice so that more parameters in the generator are optimized and updated in the secondary training; the discriminator D1 is a Patch-GAN, which is used to judge the quality of the two images generated by the generator G; the discriminator D2 is a binary discriminator, which is used to determine the better image of the two images generated by the generator G, thereby forming a self-adversarial process. Unsupervised training is provided by imposing new constraints on the generator, which prompts the generator to update additional parameters and ensures that the image quality gradually improves; fitting the bilateral space affine model is to realize the mapping relationship between low-resolution images and high-resolution images, and finally obtain high-resolution and high-contrast images. The process is as follows Figure 1 shown.
[0083] Specifically include the following:
[0084] S1, preprocessing of image before input;
[0085] There is camera noise in the images captured by the camera, so the first step in image data preprocessing is to remove the noise generated by the camera hardware. First, collect pure noise background image data. The specific method is to cover the camera lens with a lens cap and collect an image under lightless conditions. This image is the camera noise image. Then, the blurred image of the blades collected by the camera is subtracted from the noise background image to remove the camera noise.
[0086] Then, although the image captured by the camera has a certain size, different cameras capture different sizes of images. In order to adapt to the input of the model, the image must be cropped and adjusted to a size suitable for the model input to obtain image X, such as Figure 8 ; Then, in order to reduce the dependence on hardware facilities, the resized image is convolved. The specific convolution size and size can be adjusted according to actual conditions to obtain the image x.
[0087] S2. Input the low-resolution original real image x into the generator G to obtain the first generated image G(x); input the first generated image G(x) into the generator G again to obtain the second generated image G(G(x)); forward the generated image to the generator again, and the self-adversarial discriminator discriminates the two generated images to promote the generation of more parameter updates to supervise the improvement of image quality during the generation process.
[0088] S3. Input the real image Y corresponding to the original high-resolution real image X and the first generated image G(x) into the discriminator D1 to judge the quality of the first generated image G(x); input the image Y and the second generated image G(G(x)) into the discriminator D1 to judge the quality of the second generated image G(G(x)); input the image G(x) and the image G(G(x)) into the discriminator D2 to determine whether the image quality of the second generated image G(G(x)) is better than that of the first generated image G(x), and obtain the output image z of the model.
[0089] S4, find the mapping relationship between the low-resolution image x and its corresponding contrast-enhanced image z; apply the mapping relationship to the high-resolution image X to generate the final contrast-enhanced image Z, such as Fig. 9 ,from Fig. 9 It can be seen that this solution can solve the problem of insufficient target contrast in the image during image acquisition and meet the usage requirements.
[0090] The above solution is only an illustration of a preferred embodiment, but is not limited thereto. When implementing the present invention, appropriate replacement and / or modification can be performed according to user needs.
[0091] Although the embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and the embodiments. It can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily realized. Therefore, without departing from the general concept defined by the claims and equivalent scope, the present invention is not limited to the specific details and the illustrations shown and described here.
Claims
1. A method for enhancing contrast of a temperature-sensitive paint image, characterized in that: include: S1, preprocessing the original high-resolution image X used by the camera to obtain a low-resolution original image x; S2, construct a network training model to process x to output the corresponding discriminant image z; S3, taking X, x, and z as inputs to construct a fitted bilateral space affine model to find the mapping relationship between x and z; Applying the mapping relationship to X to generate a final contrast-enhanced image Z; In S2, the network training model includes: A generator built on top of U-net; A discriminator D1 built on patch-GAN; A discriminator D2 built on the basis of the GAN network binary classification discriminator; Among them, both the discriminator D1 and the discriminator D2 include three convolutional layers and an IR module; In the process of the generator generating images twice, the discriminator D1 supervises the generator to generate two high-quality target images G(x) and G(G(x)); Discriminator D2 selects the image with better quality among G(x) and G(G(x)) as output z; The construction of the generator includes the following: Use single convolution instead of conventional double convolution in each layer of U-net; Add spatial attention gates to all layers of the U-net encoder instead of the second convolutional layer; Use instance normalization in each layer of U-net; Use transposed convolution in the decoding layer of U-net instead of direct upsampling; The standard convolution kernel of size 3 used in U-Net is replaced by a convolution kernel of size 7.
2. The method for enhancing contrast of a temperature-sensitive paint image according to claim 1, characterized in that: In S1, the preprocessing includes: denoising and enhancing X, image cropping, and downsampling the cropped X by convolution.
3. The method for enhancing contrast of a temperature-sensitive paint image according to claim 1, characterized in that: In S3, the method of constructing the fitted bilateral space affine model includes: S30, dividing x and z respectively to obtain a plurality of corresponding regions I, so that the two images are in a linear mapping relationship based on the region I; S31, respectively obtaining a 7*7 region I from x and z to obtain a comparison interval, obtaining a mapping relationship between the comparison intervals through a linear mapping function, and saving the mapping relationship in a mapping matrix; S32, select the next region I in x with a step size of 1, and repeat S31 until all regions I are traversed; S33, based on the size ratio of x to X, select region II from X that has a ratio corresponding to region I, apply the corresponding mapping relationship in the mapping relationship matrix, and calculate the pixel value of the region corresponding to region II in Z; S34, select the next region II in X with a step size of 1, and repeat S33 until all regions I are traversed; Among them, in S33-S34, if there are multiple regional pixel values for the same area II, after obtaining all the regional pixel values of the same area II position, all the regional pixel values are added together, the proportion of each regional pixel value is calculated, and the proportion value is used as the proportional coefficient for the addition of each regional pixel value to obtain a unique value corresponding to a single area II position.
