A spatial adaptive color correction method, system, storage medium, and device based on attention-guided global-local residual matrix fusion.

By employing a global-local residual matrix fusion method combined with an attention mechanism, the problem of image color correction in complex lighting scenarios in existing technologies has been solved, achieving efficient and interpretable color correction results. This method is applicable to ISP color correction in devices such as mobile phone cameras, digital cameras, automotive vision devices, and security cameras.

CN122312409APending Publication Date: 2026-06-30DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN UNIV OF TECH
Filing Date
2026-04-15
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing technologies for image color correction in complex lighting scenarios suffer from several problems: insufficient global mapping capability, lack of physical interpretability in end-to-end image regression, lack of explicit attention mechanism for local parameter prediction, and strong dependence on additional annotations.

Method used

An attention-guided global-local residual matrix fusion method is adopted. Through multi-scale feature extraction, global baseline matrix prediction and local residual matrix prediction, combined with a lightweight attention mechanism, a spatially adaptive color correction matrix field is constructed to achieve adaptive correction for complex scenes.

Benefits of technology

It improves color correction capabilities in complex scenarios, maintains physical interpretability, reduces reliance on additional annotations, and is suitable for deployment on mobile and embedded platforms, exhibiting good engineering usability and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122312409A_ABST
    Figure CN122312409A_ABST
Patent Text Reader

Abstract

This invention relates to a spatially adaptive color correction method, system, storage medium, and device based on attention-guided global-local residual matrix fusion, belonging to the fields of image processing, computer vision, and image signal processing (ISP). While maintaining the physically parameterized representation of color correction matrix (CCM), this invention introduces a lightweight attention mechanism and a global-local dual-branch architecture to achieve spatially adaptive correction of color deviations in complex scenes, balancing color restoration accuracy, model interpretability, deployment feasibility, and operational efficiency. It addresses the problems of existing technologies, such as the inability of traditional global color correction to adapt to complex scenes, the lack of physical interpretability in end-to-end image regression, the difficulty of existing local parameter prediction methods in accurately focusing on key correction regions, and the reliance on additional annotations and large models in some solutions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of image processing, computer vision, and image signal processing (ISP), specifically relating to a spatial adaptive color correction method and system for complex lighting scenes. This method is particularly suitable for the ISP color correction stage in mobile phone cameras, digital cameras, automotive vision devices, security cameras, and other embedded imaging platforms, and is especially applicable to color restoration tasks in scenes with mixed lighting, local shadows, local color casts, and complex textures. Background Technology

[0002] Currently, common methods for image color correction mainly include the following categories: (1) Traditional global color correction methods: such as the least squares-based global color correction matrix (CCM) method, polynomial color correction method, and root polynomial color correction method. These methods usually solve a fixed global mapping matrix by calibrating the scene and apply it to the entire image to achieve the mapping from device-dependent RGB to the target color space. (2) End-to-end deep learning methods: such as methods based on U-Net, Pix2Pix, or other image-to-image regression networks, which directly learn the end-to-end mapping from the input image to the target image. These methods have strong nonlinear fitting capabilities, but usually regard color correction as a black-box image translation problem. (3) Physical parameter prediction methods: such as methods that predict local affine parameters, local CCM, or image adaptive 3D LUTs. These methods attempt to retain a certain degree of physical interpretability and achieve locally adaptive color mapping by outputting parameter fields or lookup tables through the network.

[0003] The main shortcomings of the existing technology are as follows: (1) Insufficient global mapping capability: The traditional global CCM method uses the same mapping method for the entire image. The matrix is ​​used for correction, and the default scene lighting is uniform and the color distribution is consistent. When there are mixed light sources, local shadows, high reflectivity areas or memory color areas such as blue sky, grass, and skin color in the scene, a single global matrix is ​​difficult to take into account both the overall comprehensive tone and the accuracy of local colors at the same time, and it is easy to have the phenomenon of "taking one thing and losing another". (2) The end-to-end method has weak interpretability: Although the end-to-end image regression method can improve the fitting ability in complex mapping scenes, it usually directly outputs the result image, which destroys the physical parameter form of the color correction module in the ISP. It is difficult to explain where and how the network performs color correction, and it is also not conducive to integration and debugging in the modular ISP system. (3) Local parameter prediction lacks explicit attention mechanism: Although the existing local parameter prediction method has a certain spatial adaptability, it usually relies on low-level features such as texture, brightness or color statistics, and lacks a mechanism to explicitly focus on the boundary of mixed lighting, local color bias areas and complex texture areas. Therefore, it is often insufficiently corrected in key areas, and may introduce unnecessary fluctuations in flat areas. (4) Some methods rely on additional annotations or complex models: Some existing methods require semantic segmentation results, region priors or larger-scale models to assist, resulting in high training costs, strong reliance on additional annotations, and difficulty in deployment on mobile devices, embedded devices or real-time ISP links. Summary of the Invention

[0004] This invention aims to provide a spatially adaptive color correction method and system based on attention-guided global-local residual matrix fusion, addressing issues such as the inability of traditional global color correction to adapt to complex scenes, the lack of physical interpretability in end-to-end image regression, the difficulty of existing local parameter prediction methods in accurately focusing on key correction regions, and the reliance on additional annotations and large models in some solutions. While maintaining the physically parameterized representation of CCM, this invention introduces a lightweight attention mechanism and a global-local dual-branch architecture to achieve spatially adaptive correction of color deviations in complex scenes, balancing color restoration accuracy, model interpretability, deployment feasibility, and operational efficiency.

[0005] The technical solution of the present invention: A spatially adaptive color correction method based on attention-guided global-local residual matrix fusion, such as Figure 1 As shown, the steps are as follows: Step S1: Image Acquisition and Preprocessing Obtain the original input image to be processed, which is a linear RGB image. Perform normalization processing on the original input image (and, if necessary, resize, crop, or tensor conversion after normalization) to obtain the preprocessed image. .

[0006] Furthermore, the original input image originates from the linear RGB data of the RAW image after pre-processing by the ISP (preferably in the color mapping stage after automatic white balance (AWB) and before Gamma correction in the ISP pipeline).

[0007] Furthermore, normalization normalizes the pixel values ​​to... The range is used to perform matrix-based color mapping later.

[0008] Step S2: Multi-scale feature extraction Combination Figure 2 The network structure shown inputs a preprocessed image to a feature extraction network to extract multi-scale color features for global and local modeling. The feature extraction network employs an encoder-decoder structure with multi-scale feature extraction capabilities, including: (1) Encoder submodule: The receptive field is gradually expanded through multi-level downsampling units, multi-scale feature representations of the input image are extracted step by step, and finally the bottleneck layer features are obtained. ; (2) Decoder submodule: Spatial resolution is gradually restored through multi-level upsampling units, and shallow local details and deep context features are fused together with the jump connection between the encoder submodule to obtain high-resolution decoding features; (3) Bottleneck layer feature output: provides high-level semantic and global statistical information for global matrix prediction; (4) High-resolution decoding feature output: provides local spatial structure and color detail information for local residual matrix prediction.

[0009] Furthermore, the encoder submodule consists of a 4-stage encoder and a bottleneck layer; preprocessed image First, the image passes through the residual convolution unit of encoder 1, while maintaining the spatial resolution of the input image. Without changing the input image, map the input image from 3 channels to... First coding feature Then, the first encoded feature After the encoder 2's max pooling and residual convolution combination unit, a 2x downsampling is performed, followed by feature extraction, resulting in a spatial resolution of [missing value]. Second coding feature with 64 channels Then, the second encoding feature After the max pooling and residual convolution combination unit of encoder 3, the spatial resolution is obtained as follows: The third coding feature with 128 channels Then, the third encoding feature After the max pooling and residual convolution combination unit of encoder 4, the spatial resolution is obtained as follows: The fourth coding feature with 256 channels Based on this, the fourth coding feature After further downsampling and residual convolution, the spatial resolution is obtained as follows: Bottleneck layer features with 256 channels It is used to characterize the deep global color context information of the input image.

[0010] Furthermore, the decoder submodule consists of four decoders; bottleneck layer features First, the bottleneck layer features are upsampled to the level of the upsampling and residual convolution combination unit of decoder 1. Then, combined with the fourth coding feature Feature fusion is performed through skip connections, and the resulting spatial resolution is obtained after residual convolution. The first decoding feature with 128 channels Then, the first decoding feature After the upsampling and residual convolution combination unit of decoder 2, it is first upsampled to Then, with the third coding feature By performing fusion through skip connections, a spatial resolution of [missing value] is obtained. The second decoding feature with 64 channels Then, the second decoding feature After the upsampling and residual convolution combination unit of decoder 3, it is first upsampled to Then, combined with the second coding feature By performing fusion through skip connections, a spatial resolution of [missing value] is obtained. The third decoding feature with 32 channels Finally, the third decoding feature After the upsampling and residual convolution combination unit of decoder 4, it is first upsampled to Then, combined with the first encoded feature By performing fusion through skip connections, a spatial resolution of [missing value] is obtained. High-resolution decoding features with 32 channels This is used to provide local spatial structure information and color detail information for subsequent local residual matrix prediction.

[0011] Furthermore, skip connections are respectively set between encoder 1 and decoder 4, between encoder 2 and decoder 3, between encoder 3 and decoder 2, and between encoder 4 and decoder 1. These connections are used to directly transmit the edge, texture, and color details preserved in the encoding stage to the corresponding decoding stage and fuse them with the upsampled high-level semantic features, thereby preserving local structural details and color information while restoring spatial resolution.

[0012] Step S3: Attention Enhancement and Bi-branch Matrix Prediction Combination Figures 2 to 4 As shown, the bottleneck layer features and high-resolution decoder features obtained in step S2 are input into the global branch and local branch, respectively.

[0013] S3-1: Global baseline matrix prediction like Figure 3 As shown, bottleneck layer features Global feature aggregation is performed, and a global baseline color correction matrix is ​​output through a mapping network (MLP). .

[0014] Furthermore, the global feature aggregation is implemented through average pooling (GAP), and the mapping network can be a fully connected mapping unit or other network structure capable of global parameter regression, with its output preferably reconstructed into a... The global reference color correction matrix is ​​used to characterize the overall tone and global color mapping trend of an image. Specifically, the parameters of the global reference color correction matrix are obtained. The specific process is represented as follows: in, Indicates average pooling; Represents a mapping network; S3-2: Attention Enhancement like Figure 4 As shown, for the high-resolution features of the decoder An attention enhancement module is introduced to obtain enhanced features. The attention enhancement module includes a feature recalibration mechanism in the channel dimension and a region enhancement mechanism in the spatial dimension. In a preferred embodiment, it can be implemented using a convolutional block attention enhancement module (CBAM). (1) Channel attention: used to adaptively weight different color-related feature channels to enhance the response to key color components; (2) Spatial attention: Used for adaptive weighting of different spatial locations to highlight key locations such as mixed lighting boundaries, local color shift areas, and complex texture areas. Further, channel attention is used to apply high-resolution features from the decoder... Global average pooling and global max pooling are input separately to obtain the corresponding channel description information. These are then processed by a shared mapping unit for feature mapping and fused, and an activation function is used to obtain the channel attention weight map. Finally, the channel attention weight map is compared with the decoder's high-resolution features. Element-wise multiplication is performed to output channel-enhanced features.

[0015] Furthermore, spatial attention involves inputting the channel enhancement features obtained from channel attention into channel average pooling and channel max pooling respectively, resulting in two spatial response maps. These two maps are then concatenated along the channel dimension and input into a convolutional unit, where an activation function is applied to obtain a spatial attention weight map. Subsequently, the spatial attention weight map is element-wise multiplied with the channel enhancement features to output the attention enhancement feature. .

[0016] S3-3: Local Residual Matrix Prediction Further integration Figure 4 Features that enhance attention Input parameter mapping unit, output local residual matrix coefficient diagram: in, Represents the parameter mapping unit; Furthermore, the parameter mapping unit is a convolutional mapping structure or other prediction structure suitable for outputting the parameters of the spatial variation matrix. The local residual matrix coefficient map is preferably a 9-channel feature map, with each pixel position corresponding to an expanded [variable / structured] coefficient map. The local residual matrix is ​​used to describe the spatial location-related compensation amount relative to the global reference matrix.

[0017] Step S4: Construction and Result Generation of Spatial Adaptive Matrix Field like Figure 3 and Figure 5 As shown, the global baseline color correction matrix is ​​transformed into a matrix form that matches the coefficient map of the local residual matrix in spatial dimension, and residual fusion is performed with the local residual matrix to construct a spatially adaptive color correction matrix field: Subsequently, as Figure 5 As shown, the pixel positions in the preprocessed image Perform pixel-wise matrix mapping on the color vector at that location: in, For the color-corrected image at pixel location The output color vector at that location.

[0018] This step enables the present invention to transform from a globally unified mapping to a locally spatial adaptive mapping while retaining the physical representation of CCM.

[0019] Step S5: Training Constraints and Model Optimization To simultaneously ensure color reconstruction accuracy and local matrix smoothness, this invention preferably uses the following combined loss function to train the network: Among them, reconstruction losses To constrain the difference between the output image and the supervised target image, it is preferable to use... Combination of loss and MSE loss; smoothing constraint loss Used to constrain the spatial smoothness of the local residual matrix coefficient map and suppress unreasonable high-frequency fluctuations between adjacent pixels. Represents the smoothing constraint loss The weighting coefficients are used to adjust the contribution ratio of the smoothing constraint loss to the total loss function, so as to balance the color reconstruction accuracy and the spatial smoothness of the local residual matrix coefficient map.

[0020] During training, this invention can utilize the Color Matrix or CCM metadata in the DNG file to construct the supervised target image without requiring additional pixel-level semantic annotation.

[0021] This invention also provides a spatial adaptive color correction system based on attention-guided global-local residual matrix fusion, comprising: (1) Image acquisition module: used to acquire the input image to be processed; (2) Preprocessing module: used to perform linear RGB normalization, resizing and tensor quantization on the input image; (3) Feature extraction module: used to extract multi-scale color features of the input image and output global features and high-resolution local features of the bottleneck layer; (4) Global matrix prediction module: used to predict the global baseline color correction matrix based on the bottleneck layer features; (5) Attention Enhancement Module: Used to perform channel attention and spatial attention enhancement on local features; (6) Local matrix prediction module: used to generate local residual matrix coefficient diagrams; (7) Matrix field construction module: used to fuse the global reference matrix and the local residual matrix to construct a spatial adaptive color correction matrix field; (8) Mapping output module: used to perform pixel-by-pixel matrix mapping on the input image using the matrix field, and output the color correction result image; The present invention can be further extended to an electronic device including a processor, a memory, and a computer program stored in the memory, wherein the computer program implements the above-described image color correction method when executed by the processor.

[0022] Compared with the prior art, the present invention has the following beneficial effects: (1) Improve color correction capabilities in complex scenes This invention uses a decomposition modeling method of "global reference matrix + local residual matrix" to enable color mapping to maintain overall color tone stability while adaptively correcting local mixed lighting, shadow boundaries, and local color bias areas.

[0023] (2) Preserve the physical interpretability of color correction This invention does not directly regress the final image, but predicts a color correction matrix field with clear physical meaning and performs pixel-by-pixel matrix mapping, which facilitates modular integration, parameter tuning, and anomaly analysis in the ISP pipeline.

[0024] (3) Reduce reliance on additional annotations and priors This invention learns key correction regions directly from image features through an attention enhancement mechanism, eliminating the need for additional semantic segmentation annotations or manual region priors, thus reducing data preparation costs.

[0025] (4) Balancing deployment efficiency and engineering availability This invention employs a lightweight network structure and a local matrix residual prediction method, making it suitable for deployment in mobile devices, embedded platforms, and real-time ISP scenarios, and possessing significant engineering implementation value.

[0026] 5. It possesses good robustness and generalization potential. This invention maintains a relatively stable color restoration effect under different lighting conditions, different scene content, and different device sources, and is suitable for image color correction tasks in complex real-world environments. Attached Figure Description

[0027] Figure 1 This is a flowchart of the overall method of the present invention, which corresponds to the steps of obtaining the input image, feature extraction, global baseline matrix prediction, attention enhancement, local residual matrix prediction, matrix field construction, and pixel-by-pixel matrix mapping output. Figure 2 This is a schematic diagram of the overall structure of the encoder-decoder dual-branch network of the present invention, showing the connection relationship between the encoder, decoder, bottleneck layer features, global matrix prediction branch, CBAM attention enhancement module and local residual matrix prediction branch; Figure 3 This is a schematic diagram of the collaborative work between global and local branches in this invention, illustrating the process of constructing a spatial adaptive color correction matrix field by global reference color correction matrix, local residual matrix coefficient diagram, spatial broadcasting expansion, and residual fusion. Figure 4 This is a schematic diagram of the CBAM attention enhancement module and the local residual matrix coefficient map generation process in this invention, illustrating the channel attention, spatial attention, convolutional mapping, and local residual matrix coefficient map output process; Figure 5 This is a schematic diagram of the spatial adaptive color correction matrix field and pixel-by-pixel matrix mapping process in this invention, showing the process of obtaining the target color vector and output image after performing matrix multiplication between the input color vector and the matrix field.

[0028] Figure 6This image shows a comparison of the performance of the method of this invention and the least squares CCM method in representative scenarios. From left to right, the image shows the input image, the output of the least squares CCM method, and the output of the present invention; the values ​​at the top represent PSNR, and the values ​​at the bottom represent... The results show that the method of the present invention can achieve higher PSNR and lower [unclear] in all representative examples. This demonstrates better overall color tone control and local color restoration capabilities.

[0029] Figure 7 This diagram illustrates the deployment effect of the method of the present invention in an ISP pipeline. From left to right, the diagram shows the visualization of the original DNG data, the de-mosaic result, the automatic white balance result, the color correction result of the present invention, and the display result after Gamma correction. This demonstrates that the method of the present invention can be deployed as an independent color correction module after automatic white balance and before Gamma correction, and can be well embedded in existing ISP pipelines. Detailed Implementation

[0030] Example 1: Standard Training and Validation Scenario The following is combined Figures 1 to 5 The specific embodiments of the present invention will be further described below. Taking spatial adaptive color correction based on an attention mechanism as an example, a dataset containing linear RGB input images and reference color correction information can be used as the training and validation data source. The input image can be obtained by de-mosaicing and automatic white balance processing of DNG RAW images, and the supervised target image and reference matrix can be constructed from the Color Matrix or CCM information in the DNG metadata.

[0031] 1. Pretreatment process The input image is normalized to the [0,1] interval, and its size is adjusted according to training or inference requirements.

[0032] 2. Network Structure Configuration like Figure 2 As shown, an encoder-decoder backbone network is used to extract multi-scale features; like Figure 3 As shown, the bottleneck layer features are input into the global matrix prediction branch, and the global matrix parameters are output through global feature aggregation and parameter mapping. like Figure 4 As shown, the decoder inputs high-resolution features into the attention enhancement module, and performs feature enhancement in the channel dimension and spatial dimension in sequence; Further as Figure 4 As shown, the local branch outputs the coefficient map of the local residual matrix through the parameter mapping unit.

[0033] 3. Matrix Field Construction and Output like Figure 3 As shown, the global baseline matrix is ​​reconstructed as follows: The matrix is ​​expanded to the same spatial size as the local coefficient map, and then added pixel-by-pixel to the local residual matrix to obtain the spatial adaptive matrix field; like Figure 5 As shown, matrix multiplication is finally performed pixel by pixel on the input image to output the color-corrected image.

[0034] 4. Training Strategies During the training phase, a combination of reconstruction constraints, smoothing constraints, and global matrix constraints is preferred to jointly optimize the network parameters, thereby simultaneously constraining color reconstruction accuracy, local matrix field smoothness, and global matrix stability.

[0035] 5. Experimental Results In standard training and validation scenarios, supervised targets are constructed using MIT-Adobe FiveK DNG metadata for training and testing. The method of this invention achieves a PSNR of 52.19 dB and a resolution of 0.4943 on the overall test set. With an SSIM of 0.9983, the model has approximately 4.5M parameters; under 2K resolution image input conditions, the processing time for a single image is approximately 22 ms. Figure 6 As shown, in representative scenes such as portraits, vegetation, flowers, and complex textures, the output results of this invention exhibit higher PSNR and lower latency compared to the least squares CCM method. This demonstrates that while maintaining overall color tone stability, the present invention can more effectively improve the color restoration accuracy of complex local areas.

[0036] Example 2: Ablation Comparison Scenario To verify the synergistic effect of global branching, local branching, and the attention mechanism in this invention, variant models were constructed and compared, retaining only global branches, retaining only local branches, and retaining both global and local branches but without introducing an attention module. Experimental results show that when only global branches are retained, the model's PSNR is 44.42 dB. The PSNR was 0.6026 and the SSIM was 0.9988; when only local branches were retained, the model's PSNR was 45.15 dB. The PSNR was 0.7659 and the SSIM was 0.9979. When retaining the global and local branches but without introducing an attention module, the model's PSNR was 47.69 dB, ΔE00 was 0.5427, and SSIM was 0.9991. With the complete model including global branches, local branches, and an attention module, the PSNR increased to 52.19 dB. The color accuracy decreased to 0.4943, and the SSIM was 0.9983. This demonstrates that the "global tone setting + local adjustment + attention focusing" strategy proposed in this invention can simultaneously improve overall tone stability, local color correction capabilities, and comprehensive color difference control, exhibiting clear technical advantages.

[0037] Example 3: ISP Pipeline Deployment Scenario like Figure 7 As shown, the method of the present invention can be deployed as an independent color correction module in the ISP link after automatic white balance and before Gamma correction.

[0038] In this implementation, the input source for the entire ISP link is raw DNG data. The raw DNG data is first processed to obtain a linear RGB image through de-mosaicing, and then processed by automatic white balance before being used as input to the color correction module of this invention. After processing by the method of this invention, a corrected linear RGB image is obtained. Subsequently, this corrected linear RGB image can be further input into the Gamma, sharpening, noise reduction, or display mapping modules to obtain the final display result image.

[0039] Figure 7 The example image demonstrates the phased processing effect from the visualization of raw DNG data, the demosaic result, the automatic white balance result, to the color correction result of the present invention and the subsequent display result after Gamma correction, illustrating that the present invention can be well embedded into existing ISP pipelines.

[0040] Because the present invention constructs a spatially adaptive color mapping matrix field with physical meaning internally, it can not only output a corrected linear RGB image, but also facilitate interface docking with front-end and back-end ISP modules, and facilitate engineering debugging, parameter analysis and local anomaly localization, thus having good practical application value.

[0041] Example 4: Cross-sensor generalization scenario After training, the model of this invention can be directly applied to inference on different public datasets or data from different camera sources that were not used in the training, in order to verify its cross-sensor generalization ability. Specifically, three public datasets, Gehler, NUS 8-Camera, and SimpleCube, were selected as test objects. Inference was performed on each dataset without retraining the model, and the output results were analyzed using no-reference image quality statistical indicators, including color richness, contrast, average saturation, and entropy.

[0042] Experimental results show that the color richness, contrast, average saturation, and information entropy of this invention are 7.42, 14.71, 104.17, and 4.48 on the Gehler dataset, respectively; 18.33, 27.84, 121.04, and 5.65 on the NUS dataset; and 10.95, 25.53, 67.97, and 5.15 on the SimpleCube dataset. These results demonstrate that this invention maintains relatively stable color restoration performance under different sensor responses and scene content, especially exhibiting good statistical characteristics in the NUS dataset which includes multiple camera sources, indicating that this invention possesses good cross-device adaptability and practical application potential.

Claims

1. A spatial adaptive color correction method based on attention-guided global-local residual matrix fusion, characterized in that, The steps are as follows: Step S1: Image Acquisition and Preprocessing An original input image to be processed is acquired, and the original input image is a linear RGB image; the original input image is normalized to obtain a preprocessed image ; Step S2: Multi-scale feature extraction The preprocessed image is input into a feature extraction network to extract multi-scale color features for global and local modeling. The feature extraction network adopts an encoder-decoder structure with multi-scale feature extraction capabilities, including: (1) Encoder sub-module: gradually expand the receptive field through multi-level downsampling units, extract multi-scale feature representation of the input image step by step, and finally obtain the bottleneck layer feature ; (2) Decoder submodule: Spatial resolution is gradually restored through multi-level upsampling units, and shallow local details and deep context features are fused together with the jump connection between the encoder submodule to obtain high-resolution decoding features; (3) Bottleneck layer feature output: provides high-level semantic and global statistical information for global matrix prediction; (4) High-resolution decoding feature output: provides local spatial structure and color detail information for local residual matrix prediction; Step S3: Attention Enhancement and Bi-branch Matrix Prediction Input the bottleneck layer features and high-resolution decoder features obtained in step S2 into the global branch and local branch, respectively; S3-1: Global baseline matrix prediction Bottleneck layer features Global feature aggregation is performed and a global reference color correction matrix is output by a mapping network MLP ; S3-2: Attention Enhancement High resolution features for decoder An attention enhancement module is introduced to obtain enhanced features The attention enhancement module includes a channel dimension feature re-labeling mechanism and a spatial dimension region enhancement mechanism CBAM: S3-3: Local Residual Matrix Prediction Attention enhanced features input parameter mapping unit, outputting a local residual matrix coefficient map; Step S4: Construction and Result Generation of Spatial Adaptive Matrix Field The global reference color correction matrix is converted into a matrix form matching the local residual matrix coefficient map in spatial dimensions, and residual fusion is performed with the local residual matrix to construct a spatial adaptive color correction matrix field; subsequently, a pixel-by-pixel matrix mapping is performed on the color vector at the pixel position of the preprocessed image; Step S5: Training constraints and model optimization.

2. The spatial adaptive color correction method based on attention-guided global-local residual matrix fusion according to claim 1, characterized in that, In step S1, the original input image is derived from the linear RGB data of a RAW image after pre-processing by an ISP. Normalization is a process of normalizing pixel values to an interval.

3. The spatial adaptive color correction method based on attention-guided global-local residual matrix fusion according to claim 2, characterized in that, In step S2, the encoder submodule consists of a 4-stage encoder and a bottleneck layer; preprocessing the image. First, the image passes through the residual convolution unit of encoder 1, while maintaining the spatial resolution of the input image. Without changing the input image, map the input image from 3 channels to... First coding feature Then, the first encoded feature After the encoder 2's max pooling and residual convolution combination unit, a 2x downsampling is performed, followed by feature extraction, resulting in a spatial resolution of [missing value]. Second coding feature with 64 channels Then, the second encoding feature After the max pooling and residual convolution combination unit of encoder 3, the spatial resolution is obtained as follows: The third coding feature with 128 channels Then, the third encoding feature After the max pooling and residual convolution combination unit of encoder 4, the spatial resolution is obtained as follows: The fourth coding feature with 256 channels Based on this, the fourth coding feature After further downsampling and residual convolution, the spatial resolution is obtained as follows: Bottleneck layer features with 256 channels It is used to characterize the deep global color context information of the input image; The decoder submodule consists of four decoders; bottleneck layer features First, the bottleneck layer features are upsampled to the level of the upsampling and residual convolution combination unit of decoder 1. Then, combined with the fourth coding feature Feature fusion is performed through skip connections, and the resulting spatial resolution is obtained after residual convolution. The first decoding feature with 128 channels Then, the first decoding feature After the upsampling and residual convolution combination unit of decoder 2, it is first upsampled to Then, with the third coding feature By performing fusion through skip connections, a spatial resolution of [missing value] is obtained. The second decoding feature with 64 channels Then, the second decoding feature After the upsampling and residual convolution combination unit of decoder 3, it is first upsampled to Then, combined with the second coding feature By performing fusion through skip connections, a spatial resolution of [missing value] is obtained. The third decoding feature with 32 channels Finally, the third decoding feature After the upsampling and residual convolution combination unit of decoder 4, it is first upsampled to Then, combined with the first encoded feature By performing fusion through skip connections, a spatial resolution of [missing value] is obtained. High-resolution decoding features with 32 channels This is used to provide local spatial structure information and color detail information for subsequent local residual matrix prediction; Skip connections are set between encoder 1 and decoder 4, between encoder 2 and decoder 3, between encoder 3 and decoder 2, and between encoder 4 and decoder 1, respectively. These connections are used to directly transmit the edge, texture, and color details preserved in the encoding stage to the corresponding decoding stage and fuse them with the upsampled high-level semantic features, thereby preserving local structural details and color information while restoring spatial resolution.

4. The spatial adaptive color correction method based on attention-guided global-local residual matrix fusion according to claim 3, characterized in that, In step S3-1, the global feature aggregation is achieved through average pooling (GAP), and the mapping network can be a fully connected mapping unit or other network structure capable of global parameter regression; the global baseline color correction matrix is ​​used to characterize the overall hue and global color mapping trend of the image. Specifically, obtain the global baseline color correction matrix parameters. The specific process is represented as follows: in, Indicates average pooling; Represents a mapping network; In step S3-2: (1) Channel attention: used to adaptively weight different color-related feature channels to enhance the response to key color components; (2) Spatial attention: used to adaptively weight different spatial locations to highlight key locations such as mixed illumination boundaries, local color shift areas, and complex texture areas; further, channel attention is used to apply high-resolution features of the decoder. Global average pooling and global max pooling are input separately to obtain the corresponding channel description information. These are then processed by a shared mapping unit for feature mapping and fused, and an activation function is used to obtain the channel attention weight map. Finally, the channel attention weight map is compared with the decoder's high-resolution features. Perform element-wise multiplication to output channel-enhanced features; Spatial attention involves inputting the channel enhancement features obtained from channel attention into channel average pooling and channel max pooling respectively, resulting in two spatial response maps. These two maps are then concatenated along the channel dimension and input into a convolutional unit, where an activation function is applied to obtain a spatial attention weight map. Subsequently, the spatial attention weight map is element-wise multiplied with the channel enhancement features to output the attention enhancement feature. ; In step S3-3, the local residual matrix coefficient diagram is as follows: in, Represents the parameter mapping unit; The parameter mapping unit is a convolutional mapping structure or other prediction structure suitable for outputting spatial variation matrix parameters.

5. The spatial adaptive color correction method based on attention-guided global-local residual matrix fusion according to claim 4, characterized in that, In step S4, the spatial adaptive color correction matrix field is: Pixel positions in the preprocessed image Perform pixel-wise matrix mapping on the color vector at that location: in, For the color-corrected image at pixel location The output color vector at that location.

6. The spatial adaptive color correction method based on attention-guided global-local residual matrix fusion according to claim 5, characterized in that, In step S5, the network is trained using the following combined loss function: Among them, reconstruction losses To constrain the difference between the output image and the supervised target image, it is preferable to use... Combination of loss and MSE loss; smoothing constraint loss Used to constrain the spatial smoothness of the local residual matrix coefficient map and suppress unreasonable high-frequency fluctuations between adjacent pixels. Represents the smoothing constraint loss The weighting coefficients are used to adjust the contribution ratio of the smoothing constraint loss to the total loss function, so as to balance the color reconstruction accuracy and the spatial smoothness of the local residual matrix coefficient map.

7. A spatial adaptive color correction system based on attention-guided global-local residual matrix fusion, characterized in that, To implement the method of any one of claims 1-6, comprising: (1) Image acquisition module: used to acquire the input image to be processed; (2) Preprocessing module: used to perform linear RGB normalization, resizing and tensor quantization on the input image; (3) Feature extraction module: used to extract multi-scale color features of the input image and output global features and high-resolution local features of the bottleneck layer; (4) Global matrix prediction module: used to predict the global baseline color correction matrix based on the bottleneck layer features; (5) Attention Enhancement Module: Used to perform channel attention and spatial attention enhancement on local features; (6) Local matrix prediction module: used to generate local residual matrix coefficient diagrams; (7) Matrix field construction module: used to fuse the global reference matrix and the local residual matrix to construct a spatial adaptive color correction matrix field; (8) Mapping output module: used to perform pixel-by-pixel matrix mapping on the input image using the matrix field and output the color correction result image.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 6.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 6.