A Transformer-based image color enhancement method

By using a Transformer encoder and a self-attention mechanism, the problem of insufficient utilization of global information in existing color enhancement methods is solved, achieving efficient image color enhancement and improving the model's generalization ability and computational efficiency.

CN116258640BActive Publication Date: 2026-03-13WUHAN TEXTILE UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-06
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing color enhancement methods based on convolutional neural networks cannot effectively utilize global image information, resulting in insufficient model generalization ability and difficulty in achieving high-quality automatic image color retouching.

Method used

A Transformer encoder is used to construct image feature representations, a self-attention mechanism is used to calculate the dependencies between global content in the image, a shallow neural network is used to estimate the global color transformation matrix, and a multinomial extension is combined to achieve image color enhancement.

Benefits of technology

It improves the model's global receptive field and generalization ability, reduces model complexity, and enhances the effect of image color enhancement and computational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116258640B_ABST
    Figure CN116258640B_ABST
Patent Text Reader

Abstract

This invention discloses an image color enhancement method based on Transformer. First, images of natural scenes are captured using a camera, and professional image editors are invited to retouch the colors, constructing a labeled image dataset. Then, an image color enhancement depth model based on Transformer is trained using images from this dataset to estimate the image color transformation matrix. Finally, the image is input into the color enhancement model to obtain the image's color transformation matrix, and the product of this matrix and the polynomial expansion result of the image is used as the color enhancement result. This invention utilizes the global attention mechanism of Transformer to avoid the constraints caused by the local inference bias of convolutional models, improving the model's expressive power and thus training a color enhancement model with stronger generalization ability. Objective and subjective comparisons were conducted with other methods on internationally recognized datasets, and the results show that this method achieves superior color enhancement effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of digital image processing technology, computer vision and image enhancement, and specifically relates to an image color enhancement method based on Transformer. Background Technology

[0002] The widespread use of digital cameras and smartphones has greatly facilitated photography. However, due to a lack of high-end photography equipment and professional shooting skills, ordinary consumers often struggle to eliminate the negative effects of the environment when taking photos, resulting in images that fail to achieve the desired color reproduction. Although image editing software such as Photoshop and Lightroom offer a wealth of image color retouching tools, manual retouching requires users to possess certain editing skills, hindering its widespread application. To address these issues, image color enhancement technology aims to automatically refine image colors and improve the aesthetic quality of images.

[0003] Given the high complexity and subjectivity of color enhancement, existing technologies primarily employ a data-driven approach to construct color enhancement models, with current mainstream methods based on convolutional neural networks (CNNs). Specifically, existing methods mainly utilize CNNs to extract latent feature representations of an image layer by layer through local sliding windows. Then, a decoder is used to reconstruct the color-enhanced image from these features, or to regress an image-specific transformation function from these feature representations to enhance the image's colors.

[0004] Convolutional neural networks inherently possess a locality-based inductive bias, assuming that data within local regions are correlated and constructing image feature representations solely through the aggregation of local content. However, this strong constraint prevents the model from considering global image information and reduces its flexibility in fitting large-scale data, thus limiting its generalization ability. Currently, neither the academic nor industrial communities, both domestically and internationally, have proposed effective solutions to address these inherent limitations of existing color enhancement methods. Summary of the Invention

[0005] To overcome the shortcomings of existing technologies, this invention proposes an image color enhancement method based on Transformer. Transformer is a deep architecture with a global receptive field, capable of constructing image feature representations based on the dependencies between global image content, thus helping to address the deficiencies of existing color enhancement methods. Specifically, this method uses a set of Transformer encoders to embed a sequence of local image patches deconstructed from the image into a feature space. Then, a neural network maps the feature sequence to a set of transformation parameters, and these parameters are weighted and fused into a global transformation matrix. Finally, the product of this matrix and the polynomial expansion result of the input image is used as the color enhancement result.

[0006] The technical solution of this invention is an image color enhancement method based on Transformer, specifically including the following steps:

[0007] Step 1: Collect images, perform manual annotation and preprocessing, create a color-enhanced dataset, and further divide it into training and test sets;

[0008] Step 2, train the Transformer-based color enhancement model using images from the training set, specifically including the following sub-steps:

[0009] Step 2.1: Perform uniform segmentation on the image to obtain primitives;

[0010] Step 2.2: Perform block embedding and position embedding on the graphic elements;

[0011] Step 2.3: Construct a Transformer encoder. The Transformer encoder includes four components: layer normalization, multi-head attention module, multilayer perceptron, and residual connection. The input is the primitives after component embedding and position embedding in Step 2.2.

[0012] Step 2.4: The features calculated by the Transformer encoder for each primitive will be input into a shallow neural network to estimate the color transformation matrix of each primitive, and the global color transformation matrix will be constructed by a linear combination of the transformation matrices of each primitive.

[0013] Step 2.5: After obtaining the global color transformation matrix, the input image is multinomially expanded in the channel dimension. The multinomially expanded image is then multiplied by the global color transformation matrix to obtain the color enhancement result of the image.

[0014] Step 2.6: Calculate the loss function and optimize the Transformer-based color enhancement model;

[0015] Step 3: After completing the training of the model, use the trained Transformer-based color enhancement model to enhance the colors of the images in the test set.

[0016] Furthermore, the preprocessing mentioned in step 1 refers to rendering the original RAW format image to the sRGB color space, downsampling it to a size of 256 by 256, and finally storing it as an 8-bit PNG format image.

[0017] Furthermore, in step 2.1, a 32x32 sliding window is used to slide across the image with a step size of 32, transforming the image into a serialized input matrix I with a length of 64 and a feature dimension of 1024.

[0018] Furthermore, the specific implementation method of step 2.2 is as follows;

[0019] The serialized input matrix I is embedded into a 768-dimensional feature space using a linear mapping matrix D of size 1024 x 768. Then, a learnable matrix S of the same size is superimposed on the embedding result as the embedding of the positional relationships of each primitive in the serialized input. The calculation method of the output result X of block embedding and position embedding can be formally expressed as follows:

[0020] X = I × D + S (1)

[0021] Furthermore, the specific processing procedure of the Transformer encoder in step 2.3 is as follows;

[0022] The result X obtained from block embedding and position embedding is then fed into a sequence containing 12 Transformer feature encoders to further transform the features of each primitive. The output Y of a Transformer encoder can be expressed as:

[0023]

[0024] For a given input X, the Transformer encoder first normalizes the input execution layer. Then, the multi-head attention module performs feature transformation in parallel using 12 self-attention threads. Within each self-attention thread, Z is transformed by three learnable linear transformations, mapping it to three 64-dimensional feature matrices: Q, K, and V. The weights are then calculated based on the product of the transposes of Q and K, and the row vectors of V are linearly combined to obtain the output of the self-attention mechanism. The above operation process can be represented as:

[0025]

[0026] Finally, the computation results of the 12 self-attention mechanism threads are concatenated along the feature dimension and transformed using a linear mapping to obtain the output of the 768-dimensional multi-head attention module.

[0027] The output of the multi-head attention module is combined with the encoder input X through residual connections. Then, layer normalization is performed again to standardize the features, and a multilayer perceptron is used to transform the features. In the multilayer perceptron, a hidden layer with 3072 neurons is set, and GELU is used as the non-linear function. The output layer has 768 neurons to ensure the consistency of feature dimensions. Finally, residual connections are used again to combine the output of the multi-head attention module with the output of the multilayer perceptron to obtain the feature operation result of the Transformer encoder.

[0028] Furthermore, in step 2.4, the hidden layer of the shallow neural network has 1000 neurons, using ReLUs as the nonlinear function. During the training phase, the output of the neurons in the hidden layer is discarded with a 50% probability to alleviate the overfitting problem. The output layer of the shallow neural network has 33 neurons, and the output is the color conversion parameter estimated based on the features of each primitive. The output of the shallow neural network is a 64x33 matrix, where 64 represents the number of primitives divided in step 2.1.

[0029] Then, a learnable 64-dimensional vector is used to linearly combine the color conversion parameters of each primitive into a 33-dimensional vector, which is then transformed into an 11x3 global color conversion matrix to adjust the global color of the image.

[0030] Furthermore, the formula for the polynomial extension in step 2.5 is as follows:

[0031] F(a) = [r, g, b, rg, rb, gb, r 2 ,g 2 ,b 2 [,rgb,1] (4)

[0032] Where 'a' represents a pixel in the input image with a value of [r, g, b], and r, g, b represent the red, green, and blue channels, respectively.

[0033] Furthermore, in step 2.6, L1 loss is used to measure the error between the model's output and the real images in the training set. The calculation method is as follows:

[0034]

[0035] Where H and W represent the height and width of the image, I co+ The image output by the model, i.e., the color enhancement result, I gtThis corresponds to the actual value.

[0036] Furthermore, the specific implementation method of step 3 is as follows;

[0037] Step 3.1, Input Image Preprocessing

[0038] The RAW format images in the test set are rendered to the sRGB color space, downsampled to 256 by 256, and finally stored as 8-bit PNG format images;

[0039] Step 3.2, Transformation Matrix Estimation

[0040] The preprocessed image is input into the trained model, which then estimates a global color transformation matrix based on the image content.

[0041] Step 3.3, Image Color Enhancement

[0042] After obtaining the global color transformation matrix, the original input image is polynomially expanded according to equation (4), and then multiplied with the global color transformation matrix to complete the image color enhancement.

[0043] Furthermore, step 4 is included, which uses mean squared error, mean angle difference, chromatic difference, peak signal-to-noise ratio, and structural similarity as error metrics to evaluate the model's performance on the test set.

[0044] Compared with the prior art, the beneficial effects of the present invention are:

[0045] 1. The Transformer encoder is used as the backbone network of this method. The self-attention mechanism in it is used to dynamically calculate the dependencies between global content of the image, so that the model has a global receptive field.

[0046] 2. This method enhances image color by applying a linear transformation to the polynomial expansion result of the original image, which avoids setting a decoder in the network structure, effectively reducing the complexity of the model and improving the computational efficiency of the model. Attached Figure Description

[0047] Figure 1 The following is the implementation process of the technical solution of the present invention;

[0048] Figure 2 A color enhancement model based on Transformer constructed according to an embodiment of the present invention;

[0049] Figure 3 This is a subjective comparison result between the present invention and other methods. Detailed Implementation

[0050] To more specifically and clearly demonstrate the technical solution of the present invention, the implementation of the present invention will be further described in detail below with reference to the accompanying drawings. Although the following embodiments involve many technical details related to the present invention, these details are only used to illustrate the principles of the present invention, and those skilled in the art can make appropriate adjustments and modifications as needed without departing from the spirit of the present invention. In addition, to avoid excessive complexity in the embodiments, the prior art used in the embodiments is not described in detail in the following content, but this does not prevent those skilled in the art from understanding the connotation of these technologies, and therefore will not affect the sufficiency of the disclosure of this specification.

[0051] The invention will be further described below with reference to the accompanying drawings.

[0052] Figure 1 This is a flowchart of this embodiment. According to this flowchart, the specific steps in this embodiment include:

[0053] 1. Image Acquisition and Preprocessing: Acquire images, perform manual annotation and preprocessing, and create a color-enhanced dataset. This includes the following steps:

[0054] (1.1) Image Acquisition

[0055] Images were captured in natural scenes, and professional retouchers were invited to use Light Room software to enhance the colors of the images to obtain realistic images. The dataset was then divided into training, validation, and test sets.

[0056] (1.2) Image Preprocessing

[0057] The original RAW format images in the test set and validation set are rendered to the sRGB color space, downsampled to 256 by 256, and finally stored as 8-bit PNG format images;

[0058] 2. Model Training: Using images from the training set to train the model. Figure 2 The color enhancement model based on Transformer was trained. Furthermore, it was combined with... Figure 2 The color enhancement model proposed in this invention mainly includes the following operations:

[0059] (2.1) Uniform image segmentation

[0060] Using a 32x32 sliding window with a step size of 32, a 256x256 image is transformed into a serialized input matrix I with a length of 64 and a feature dimension of 1024.

[0061] (2.2) Block embedding and position embedding

[0062] The serialized input matrix I is embedded into a 768-dimensional feature space using a linear mapping matrix D of size 1024 x 768. Then, a learnable matrix S of the same size (which can be optimized in step (2.6)) is superimposed on the embedding result as the embedding of the positional relationships of the primitives in the serialized input. The calculation method of the output X of block embedding and position embedding can be expressed as follows:

[0063] X = I × D + S (1)

[0064] (2.3) Transformer encoder sequence

[0065] The result X obtained from block embedding and position embedding is then fed into a sequence containing 12 Transformer feature encoders to further transform the features of each primitive. Each Transformer encoder includes four components: Layer Normalization (LN), Multi-head Attention (MHA), Multi-layer Perceptron (MLP), and residual connections. The output Y of a Transformer encoder can be expressed as:

[0066]

[0067] In this example, for a given input X, the Transformer encoder first normalizes the input execution layer, and then the multi-head attention module performs feature transformation in parallel using 12 self-attention threads. Within each self-attention thread, Z is mapped to three feature-dimension 64 matrices by three learnable linear transformations: Q, K, and V. Weights are then calculated based on the product of the transposes of Q and K, and the row vectors of V are linearly combined to obtain the output of the self-attention mechanism. The above operation process can be represented as:

[0068]

[0069] Finally, the computation results of the 12 self-attention mechanism threads are concatenated along the feature dimension and transformed using a linear mapping to obtain the output of the 768-dimensional multi-head attention module.

[0070] The output of the multi-head attention module is combined with the encoder input X via residual connections. Then, layer normalization is performed again to standardize the features, and a multilayer perceptron is used for feature transformation. The multilayer perceptron includes a hidden layer with 3072 neurons and uses GELU as the non-linear function; the output layer has 768 neurons to ensure consistency in feature dimensions. Finally, residual connections are used again to combine the output of the multi-head attention module with the output of the multilayer perceptron to obtain the feature computation result of the Transformer encoder.

[0071] (2.4) Transformation Matrix Estimation

[0072] The features calculated by the Transformer encoder sequence for each primitive will be input into a shallow neural network to estimate the color transformation matrix of each primitive, and the global color transformation matrix will be constructed by linear combination of the transformation matrices of each primitive.

[0073] In this example, the hidden layer of the shallow neural network has 1000 neurons, using ReLUs as the non-linear function. During training, the outputs of the neurons in the hidden layer are dropped with a 50% probability to alleviate overfitting. The output layer of the neural network has 33 neurons, outputting color conversion parameters estimated based on the features of each primitive. Since the image is divided into 64 non-overlapping primitives in this example, the output of the shallow neural network is a 64x33 matrix.

[0074] If local color conversion is performed using the transformation matrix corresponding to each primitive in the image, obvious boundaries will appear between adjacent primitives in the converted image. To solve this problem, in this example, a learnable 64-dimensional vector (optimized through step (2.6)) is used to linearly combine the color conversion parameters of each primitive into a 33-dimensional vector, which is then transformed into an 11x3 global color conversion matrix to adjust the global color of the image.

[0075] (2.5) Image color enhancement

[0076] After obtaining the global color transformation matrix, the input image is polynomially expanded in the channel dimension as follows:

[0077] F(a) = [r, g, b, rg, rb, gb, r 2 ,g 2 ,b 2 [,rgb,1] (4)

[0078] Here, 'a' represents a pixel in the input image with a value of [r, g, b]. Then, multiplying the polynomial-expanded image with the global color transformation matrix yields the color-enhanced image.

[0079] (2.6) Calculate the error and optimize the model

[0080] In this example, L1 loss is used to measure the error between the model's augmentation results and the real images in the training set. The calculation method is as follows:

[0081]

[0082] Where H and W represent the height and width of the image, I co+ The image output by the model, i.e., the color enhancement result, I gt This corresponds to the actual value.

[0083] Gradient descent and backpropagation are used to optimize the model parameters based on the error calculated by the loss function until the model fits the data in the training set. The model's generalization ability is measured by the overall error of the trained model on the validation set, and the model with the smallest error on the validation set is taken as the training result.

[0084] 3. Image Color Enhancement: After training the model, a Transformer-based color enhancement model is used to enhance the colors of images in the test set. This includes the following steps:

[0085] (3.1) Input Image Preprocessing

[0086] The RAW format images in the test set are rendered to the sRGB color space, downsampled to 256 by 256, and finally stored as 8-bit PNG format images;

[0087] (3.2) Estimation of the transformation matrix

[0088] The preprocessed image is input into the trained model, which then estimates a global color transformation matrix based on the image content.

[0089] (3.3) Image color enhancement

[0090] After obtaining the global color transformation matrix, the original input image is polynomially expanded according to equation (4), and then multiplied with the global color transformation matrix to complete the image color enhancement.

[0091] In this embodiment, mean square error (MSE), mean angle error (MAE, in degrees), and color difference (ΔE) are used respectively. 00Peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) were used as error metrics to evaluate the performance of this invention on a test set and compared with existing methods. The quantitative comparison results are shown in Table 1, and the subjective comparison results are shown in... Figure 3 Inside, the top left corner of each image displays the color difference between the correction result and the true value.

[0092] Table 1. Quantitative comparison of the present invention with seven existing methods.

[0093] method MSE↓ MAE↓ <![CDATA[ΔE 00 ↓]]> PSNR↑ SSIM↑ Auto Levels 1521.5 9.16° 13.01 18.55 0.81 Auto Color 1691 9.71° 13.72 17.97 0.79 Pix2Pix 576.3 7.85° 8.9 22.3 0.86 CycleGAN 836.7 8.73° 10.07 20.94 0.82 ToneMapping 513 6.96° 7.81 23.3 <![CDATA[ 0.9 ]]> UEGAN 691.8 9.01° 9.56 21.65 0.85 DeepLPF 812.82 9.76° 11.53 20.32 0.82 This method <![CDATA[ 505.7 ]]> <![CDATA[ 6.7° ]]> <![CDATA[ 7.8 ]]> <![CDATA[ 23.32 ]]> <![CDATA[ 0.9 ]]>

[0094] In Table 1, “Auto Levels” and “Auto Color” are color enhancement methods provided by Photoshop software, while “Pix2Pix”, “CycleGAN”, “ToneMapping”, “UEGAN” and “DeepLPF” are the methods proposed in references [1] to [5], respectively.

[0095] [1]PI,JZ,TZ,et al.Image-to-Image Translation with ConditionalAdversarial Networks[A].In:2017 IEEE Conference on Computer Vision andPattern Recognition(CVPR),2017[C].21-26July 2017:5967-5976.

[0096] [2]JZ,TP,PI,et al.Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks[A].In:2017IEEE International Conference onComputer Vision(ICCV),2017[C].22-29Oct.2017:2242-2251.

[0097] [3]SB, CC, FP, et al.Content-Preserving Tone Adjustment for ImageEnhancement[A].In:2019IEEE / CVF Conference on Computer Vision and PatternRecognition Workshops(CVPRW),2019[C].16-17June 2019:1936-1943.

[0098] [4]Ni Z,Yang W,Wang S,et al.Towards Unsupervised Deep ImageEnhancement With Generative Adversarial Network[J].IEEE TRANSACTIONS ON IMAGEPROCESSING,2020,29:9140-9151.

[0099] [5]SM,PM,SM,et al.DeepLPF:Deep Local Parametric Filters for ImageEnhancement[A].In:2020IEEE / CVF Conference on Computer Vision and PatternRecognition(CVPR),2020[C].13-19June 2020:12823-12832.

[0100] Table 1 and Figure 3 The results show that the method of the present invention exhibits superior performance compared with existing methods in both quantitative and subjective comparisons.

[0101] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

Claims

1. An image color enhancement method based on Transformer, characterized in that, Includes the following steps: Step 1: Collect images, perform manual annotation and preprocessing, create a color-enhanced dataset, and further divide it into training and test sets; Step 2, train the Transformer-based color enhancement model using images from the training set, specifically including the following sub-steps: Step 2.1: Perform uniform segmentation on the image to obtain primitives; Step 2.2: Perform block embedding and position embedding on the graphic elements; Step 2.3: Construct a Transformer encoder. The Transformer encoder includes four components: layer normalization, multi-head attention module, multilayer perceptron, and residual connection. The input is the primitives after component embedding and position embedding in Step 2.

2. Step 2.4: The features calculated by the Transformer encoder for each primitive will be input into a shallow neural network to estimate the color transformation matrix of each primitive, and the global color transformation matrix will be constructed by a linear combination of the transformation matrices of each primitive. Step 2.5: After obtaining the global color transformation matrix, the input image is multinomially expanded along the channel dimension. The multinomially expanded image is then multiplied by the global color transformation matrix to obtain the color enhancement result of the image. Step 2.6: Calculate the loss function and optimize the Transformer-based color enhancement model; Step 3: After completing the training of the model, use the trained Transformer-based color enhancement model to enhance the colors of the images in the test set.

2. The image color enhancement method based on Transformer as described in claim 1, characterized in that: The preprocessing mentioned in step 1 refers to rendering the original RAW format image to the sRGB color space, downsampling it to a size of 256 by 256, and finally storing it as an 8-bit PNG format image.

3. The image color enhancement method based on Transformer as described in claim 1, characterized in that: In step 2.1, a 32x32 sliding window is used to slide across the image with a step size of 32, transforming the image into a serialized input matrix I with a length of 64 and a feature dimension of 1024.

4. The image color enhancement method based on Transformer as described in claim 1, characterized in that: The specific implementation method of step 2.2 is as follows; The serialized input matrix I is embedded into a 768-dimensional feature space using a linear mapping matrix D of size 1024 x 768. Then, a learnable matrix S of the same size is superimposed on the embedding result as the embedding of the positional relationships of each primitive in the serialized input. The calculation method of the output result X of block embedding and position embedding can be formally expressed as follows: (1)。 5. The image color enhancement method based on Transformer as described in claim 1, characterized in that: The specific processing procedure of the Transformer encoder in step 2.3 is as follows; The result X obtained from block embedding and position embedding is then fed into a sequence containing 12 Transformer feature encoders to further transform the features of each primitive. Each Transformer encoder includes four components: layer normalization (LN), multi-head attention module (MHA), multilayer perceptron (MLP), and residual connections. The output Y of a Transformer encoder can be expressed as: (2); For a given input X, the Transformer encoder first normalizes the input execution layer. Then, the multi-head attention module performs feature transformation in parallel using 12 self-attention threads. Within each self-attention thread, Z is mapped to three feature-dimension 64 matrices by three learnable linear transformations: Q, K, and V. The weights are then calculated based on the product of the transposes of Q and K, and the row vectors of V are linearly combined to obtain the output of the self-attention mechanism. The above operation process can be represented as: (3); Finally, the computation results of the 12 self-attention mechanism threads are concatenated along the feature dimension and transformed using a linear mapping to obtain the output of the 768-dimensional multi-head attention module. The output of the multi-head attention module is combined with the encoder input X through residual connections. Then, layer normalization is performed again to standardize the features, and a multilayer perceptron is used to transform the features. In the multilayer perceptron, a hidden layer with 3072 neurons is set, and GELU is used as the non-linear function. The output layer has 768 neurons to ensure the consistency of feature dimensions. Finally, residual connections are used again to combine the output of the multi-head attention module with the output of the multilayer perceptron to obtain the feature operation result of the Transformer encoder.

6. The image color enhancement method based on Transformer as described in claim 1, characterized in that: In step 2.4, the hidden layer of the shallow neural network has 1000 neurons, using ReLUs as the non-linear function. During the training phase, the output of the neurons in the hidden layer is discarded with a 50% probability to alleviate the overfitting problem. The output layer of the shallow neural network has 33 neurons, and the output is the color conversion parameter estimated based on the features of each primitive. The output of the shallow neural network is a 64x33 matrix, where 64 represents the number of primitives divided in step 2.

1. Then, a learnable 64-dimensional vector is used to linearly combine the color conversion parameters of each primitive into a 33-dimensional vector, which is then transformed into an 11x3 global color conversion matrix to adjust the global color of the image.

7. The image color enhancement method based on Transformer as described in claim 1, characterized in that: The formula for the polynomial extension in step 2.5 is as follows; (4); in, This indicates that a value in the input image is... pixels, These represent the red, green, and blue channels, respectively.

8. The image color enhancement method based on Transformer as described in claim 1, characterized in that: Step 2.6 uses L1 loss to measure the error between the image output by the model and the real images in the training set. The calculation method is as follows: (5); in, and Indicates the height and width of the image. The image output by the model, i.e., the color enhancement result. This corresponds to the actual value.

9. The image color enhancement method based on Transformer as described in claim 7, characterized in that: The specific implementation method of step 3 is as follows; Step 3.1, Input Image Preprocessing The RAW format images in the test set are rendered to the sRGB color space, downsampled to 256 by 256, and finally stored as 8-bit PNG format images; Step 3.2, Transformation Matrix Estimation The preprocessed image is input into the trained model, which then estimates a global color transformation matrix based on the image's content. Step 3.3, Image Color Enhancement After obtaining the global color transformation matrix, the original input image is polynomially expanded according to equation (4), and then multiplied with the global color transformation matrix to complete the image color enhancement.

10. The image color enhancement method based on Transformer as described in claim 1, characterized in that: It also includes step 4, which uses mean squared error, mean angle difference, chromatic difference, peak signal-to-noise ratio and structural similarity as error metrics to evaluate the model's performance on the test set.