Image processing model training method, image processing method and device

By combining a dynamic routing model and an image quality assessment sub-model, the problem of insufficient scene adaptation in existing image retouching techniques is solved, enabling accurate image retouching for images in different scenes and improving the adaptability and artistic fidelity of the retouching effect.

CN121837053APending Publication Date: 2026-04-10VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-19
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing image editing technologies fail to effectively capture the discreteness of image editing strategies and dynamic scene adaptation, resulting in image editing effects that deviate from user expectations, especially when processing images in different scenes, leading to color shifts and detail distortion.

Method used

A dynamic routing model is used to dynamically select the appropriate image retouching sub-model, and an image quality assessment sub-model is used to update the evaluation loss, thereby constructing an image processing model to improve the adaptability and accuracy to diverse image content.

Benefits of technology

It significantly improves the adaptability of image processing models to different scenes, avoids the edited images from deviating from user expectations in terms of color tone and artistic style, and provides more accurate image editing results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121837053A_ABST
    Figure CN121837053A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing model training method and device and an image processing method and device.An image processing model comprises a dynamic routing sub-model, M image retouching sub-models and an image quality evaluation sub-model. Inputting the preprocessed image into a dynamic routing sub-model to determine N candidate retouching sub-models, and obtaining a retouching image of each candidate retouching sub-model based on the preprocessed image and the N candidate retouching sub-models; inputting the pre-processed image, the target image and the N retouching images into an image quality evaluation sub-model to obtain an evaluation result of each retouching image and an evaluation result of the target image; and calculating evaluation loss based on the evaluation result of each retouching image and the evaluation result of the target image, and updating parameters of the image quality evaluation sub-model based on the evaluation loss.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of image processing, and particularly relates to an image processing model training method, an image processing method and device. BACKGROUND

[0002] Image automatic retouching is a key technology in the field of digital image processing, aiming to simulate the decision logic of professional retouchers through algorithms to automatically optimize visual attributes such as exposure, contrast, color distribution, and to improve the visual quality and artistic expression of images. This technology has important application value in photography post-processing, advertising design, film and television production, etc.

[0003] Professional retouchers will adopt discrete retouching strategies based on image content features (such as brightness, color composition, semantic information) when processing different scene images, for example: optimizing skin color softness and brightness balance for portrait scenes, and enhancing dynamic range and color saturation for landscape scenes. Such strategies have significant discreteness (different strategies correspond to independent parameter adjustment modes) and context dependence (strategy selection is highly dependent on image content). Existing methods treat retouching as a continuous end-to-end mapping process, ignoring the discrete nature of strategies, resulting in retouched images deviating from user expectations in terms of color tone, artistic style, etc. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide an image processing model training method, an image processing method and device, which can solve the problem of deviation of existing retouched image effects from user expectations.

[0005] In a first aspect, the embodiments of the present application provide an image processing model training method, the image processing model comprising a dynamic routing sub-model, M retouching sub-models and an image quality evaluation sub-model, the method comprising: obtaining a plurality of image sample subsets, the image sample subset comprising a plurality of image sample pairs, the image sample pair comprising a preprocessed image and a target image; for any image sample pair in any of the image sample subsets, inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, and based on the preprocessed image and the N candidate retouching sub-models, obtaining a retouched image corresponding to each candidate retouching sub-model; inputting the preprocessed image, the target image and the N retouched images corresponding to the preprocessed image into the image quality evaluation sub-model to obtain evaluation results of each retouched image corresponding to the preprocessed image and evaluation results of the target image; based on the evaluation results of the respective retouched images and the evaluation result corresponding to the target image, calculate an evaluation loss, and update parameters of the image quality evaluation submodel based on the evaluation loss to obtain a trained image quality evaluation submodel; wherein M>N, and M and N are positive integers.

[0006] In a second aspect, the embodiments of the present application provide an image processing method, comprising: inputting a multi-color space feature of a to-be-processed image into a dynamic routing submodel of the image processing model to determine Q candidate retouch submodels from P retouch submodels of the image processing model; wherein P>Q, and P and Q are positive integers; inputting the to-be-processed image into the Q candidate retouch submodels respectively to obtain a retouched image corresponding to each candidate retouch submodel; inputting the to-be-processed image and the Q retouched images into an image quality evaluation submodel of the image processing model for retouch evaluation to determine a target retouched image from the Q retouched images.

[0007] In a third aspect, the embodiments of the present application provide an image processing model training device, the image processing model comprising a dynamic routing submodel, M retouch submodels and an image quality evaluation submodel, the device comprising: an acquisition module configured to acquire a plurality of image sample subsets, wherein each image sample subset comprises a plurality of image sample pairs, and each image sample pair comprises a pre-processed image and a target image; a processing module configured to, for any image sample pair in any image sample subset, input the pre-processed image into the dynamic routing submodel to determine N candidate retouch submodels from the M retouch submodels, and based on the pre-processed image and the N candidate retouch submodels, obtain a retouched image corresponding to each candidate retouch submodel; an evaluation module configured to input the pre-processed image, the target image and N retouched images corresponding to the pre-processed image into the image quality evaluation submodel to obtain an evaluation result of each retouched image corresponding to the pre-processed image and an evaluation result corresponding to the target image; a parameter updating module configured to, based on the evaluation results of the respective retouched images and the evaluation result corresponding to the target image, calculate an evaluation loss, and update parameters of the image quality evaluation submodel based on the evaluation loss to obtain a trained image quality evaluation submodel; wherein M>N, and M and N are positive integers.

[0008] In a fourth aspect, the embodiments of the present application provide an image processing device, comprising: determining a multi-color space feature of the image to be processed into a dynamic routing submodel of the trained image processing model to determine Q candidate retouching submodels from P retouching submodels of the image processing model; wherein P ≥ Q, and P and Q are positive integers; a retouching module configured to input the image to be processed into the Q candidate retouching submodels to obtain a retouched image corresponding to each candidate retouching submodel; The determining module is further configured to input the image to be processed and the Q retouched images into an image quality evaluation submodel of the image processing model to perform retouching evaluation and determine a target retouched image from the Q retouched images.

[0009] In a fifth aspect, an electronic device is provided, which includes a processor and a memory. The memory stores programs or instructions executable on the processor. When the programs or instructions are executed by the processor, the steps of the method according to the first aspect or the second aspect are implemented.

[0010] In a sixth aspect, a readable storage medium is provided, which stores programs or instructions. When the programs or instructions are executed by a processor, the steps of the method according to the first aspect or the second aspect are implemented.

[0011] In a seventh aspect, a chip is provided, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to execute programs or instructions to implement the method according to the first aspect or the second aspect.

[0012] In an eighth aspect, a computer program product is provided, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the method according to the first aspect or the second aspect.

[0013] In the embodiments of the present application, a plurality of image sample subsets are first obtained. An image sample subset includes a plurality of image sample pairs. An image sample pair includes a preprocessed image and a target image. For any image sample pair in any image sample subset, the preprocessed image is input into a dynamic routing submodel to determine N candidate retouching submodels from M retouching submodels. Based on the preprocessed image and the N candidate retouching submodels, a retouched image corresponding to each candidate retouching submodel is obtained. Through the dynamic routing model, candidate image processing models can be dynamically selected for images of different scenes such as portraits and landscapes, significantly improving the adaptability to diversified image content.

[0014] Furthermore, the preprocessed image, the target image, and N corresponding retouched images are input into the image quality assessment sub-model to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results of the target image. Based on the evaluation results of each retouched image and the evaluation results of the target image, the evaluation loss is calculated, and the parameters of the image quality assessment sub-model are updated based on the evaluation loss to obtain the trained image quality assessment sub-model. The image quality assessment model dynamically evaluates the evaluation loss between the evaluation results of each retouched image and the evaluation results of the target image, and updates the parameters of the image quality assessment sub-model based on the evaluation loss to obtain the trained image quality assessment sub-model. The trained image quality assessment sub-model can more accurately evaluate the retouched images, thereby selecting the most matching retouched image and avoiding the selected retouched image from deviating from the user's expectations in terms of color tone, artistic style, etc. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating an image processing model training method provided in some embodiments of this application; Figure 2 These are schematic diagrams illustrating the training of image retouching sub-models provided in some embodiments of this application; Figure 3 These are schematic diagrams illustrating the evaluation process provided in some embodiments of this application; Figure 4 This is a schematic flowchart of an image processing method provided in some embodiments of this application; Figure 5 This is a schematic diagram illustrating the process of determining candidate retouching sub-models provided in some embodiments of this application. Figure 6 This is a schematic diagram of the image acquisition process provided in some embodiments of this application; Figure 7 This is a schematic diagram of the image retouching evaluation process provided in some embodiments of this application; Figure 8 This is a schematic diagram of the structure of the image processing model training device provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of the image processing apparatus provided in the embodiments of this application; Figure 10 This is a structural block diagram of an electronic device provided in an embodiment of this application; Figure 11 This is a structural block diagram of another electronic device provided in the embodiments of this application. Detailed Implementation

[0016] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0017] The terms "first," "second," etc., used in this application's specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.

[0018] Existing automatic photo retouching technologies mainly suffer from the following three technical approaches and shortcomings: Reinforcement learning-based methods model image retouching as a Markov decision process, simulating user retouching steps through sequential decision-making to improve model interpretability. However, due to the constraint of differentiability, it is difficult to accurately capture the non-differentiable operations and complex context-dependent decision patterns used by retouchers. Especially when dealing with a wide variety of retouching scenarios, it cannot dynamically adapt the strategy selection logic, resulting in a deviation between the retouching effect and the retouching intention of professional retouchers.

[0019] End-to-end mapping-based methods treat image retouching as a direct image-to-image conversion task, directly learning the mapping relationship between the original image and the retouched result through a fully convolutional network, assuming that the mapping logic is continuous and consistent across the entire dataset. However, this approach ignores the discreteness of professional image retouching strategies, such as the differentiated parameter adjustment modes for different scenes like portraits and landscapes. This results in the model being unable to dynamically switch adaptation strategies when processing images from different scenes, limiting its generalization ability and leading to problems such as color shift and detail distortion in the resulting images.

[0020] Physical model-based methods combine deep learning with physical models to achieve rapid image retouching by predicting model parameters. Existing adaptive 3D LUT image retouching methods fail to integrate with the discrete nature of retouching strategies, resulting in a lack of strategy specificity in parameter updates. This makes it difficult to efficiently capture parameter adjustment patterns under different strategies, and carries the risk of overfitting or style adaptation bias. Furthermore, the black-box nature of the model makes the retouching strategy uninterpretable, failing to reproduce the decision-making logic of professional retouchers.

[0021] In summary, existing technologies fail to adequately model the discreteness of retouching strategies, lack dynamic scene adaptation mechanisms, and efficient parameter optimization methods, resulting in automated retouching failing to meet professional needs in terms of adaptability, interpretability, and artistic fidelity.

[0022] Therefore, this application provides an image processing model training method that can dynamically select suitable candidate image processing models for preprocessed images of different scenes such as portraits and landscapes through a dynamic routing model, significantly improving the adaptability to diverse image content. Furthermore, it dynamically evaluates the evaluation loss between the evaluation result of each retouched image and the evaluation result of the target image through an image quality evaluation model, and updates the parameters of the image quality evaluation sub-model based on the evaluation loss to obtain the trained image quality evaluation sub-model. The trained image quality evaluation sub-model can more accurately evaluate the retouched images, thereby selecting the most matching retouched image and avoiding the selected retouched image from deviating from the user's expectations in terms of color tone, artistic style, etc.

[0023] The image processing model training method provided in this application will be described below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0024] like Figure 1 As shown in the embodiments of this application, an image processing model training method is provided. The image processing model includes a dynamic routing sub-model, M image retouching sub-models, and an image quality assessment sub-model. The method includes: Step 101: Obtain multiple image sample subsets, the image sample subsets including multiple image sample pairs, the image sample pairs including preprocessed images and target images.

[0025] Specifically, multiple image sample subsets are first obtained. Each image sample subset includes multiple image sample pairs, and each image sample pair includes a preprocessed image and a target image. Each image sample subset corresponds to a specific image retouching strategy, and image sample pairs within the same image sample subset have the same image retouching strategy label.

[0026] Step 102: For any pair of image samples in any subset of the image samples, input the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, and obtain the retouched image corresponding to each candidate retouching sub-model based on the preprocessed image and the N candidate retouching sub-models, where M≥N and M and N are both positive integers.

[0027] Specifically, taking any image sample pair from multiple image sample subsets as an example, the preprocessed image from the above image sample pair is input into the dynamic routing model, activating N candidate retouching sub-models among the M retouching sub-models that are most suitable for the preprocessed image, and the N candidate retouching sub-models form an activation expert set. Among them, the N candidate retouching sub-models are at least a part of the M retouching sub-models.

[0028] The preprocessed image is input into each of the N candidate retouching sub-models, resulting in a retouched image output by each sub-model. Each candidate sub-model corresponds to one retouched image, thus yielding N retouched images corresponding to the preprocessed image. This method is used to obtain N retouched images corresponding to the preprocessed image in each image sample pair within each image sample subset.

[0029] Step 103: Input the preprocessed image, the target image, and the N retouched images corresponding to the preprocessed image into the image quality assessment sub-model to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results corresponding to the target image.

[0030] Specifically, taking any image sample pair from multiple image sample subsets as an example, the preprocessed image, the target image, and the N retouched images corresponding to the preprocessed image in the above image sample pair are all input into the image quality assessment sub-model. The image quality assessment sub-model performs quality assessment on each retouched image and the target image to obtain the assessment results of each retouched image and the assessment results of the target image.

[0031] Step 104: Based on the evaluation results of each retouched image and the evaluation results corresponding to the target image, calculate the evaluation loss, and update the parameters of the image quality evaluation sub-model based on the evaluation loss to obtain the trained image quality evaluation sub-model.

[0032] Specifically, based on the evaluation results of each retouched image of the preprocessed image and the evaluation result of the target image, the evaluation loss between the evaluation results of each retouched image and the evaluation result of the target image is calculated. The parameters of the image quality assessment sub-model are then updated based on this evaluation loss to obtain the image quality assessment sub-model with updated parameters. Through this method, the image quality assessment sub-model is trained using the corresponding evaluation loss for each image sample, resulting in the trained image quality assessment sub-model, and consequently, the trained image processing model.

[0033] In this embodiment, multiple image sample subsets are first obtained, each including multiple image sample pairs, each including a preprocessed image and a target image. For any image sample pair in any subset, the preprocessed image is input into a dynamic routing sub-model to determine N suitable candidate retouching sub-models from M retouching sub-models. Based on the preprocessed image and the N candidate retouching sub-models, the retouched image corresponding to each candidate retouching sub-model is obtained. Through the dynamic routing model, suitable candidate image processing models can be dynamically selected for images in different scenes such as portraits and landscapes, significantly improving the adaptability to diverse image content.

[0034] Furthermore, the preprocessed image, the target image, and N corresponding retouched images are input into the image quality assessment sub-model to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results of the target image. Based on the evaluation results of each retouched image and the evaluation results of the target image, the evaluation loss is calculated, and the parameters of the image quality assessment sub-model are updated based on the evaluation loss to obtain the trained image quality assessment sub-model. The image quality assessment model dynamically evaluates the evaluation loss between the evaluation results of each retouched image and the evaluation results of the target image, and updates the parameters of the image quality assessment sub-model based on the evaluation loss to obtain the trained image quality assessment sub-model. The trained image quality assessment sub-model can more accurately evaluate the retouched images, thereby selecting the most matching retouched image and avoiding the selected retouched image from deviating from the user's expectations in terms of color tone, artistic style, etc.

[0035] In an optional specific embodiment, step 101, obtaining a plurality of image sample subsets, includes: Obtain an image sample set, which includes multiple image sample pairs; Based on the target parameter difference sequence of each image sample pair, the image sample pairs in the image sample set are classified to obtain multiple image sample subsets. The target parameter difference sequence is used to characterize the parameter difference between the target image and the preprocessed image. Based on the target parameter difference sequence of image sample pairs within each image sample subset, a retouching strategy corresponding to the image sample subset is generated, and a retouching strategy label is assigned to the corresponding image sample pair.

[0036] Specifically, the initial image samples are input into the image editing tool for preprocessing to obtain a preprocessing parameter sequence. and post-processing parameter sequence The preprocessing parameter sequence and postprocessing parameter sequence include parameters such as exposure, contrast, color temperature, and black level, and a normalized target parameter difference sequence is calculated:

[0037] in, For the target parameter difference sequence; Norm represents the preprocessed parameter sequence and post-processing parameter sequence Each parameter is Z-score standardized separately.

[0038] The K-medoids clustering algorithm, which is highly robust to noise, is used for... Clustering, that is, multiple Input the K-medoids algorithm to obtain M clusters and the actual number of clusters in each cluster. As cluster centers, each cluster is used to summarize a retouching strategy based on the differences in the target parameters. Specific parameters can be defined using the cluster center parameters as the retouching strategy for that cluster, resulting in M ​​retouching strategies. The clustering objective function is:

[0039] in, For the cluster center set, For the first Clusters Set, X is the set of all , The distance is Euclidean. Let i be the cluster center of the i-th cluster. For each in this cluster ; The above formula calculates each The distances to the corresponding cluster centers are summed to obtain the total distances for that cluster. The goal is to minimize the sum of the distances for each cluster, thereby continuously optimizing the clusters and cluster centers.

[0040] Based on the clustering results above, image sample pairs are assigned to corresponding clusters to form image sample sets for each cluster. Each image sample set corresponds to a retouching strategy, such as "warm tone" + "landscape sharpening + high saturation", and the retouching strategy is labeled.

[0041] Existing technologies mostly adopt an end-to-end image-to-image model, rarely focusing on and utilizing the image editing parameter information before and after image editing. In the above embodiments of this application, for each pair of image samples in the image sample set, the image editing parameters are extracted and unsupervised clustering is performed to obtain strategy labels. Based on the image editing strategy labels, image editing strategies are divided to obtain image sample sets corresponding to different image editing strategies, which provides guidance for the training of subsequent image processing models.

[0042] The training process of the M image retouching sub-models in the image processing model is illustrated below through specific examples: In an optional specific embodiment, before step 102, which inputs the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the method further includes: For any subset of the image samples, the preprocessed image is input into the image editing sub-model, the image features of the preprocessed image are extracted through the backbone feature extraction layer of the image editing sub-model, and a three-dimensional lookup table is obtained based on the image features of the preprocessed image. The image features of the preprocessed image are input into the adaptive interval module of the retouching sub-model to generate a non-uniform sampling interval. Based on the three-dimensional lookup table and the non-uniform sampling interval, the pixel value of each pixel in the preprocessed image is calculated to obtain the first predicted retouched image. Based on the reconstruction loss of the target image corresponding to the preprocessed image and the first predicted retouching image, the smoothing loss of each color channel value of each pair of pixels in the three-dimensional lookup table, and the monotonicity loss of each color channel value of each pair of pixels in the three-dimensional lookup table, the parameters of the retouching sub-model are updated to obtain the pre-trained retouching sub-model. The three-dimensional lookup table corresponding to each color channel is decomposed into three low-rank components. Based on the three low-rank components and the decomposition rank of each three-dimensional color channel lookup table, the three-dimensional lookup table is updated. The preprocessed image is input into the retouching sub-model that updates the 3D lookup table to obtain the second predicted retouched image; Based on the reconstruction loss of the target image corresponding to the preprocessed image and the second predicted retouched image, the parameters of the pre-trained retouching sub-model are updated to obtain the trained retouching sub-model.

[0043] Specifically, such as Figure 2 As shown, multiple image sample sets are first obtained. Each image sample set includes multiple image sample pairs, and each image sample pair includes a preprocessed image and a target image. Each image sample set corresponds to a specific image retouching strategy, and image sample pairs within the same image sample set have the same image retouching strategy label.

[0044] The initial image editing sub-model is constructed based on a modular expert model architecture consisting of a "core feature extraction layer + 3D lookup table + adaptive interval module". The core feature extraction layer is a Convolutional Neural Network (CNN) core feature extraction layer, the adaptive interval module is AdaInt, and the 3D lookup table (3D-LUT) treats the values ​​of the three RGB channels as three-dimensional coordinates, storing the mapping relationship between input color and output color in a table in advance.

[0045] The following example uses one image sample pair from one of the image sample sets for illustration: like Figure 2 As shown, the CNN backbone feature extraction layer can employ a Residual Network (ResNet) architecture or other CNN models to extract image features from preprocessed images that possess both global and local speech details. K predefined basic 3D lookup tables are used. r takes the value of an integer between 1 and R. An adaptive 3D lookup table is generated by weighted combination of features, as shown in the following formula:

[0046]

[0047] in, Represents the image features of the preprocessed image; MLP stands for Multilayer Perceptron. The image features of the preprocessed image are input into the MLP to obtain H weight values. The first weight value is the weight value of the first basic 3D lookup table, the second weight value is the weight value of the second basic 3D lookup table, and so on, to obtain the weight value of each basic 3D lookup table. Indicates the first The weight values ​​of a basic 3D lookup table. An integer ranging from 1 to H; Indicates the first A basic 3D lookup table; This represents a 3D lookup table.

[0048] The pixel value of each pixel in the preprocessed image is used as the index for a 3D lookup table, for example, (0, 255, 255). If the 3D lookup table stored the pixel value for every single pixel, its size would be 256*256*256, which is too large. Therefore, instead of storing the pixel value for every single pixel, the 3D lookup table only stores the pixel values ​​of key pixels. The size of the 3D lookup table then becomes 33*33*33. For a 256*256*256 image, a key pixel is determined every 8 pixels, and its pixel value is stored. Therefore, the lookup table only needs to store the pixel values ​​of 33*33*33 pixels. The pixel values ​​of other pixels are obtained by linear interpolation based on the pixel values ​​of the 8 closest key pixels.

[0049] The image features of the preprocessed image are input into the AdaInt module to predict the non-uniform sampling interval Q. Specifically, the image features of the preprocessed image are input into the AdaInt module to obtain the interval between every two key pixels. For example, previously, the interval between two key pixels was 8 pixels. The AdaInt module can generate the interval between every two key pixels to update the interval between key pixels, providing a more flexible lookup method to optimize the sampling accuracy of the 3D lookup table. Based on the optimized 3D lookup table and the non-uniform sampling interval, the pixel value of each pixel in the preprocessed image is calculated to obtain the first predicted retouched image of the preprocessed image. The specific formula for calculating the pixel value is as follows:

[0050] in, Represents the trilinear interpolation function; This represents a 3D lookup table; Q represents the non-uniform sampling interval Q predicted by the AdaInt module; This indicates finding the value away from the specified location in the 3D lookup table. The pixel values ​​of the 8 most recent key pixels; This represents the pixel value of the p-th pixel in the preprocessed image before optimization. This represents the pixel value of the p-th pixel in the optimized preprocessed image.

[0051] Using the above method, the first predicted retouched image of each preprocessed image in the image sample set is obtained. Based on the first predicted retouched image of each preprocessed image in the image sample set and the target image corresponding to the preprocessed image, the initial image processing model is trained to obtain a pre-trained retouching sub-model corresponding to the image sample set, that is, a pre-trained retouching sub-model corresponding to a retouching strategy is obtained. The loss function used for training is as follows:

[0052]

[0053]

[0054]

[0055] in, Indicates the losses incurred during reconstruction; Indicates smoothing loss; Indicates monotonicity loss; This represents the first predicted retouched image from the preprocessed image. This represents the target image corresponding to the preprocessed image; c represents the color channel, and its value range is: These correspond to the red, green, and blue channels, respectively. i, It is an index in a 3D lookup table, where, Corresponding to the x-axis direction, Corresponding to the y-axis direction, Corresponding to the z-axis direction; This indicates that the index in the 3D lookup table is... The output value of color channel c at that location, i.e. Pixel values ​​in; This refers to the L2 norm, also known as the Euclidean distance, which measures the difference between two values. Indicates the first The weight values ​​of the basic 3D lookup table, here Indices representing different weight values; This represents the ReLU function.

[0056] The above training process yields a pre-trained image retouching sub-model for each image sample set, which means a pre-trained image retouching sub-model for each retouching strategy. One retouching strategy corresponds to one pre-trained image retouching sub-model.

[0057] Based on the pre-trained retouching sub-model, a fast fine-tuning scheme using a 3D lookup table is employed to obtain the trained retouching sub-model. First, the 3D lookup table is decomposed into low-rank components using a parallel factor (CANDECOMP / PARAFAC, CP), with a lookup table for each channel c. It can be approximated as:

[0058] in, Let R be a 33-dimensional factor tensor, and R be the rank used in the decomposition. R represents the tensor outer product. When R=16, the parameter compression ratio can reach 96%. Therefore, R is set to 16 to speed up the training process and save storage space.

[0059] Based on this decomposition, the parameters of the 3D lookup table in the pre-trained image retouching sub-model are frozen. Additionally, updatable low-rank factor component parameters were used. For each retouching strategy, a pre-trained retouching sub-model and... Fine-tuning was performed on the parameters of the 3D lookup table during training. It can be represented as:

[0060]

[0061] Where i represents any one of the multiple channels, such as RGB.

[0062] After updating the 3D lookup table, using the training method of the pre-trained retouching sub-models described above, for one of the pre-trained retouching sub-models, the preprocessed image is input into the pre-trained retouching sub-model to obtain the second predicted retouched image. Based on the second predicted retouched image and the target image, through... The loss function is used to train the pre-trained retouching sub-model to update its parameters, resulting in the trained retouching sub-model.

[0063] By using the above-mentioned rapid fine-tuning method, we can obtain the trained image retouching sub-model corresponding to each image retouching strategy, that is, one image retouching strategy corresponds to one trained image retouching sub-model.

[0064] In the above embodiment, the image retouching sub-model is constructed based on tensor low-rank fine-tuning, and a pre-trained image retouching sub-model is obtained by training on the image sample set corresponding to each image retouching strategy. Furthermore, based on tensor low-rank fine-tuning technology, the pre-trained image retouching sub-model is further trained on each image sample set to obtain the parameters of multiple image retouching sub-models, and each image retouching sub-model corresponds to a retouching strategy it is good at.

[0065] The training process of the dynamic routing sub-model in the image processing model is illustrated below through specific examples: In an optional specific embodiment, before step 102, which inputs the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the method further includes: The multi-color space features of the preprocessed image are input into the dynamic routing sub-model to obtain the prediction parameter difference sequence and prediction activation probability of each image editing sub-model. Based on the cross-entropy loss between the predicted activation probability of each retouching sub-model and the retouching strategy label of the preprocessed image, as well as the parameter prediction loss between the predicted parameter difference sequence and the target parameter difference sequence of each retouching sub-model, the parameters of the dynamic routing sub-model are updated to obtain the pre-trained dynamic routing sub-model. Based on the predicted activation probability, the mean squared error loss of the pixel-level squared error between the retouched image and the target image of each retouching sub-model is weighted and averaged to update the parameters of the pre-trained dynamic routing sub-model to obtain the trained dynamic routing sub-model. The retouched image of each retouching sub-model is the retouched image obtained by inputting the preprocessed image into each of the M retouching sub-models.

[0066] Specifically, multiple image sample sets are first acquired, each image sample set comprising multiple image sample pairs, and each image sample pair including a preprocessed image and a target image. Each image sample set corresponds to a specific image retouching strategy, and image sample pairs within the same image sample set share the same image retouching strategy label.

[0067] The following example uses one image sample pair from one of the image sample sets for illustration: The preprocessed image is input into each retouching sub-model to obtain the retouched image corresponding to each sub-model. Furthermore, the preprocessed image is converted into six color space images: RGB, LAB, XYZ, YUV, HSV, and YCbCr. Each color space image is then processed by a lightweight encoder to extract its color space features, capturing multi-dimensional information such as brightness, chroma, and saturation. These six color space features are then concatenated to obtain the multi-color space features of the preprocessed image. The aforementioned retouching sub-models are the trained retouching sub-models.

[0068] The multi-color space features of the preprocessed image are input into the initial dynamic routing sub-model to obtain the prediction parameter difference sequence and the prediction activation probability of each retouching sub-model. A two-stage training strategy is then used to obtain the dynamic routing sub-model. Phase 1, Feature Alignment: By using the cross-entropy loss between the predicted activation probabilities of each retouching sub-model and the retouching strategy label of the preprocessed image, the activation probabilities are forced to match the retouching strategy label. Combined with the parameter prediction loss between the predicted parameter difference sequence and the target parameter difference sequence of each retouching sub-model, the feature semantic encoding is enhanced. The total loss for stage one is:

[0069]

[0070]

[0071] in, This represents the total loss for Phase One; Cross-entropy loss; Let i be the label for the i-th image editing strategy, where i is an integer between 1 and M. Let be the predicted activation probability of the i-th image retouching sub-model; Predict the loss for the parameters; For predicting parameter difference sequences; The target parameter difference sequence.

[0072] The initial dynamic routing sub-model is iteratively trained using the total loss from stage one to obtain a pre-trained dynamic routing sub-model.

[0073] Phase Two, Fidelity Optimization: Based on the mean squared error loss, which is a weighted average of the pixel-level squared errors between the retouched and target images of each retouching sub-model according to the predicted activation probabilities, the pre-trained dynamic routing sub-model is trained to obtain the dynamic routing sub-model. The loss function for stage two is:

[0074] in, This is the loss function for stage two; Let be the predicted activation probability of the i-th image editing sub-model, where i is an integer between 1 and M; The image to be edited for the i-th edited sub-model; The target image is the image corresponding to the preprocessed image.

[0075] Prioritize optimizing the output quality of highly relevant experts (x preprocessed image, Post-processed images of image pairs.

[0076] The training process of the image quality assessment sub-model in the image processing model is illustrated below through specific examples: In an optional specific embodiment, step 104 calculates an evaluation loss based on the evaluation results of each retouched image and the evaluation result corresponding to the target image, and updates the parameters of the image quality assessment sub-model based on the evaluation loss to obtain the trained image quality assessment sub-model, including: Based on the evaluation loss of each retouched image and the target evaluation result, the evaluation loss of every two retouched images, and the evaluation loss of each retouched image and the target image, the parameters of the image quality evaluation model are updated to obtain the trained image quality evaluation sub-model; wherein, the target evaluation result is the peak signal-to-noise ratio of the retouched image and the target image.

[0077] Specifically, multiple image sample sets are first acquired, each image sample set comprising multiple image sample pairs, and each image sample pair including a preprocessed image and a target image. Each image sample set corresponds to a specific image retouching strategy, and image sample pairs within the same image sample set share the same image retouching strategy label.

[0078] The following example uses one image sample pair from one of the image sample sets for illustration: The multi-color space features of the preprocessed image are input into the dynamic routing sub-model to determine N candidate retouching sub-models corresponding to the preprocessed image from M retouching sub-models. The preprocessed image is then input into each of the N candidate retouching sub-models to obtain the retouched image of each candidate retouching sub-model. Both the dynamic routing sub-model and the retouching sub-model are trained versions of the dynamic routing sub-model.

[0079] First, a RetouchStyle-Image Quality Assessment (RetouchStyle-IQA) network is constructed for filtering the evaluation results of multiple retouching strategies; this is the initial image quality assessment sub-model. The RetouchStyle-IQA network is trained to obtain its network parameters. The RetouchStyle-IQA network is an improvement on the Multi-dimension Attention No-reference Image Quality Assessment (MANIQA) sub-model, with an AdaIN layer inserted to achieve style-aware feature alignment.

[0080] like Figure 3 As shown, the preprocessed image, the target image corresponding to the preprocessed image, and N retouched images corresponding to the preprocessed image are respectively input into the initial image quality assessment sub-model. The preprocessed image is then passed through a ViT layer, a transposed attention block, a convolutional layer (Conv), and a SwinTransformer to extract image features. Image features of each edited image are extracted using an encoder. , and The features are input to AdaIN for feature fusion. After fusion by the AdaIN layer, the features are then processed sequentially through the ViT layer, the transposed attention layer, the convolutional layer, and the shifted window transformer before being input back to the AdaIN layer. The AdaIN layer then... The preprocessed images are then fused together to obtain their respective weights and scores. The weights and scores of each preprocessed image are then summed to obtain the evaluation result.

[0081] Among them, the AdaIN layer is used to... Characteristic statistics (mean, variance) aligned to The formula is:

[0082] in, The mean and standard deviation of the image features of this batch of preprocessed images; In addition, a dual loss function optimization was used to train the RetouchStyle-IQA network: Score loss:

[0083] in, The evaluation loss is the evaluation result of each retouched image corresponding to the preprocessed image and the evaluation result of the target image. The quality score of PSNR for the i-th retouched image and the target image (PSNR values ​​calculated for the output image and the target image); The evaluation result of the i-th retouched image corresponding to the preprocessed image; Ranking loss is used to force higher scores from retouched images that are of high real-quality:

[0084] in, The evaluation loss is the evaluation result of every two retouched images of the preprocessed image; Margin is a hyperparameter of 0.1; The evaluation result of the i-th retouched image corresponding to the preprocessed image; This indicates the evaluation result of the target image corresponding to the preprocessed image.

[0085] Total loss:

[0086] The initial image quality assessment sub-model is trained using the total loss described above to update its parameters, resulting in the trained image quality assessment sub-model.

[0087] In summary, this embodiment of the application decomposes the image retouching strategy into discrete subspaces through unsupervised clustering, enabling the model to dynamically adapt to different scenes such as portraits and landscapes, significantly improving its adaptability to diverse image content. Furthermore, the strategy decision-making process can be intuitively presented through visualization technology, enhancing the model's interpretability. Moreover, lightweight optimization is achieved using tensor low-rank decomposition, requiring only a few parameter updates to achieve strategy-specific optimization, significantly reducing computational costs and facilitating model training and optimization. Additionally, a dynamic routing model is employed to analyze multi-dimensional image features, accurately activating the appropriate retouching experts, strengthening the model's ability to perceive image content, and achieving context-sensitive strategy selection. Finally, the image quality assessment sub-model ensures that the retouching result is consistent with the target style, reducing manual adjustment costs and making it suitable for scenarios with high requirements for artistic consistency.

[0088] like Figure 4 As shown in the embodiments of this application, an image processing method is also provided, which may specifically include the following steps: Step 401: Input the multi-color space features of the image to be processed into the dynamic routing sub-model of the trained image processing model to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model; where P≥Q, and P and Q are both positive integers.

[0089] Specifically, such as Figure 5 As shown, the initial image to be processed is obtained, which is the image that needs to be retouched. The initial image to be processed is scaled (resized) to a specified resolution, such as 480p or 360p, to obtain the image to be processed, satisfying the input size constraints of the image processing model. The image to be processed is converted into multiple color space images, including RGB (red, green, blue), LAB (lightness-complementary color), XYZ (device-independent standard color coordinate system), YUV (luminance-chrominance difference), HSV (hue-saturation-lightness), and YCbCr (luminance-blue difference-red difference). Each color space image is then processed by a lightweight encoder. Extract color space features from each color space image This is to capture multi-dimensional information such as brightness, chroma, and saturation. Let k represent the color space feature of the k-th color space image. If the number of color space images is 6, then k can be 1 to 6. Each color space feature is set as a D-dimensional vector. The lightweight encoder is preferably an 18-layer residual network (ResNet18).

[0090] Taking a color space image with 6 elements as an example: The 6 color space features are concatenated to obtain a multi-color space feature. The specific formula is as follows:

[0091] Where Z represents the multi-color space features of the image to be processed, and the multi-color space features are k*D dimensional vectors, that is, 6D dimensional vectors; Indicates the use of lightweight encoders Extract the first color space image Obtain color space characteristics ; Indicates the use of lightweight encoders Extract the first color space image Obtain color space characteristics ; Indicates the use of lightweight encoders Extract the first color space image Obtain color space characteristics ; Indicates the use of lightweight encoders Extract the first color space image Obtain color space characteristics ; Indicates the use of lightweight encoders Extract the first color space image Obtain color space characteristics ; Indicates the use of lightweight encoders Extract the first color space image Obtain color space characteristics .

[0092] The multi-color space features of the image to be processed are input into the dynamic routing sub-model of the trained image processing model. This activates the Q candidate retouching sub-models best suited to the image from among the P retouching sub-models. These Q candidate retouching sub-models form the activation expert set. Among them, the Q candidate retouching sub-models are at least a part of the P retouching sub-models, and the P retouching sub-models are at least a part of the M retouching sub-models.

[0093] Step 402: Input the image to be processed into the Q candidate retouching sub-models respectively to obtain the retouched image corresponding to each candidate retouching sub-model.

[0094] Specifically, the image to be processed is input into each candidate retouching sub-model to obtain the retouched image output by each candidate retouching sub-model, that is, each candidate retouching sub-model corresponds to one retouched image.

[0095] For example, such as Figure 6As shown, there are P retouching sub-models: retouching sub-model 1, retouching sub-model 2, retouching sub-model 3, ..., retouching sub-model P. From these P retouching sub-models, Q retouching sub-models are selected as Q candidate retouching sub-models. The image to be processed is input into each of the Q candidate retouching sub-models to obtain Q retouched images: retouched image 1, retouched image 2, ..., retouched image Q.

[0096] Step 403: Input the image to be processed and the Q retouched images into the image quality evaluation sub-model of the image processing model for retouching evaluation, and determine the target retouched image among the Q retouched images.

[0097] Specifically, the image to be processed and Q retouched images are input into the image quality assessment sub-model of the trained image processing model. The image quality assessment sub-model evaluates each retouched image to obtain the evaluation result. Based on the evaluation results of each retouched image, the best retouched image is selected as the target retouched image for output.

[0098] In this embodiment, the multi-color space features of the image to be processed are first input into a dynamic routing sub-model to determine Q suitable candidate retouching sub-models from P retouching sub-models. The dynamic routing sub-model can dynamically select suitable candidate retouching sub-models for images in different scenes such as portraits and landscapes, significantly improving adaptability to diverse image content. Furthermore, the image to be processed is input into each of the Q candidate retouching sub-models, and each candidate retouching sub-model performs retouching processing on the image to be processed, resulting in multiple retouched images of the image to be processed. The image to be processed and the Q retouched images are then input into an image quality assessment sub-model for retouching evaluation to determine the target retouched image among the multiple retouched images. The image quality assessment sub-model dynamically evaluates the matching degree between each retouched image and the preprocessed image, selecting the retouched image with the highest matching degree as the target retouched image, thus preventing the target retouched image from deviating from user expectations in terms of color tone, artistic style, etc. Furthermore, the above process uses a dynamic routing sub-model to filter candidate retouching sub-models from multi-color space images, and evaluates and filters the retouching results of multiple candidate retouching sub-models to form a complete automatic retouching system. The entire process is executed automatically, significantly improving image processing efficiency.

[0099] In an optional specific embodiment, step 401 inputs the multi-color space features of the image to be processed into the dynamic routing sub-model of the image processing model to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model, including: The multi-color space features of the image to be processed are input into the dynamic routing sub-model to obtain the activation probability corresponding to each image retouching model; The Q retouching sub-models with the highest activation probability among the P retouching sub-models are determined as the Q candidate retouching sub-models.

[0100] Specifically, a dynamic routing sub-model composed of a multi-layer perceptron (MLP) is used to map the multi-color space features of the image to be processed into log probabilities corresponding to each retouching sub-model. Each log probability is then processed by softmax to generate activation probabilities, thus obtaining the activation probabilities corresponding to each retouching sub-model. The specific formula is as follows:

[0101] in, Indicates the number of sub-models used for image editing; This represents the activation probability corresponding to the i-th image editing sub-model, where i takes the value of an integer between 1 and P; This represents the logarithmic probability corresponding to the i-th image editing sub-model; Let represent the logarithmic probability corresponding to the j-th image editing sub-model, where j is an integer between 1 and P.

[0102] After obtaining the activation probabilities of each of the P retouching sub-models, the Q retouching sub-models with the highest activation probabilities are used to balance the relevance and diversity of the strategy. Specifically, the activation probabilities of the P retouching sub-models are sorted in descending order, and the Q retouching sub-models corresponding to the top Q activation probabilities are selected in descending order. These Q retouching sub-models are used as candidate retouching sub-models to balance the relevance and diversity of the retouching strategy and the preprocessed image.

[0103] In an optional specific embodiment, step 403 inputs the image to be processed and Q retouched images into the image quality assessment sub-model of the image processing model for retouching evaluation, and determines the target retouched image among the Q retouched images, including: The image to be processed and Q retouched images are input into the image quality assessment sub-model. The feature extraction layer of the image quality assessment sub-model is used to extract the first image feature of the image to be processed and the second image feature of each retouched image. The first image features are aligned with each of the second image features using the adaptive instance normalization layer of the image quality assessment sub-model, and then the features are fused after alignment to obtain the fused features of each retouched image. Based on the fusion features of the Q retouched images, the retouching evaluation is performed to obtain the evaluation results of the Q retouched images; Based on the evaluation results of the Q retouched images, the target retouched image is determined among the Q retouched images.

[0104] Specifically, the image quality assessment sub-model includes a feature extraction layer and an adaptive instance normalization layer. The feature extraction layer includes a Vision Transformer (ViT), a CNN, and a Shifted Window Transformer (Swin Transformer). The adaptive instance normalization layer is the AdaIN layer.

[0105] The image to be processed and N retouched images are input into the image quality assessment sub-model. A feature extraction layer extracts the first image features of the image to be processed and the second image features of each retouched image. Then, an AdaIN layer aligns the first image features with each of the second image features, and fuses the aligned features with each second image feature to obtain the fused features of each retouched image. Retouching is then evaluated based on the fused features of each retouched image, yielding the evaluation results. The retouched image with the best evaluation result is selected as the target retouched image and output. The resulting target retouched image has a consistent style with the image to be processed, reducing manual adjustment costs.

[0106] For example: Figure 7 As shown, the Q retouched images corresponding to the preprocessed image are: retouched image 1, retouched image 2, ..., retouched image Q. The image to be processed and the Q retouched images are input into the image quality assessment sub-model. The first image feature of the image to be processed is extracted by the feature extraction layer. The second image feature of each retouched image is extracted by the Encoder. Then, the AdaIN layer is used to align the first image feature with each second image feature. The aligned feature of the first image feature is then fused with each second image feature to obtain the fused feature of each retouched image. Then, based on the fusion features of each retouched image, the retouching is evaluated using No-Reference Image Quality Assessment (NR-IQA) to obtain the evaluation results of each retouched image. The evaluation result 1 of retouched image 1 is 0.31, the evaluation result 2 of retouched image 2 is 0.88, the evaluation result 3 of retouched image 3 is 0.42, ..., and the evaluation result Q of retouched image Q is 0.55. Since 0.88 is the largest value, the retouched image 2 corresponding to evaluation result 2 is selected as the target retouched image.

[0107] Each retouched image is represented by retouched image i, where i takes the value of an integer between 1 and N.

[0108] In summary, this embodiment of the application decomposes the image retouching strategy into discrete subspaces through unsupervised clustering, enabling the model to dynamically adapt to different scenes such as portraits and landscapes, significantly improving its adaptability to diverse image content. Furthermore, the strategy decision-making process can be intuitively presented through visualization technology, enhancing the model's interpretability. Moreover, lightweight optimization is achieved using tensor low-rank decomposition, requiring only a few parameter updates to achieve strategy-specific optimization, significantly reducing computational costs and facilitating model training and optimization. Additionally, a dynamic routing model is employed to analyze multi-dimensional image features, accurately activating the appropriate retouching experts, strengthening the model's perception of image content, and enabling context-sensitive strategy selection. Furthermore, an image quality assessment model is introduced to ensure consistency between the retouching result and the target style, reducing manual adjustment costs and making it suitable for scenarios with high requirements for artistic consistency. The entire image processing workflow is integrated to achieve an automated image retouching pipeline, significantly improving processing efficiency. The framework also possesses good compatibility and scalability, flexibly adapting to different basic models and application scenarios, providing an efficient and controllable solution for professional-grade image enhancement.

[0109] The image processing model training method provided in this application can be executed by an image processing model training device. This application uses an image processing model training device executing the image processing model training method as an example to illustrate the image processing model training device provided in this application.

[0110] like Figure 8 As shown in the illustration, this application also provides an image processing model training device 800. The image processing model includes a dynamic routing sub-model, M image retouching sub-models, and an image quality assessment sub-model. The device includes: The acquisition module 801 is used to acquire multiple image sample subsets, the image sample subsets including multiple image sample pairs, the image sample pairs including a preprocessed image and a target image; The processing module 802 is used to input the preprocessed image into the dynamic routing sub-model for any pair of image samples in any subset of the image samples, so as to determine N candidate retouching sub-models from the M retouching sub-models, and obtain the retouched image corresponding to each candidate retouching sub-model based on the preprocessed image and the N candidate retouching sub-models. The evaluation module 803 is used to input the preprocessed image, the target image, and N retouched images corresponding to the preprocessed image into the image quality evaluation sub-model, so as to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results corresponding to the target image. The parameter update module 804 is used to calculate the evaluation loss based on the evaluation results of each retouched image and the evaluation result corresponding to the target image, and update the parameters of the image quality evaluation sub-model based on the evaluation loss to obtain the trained image quality evaluation sub-model. Where M ≥ N, and M and N are both positive integers.

[0111] Optionally, before inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the processing module 802 is further configured to: For any subset of the image samples, the preprocessed image is input into the image editing sub-model, the image features of the preprocessed image are extracted through the backbone feature extraction layer of the image editing sub-model, and a three-dimensional lookup table is obtained based on the image features of the preprocessed image. The image features of the preprocessed image are input into the adaptive interval module of the retouching sub-model to generate a non-uniform sampling interval. Based on the three-dimensional lookup table and the non-uniform sampling interval, the pixel value of each pixel in the preprocessed image is calculated to obtain the first predicted retouched image. Based on the reconstruction loss of the target image corresponding to the preprocessed image and the first predicted retouching image, the smoothing loss of each color channel value of each pair of pixels in the three-dimensional lookup table, and the monotonicity loss of each color channel value of each pair of pixels in the three-dimensional lookup table, the parameters of the retouching sub-model are updated to obtain the pre-trained retouching sub-model. The three-dimensional lookup table corresponding to each color channel is decomposed into three low-rank components. Based on the three low-rank components and the decomposition rank of each three-dimensional color channel lookup table, the three-dimensional lookup table is updated. The preprocessed image is input into the retouching sub-model that updates the 3D lookup table to obtain the second predicted retouched image; Based on the reconstruction loss of the target image corresponding to the preprocessed image and the second predicted retouched image, the parameters of the pre-trained retouching sub-model are updated to obtain the trained retouching sub-model.

[0112] Optionally, before inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the processing module 802 is further configured to: The multi-color space features of the preprocessed image are input into the dynamic routing sub-model to obtain the prediction parameter difference sequence and prediction activation probability of each image editing sub-model. Based on the cross-entropy loss between the predicted activation probability of each retouching sub-model and the retouching strategy label of the preprocessed image, as well as the parameter prediction loss between the predicted parameter difference sequence and the target parameter difference sequence of each retouching sub-model, the parameters of the dynamic routing sub-model are updated to obtain the pre-trained dynamic routing sub-model. Based on the predicted activation probability, the mean squared error loss of the pixel-level squared error between the retouched image and the target image of each retouching sub-model is weighted and averaged to update the parameters of the pre-trained dynamic routing sub-model to obtain the trained dynamic routing sub-model. The retouched image of each retouching sub-model is the retouched image obtained by inputting the preprocessed image into each of the M retouching sub-models.

[0113] Optionally, when the parameter update module 804 calculates the evaluation loss based on the evaluation results of each retouched image and the evaluation result corresponding to the target image, and updates the parameters of the image quality evaluation sub-model based on the evaluation loss to obtain the trained image quality evaluation sub-model, it is specifically used for: Based on the evaluation loss of each retouched image and the target evaluation result, the evaluation loss of every two retouched images, and the evaluation loss of each retouched image and the target image, the parameters of the image quality evaluation model are updated to obtain the trained image quality evaluation sub-model; wherein, the target evaluation result is the peak signal-to-noise ratio of the retouched image and the target image.

[0114] Optionally, when acquiring multiple image sample subsets, the acquisition module 801 is specifically used for: Obtain an image sample set, which includes multiple image sample pairs; Based on the target parameter difference sequence of each image sample pair, the image sample pairs in the image sample set are classified to obtain multiple image sample subsets. The target parameter difference sequence is used to characterize the parameter difference between the target image and the preprocessed image. Based on the target parameter difference sequence of image sample pairs within each image sample subset, a retouching strategy corresponding to the image sample subset is generated, and a retouching strategy label is assigned to the corresponding image sample pair.

[0115] The image processing model training device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0116] The image processing model training device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.

[0117] The image processing model training device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0118] The image processing method provided in this application can be executed by an image processing device. This application uses an image processing device executing the image processing method as an example to illustrate the image processing device provided in this application.

[0119] like Figure 9 As shown in the illustration, this application also provides an image processing apparatus, including: The determination module 901 is used to input the multi-color space features of the image to be processed into the dynamic routing sub-model of the trained image processing model, so as to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model; where P≥Q, and P and Q are both positive integers. The image editing module 902 is used to input the image to be processed into the Q candidate image editing sub-models respectively to obtain the image editing image corresponding to each candidate image editing sub-model; The determining module 901 is further configured to input the image to be processed and the Q retouched images into the image quality evaluation sub-model of the image processing model for retouching evaluation, and determine the target retouched image among the Q retouched images.

[0120] Optionally, when the determining module 901 inputs the multi-color space features of the image to be processed into the dynamic routing sub-model of the image processing model to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model, it is specifically used for: The multi-color space features of the image to be processed are input into the dynamic routing sub-model to obtain the activation probability corresponding to each image retouching model; The Q retouching sub-models with the highest activation probability among the P retouching sub-models are determined as the Q candidate retouching sub-models.

[0121] Optionally, when the determining module 901 inputs the image to be processed and Q retouched images into the image quality assessment sub-model of the image processing model for retouching evaluation, and determines the target retouched image among the Q retouched images, it is specifically used for: The image to be processed and Q retouched images are input into the image quality assessment sub-model. The feature extraction layer of the image quality assessment sub-model is used to extract the first image feature of the image to be processed and the second image feature of each retouched image. The first image features are aligned with each of the second image features using the adaptive instance normalization layer of the image quality assessment sub-model, and then the features are fused after alignment to obtain the fused features of each retouched image. Based on the fusion features of the Q retouched images, the retouching evaluation is performed to obtain the evaluation results of the Q retouched images; Based on the evaluation results of the Q retouched images, the target retouched image is determined among the Q retouched images.

[0122] The image processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0123] The image processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.

[0124] The image processing apparatus provided in this application embodiment can achieve... Figures 4 to 7 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0125] Optionally, such as Figure 10 As shown, this application embodiment also provides an electronic device 1100, including a processor 1101 and a memory 1102. The memory 1102 stores a program or instructions that can run on the processor 1101. When the program or instructions are executed by the processor 1101, they implement the various steps of the above-described image processing model training method or image processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0126] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0127] Figure 11 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application. The electronic device 1000 includes, but is not limited to, the following components: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.

[0128] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 11 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here. When the electronic device 1000 executes the step of the image processing model training method, the image processing model includes a dynamic routing sub-model, M image retouching sub-models and an image quality evaluation sub-model. The processor 1010 is used to acquire multiple image sample subsets, the image sample subsets include multiple image sample pairs, and the image sample pairs include preprocessed images and target images. For any pair of image samples in any subset of the image samples, the preprocessed image is input into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, and based on the preprocessed image and the N candidate retouching sub-models, the retouched image corresponding to each candidate retouching sub-model is obtained. The preprocessed image, the target image, and N retouched images corresponding to the preprocessed image are respectively input into the image quality assessment sub-model to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results corresponding to the target image. Based on the evaluation results of each retouched image and the evaluation results corresponding to the target image, the evaluation loss is calculated, and the parameters of the image quality evaluation sub-model are updated based on the evaluation loss to obtain the trained image quality evaluation sub-model. Where M ≥ N, and M and N are both positive integers.

[0129] Optionally, before inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the processor 1010 is further configured to: For any subset of the image samples, the preprocessed image is input into the image editing sub-model, the image features of the preprocessed image are extracted through the backbone feature extraction layer of the image editing sub-model, and a three-dimensional lookup table is obtained based on the image features of the preprocessed image. The image features of the preprocessed image are input into the adaptive interval module of the retouching sub-model to generate a non-uniform sampling interval. Based on the three-dimensional lookup table and the non-uniform sampling interval, the pixel value of each pixel in the preprocessed image is calculated to obtain the first predicted retouched image. Based on the reconstruction loss of the target image corresponding to the preprocessed image and the first predicted retouching image, the smoothing loss of each color channel value of each pair of pixels in the three-dimensional lookup table, and the monotonicity loss of each color channel value of each pair of pixels in the three-dimensional lookup table, the parameters of the retouching sub-model are updated to obtain the pre-trained retouching sub-model. The three-dimensional lookup table corresponding to each color channel is decomposed into three low-rank components. Based on the three low-rank components and the decomposition rank of each three-dimensional color channel lookup table, the three-dimensional lookup table is updated. The preprocessed image is input into the retouching sub-model that updates the 3D lookup table to obtain the second predicted retouched image; Based on the reconstruction loss of the target image corresponding to the preprocessed image and the second predicted retouched image, the parameters of the pre-trained retouching sub-model are updated to obtain the trained retouching sub-model.

[0130] Optionally, before inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the processor 1010 is further configured to: The multi-color space features of the preprocessed image are input into the dynamic routing sub-model to obtain the prediction parameter difference sequence and prediction activation probability of each image editing sub-model. Based on the cross-entropy loss between the predicted activation probability of each retouching sub-model and the retouching strategy label of the preprocessed image, as well as the parameter prediction loss between the predicted parameter difference sequence and the target parameter difference sequence of each retouching sub-model, the parameters of the dynamic routing sub-model are updated to obtain the pre-trained dynamic routing sub-model. Based on the predicted activation probability, the mean squared error loss of the pixel-level squared error between the retouched image and the target image of each retouching sub-model is weighted and averaged to update the parameters of the pre-trained dynamic routing sub-model to obtain the trained dynamic routing sub-model. The retouched image of each retouching sub-model is the retouched image obtained by inputting the preprocessed image into each of the M retouching sub-models.

[0131] Optionally, when the processor 1010 calculates the evaluation loss based on the evaluation results of each retouched image and the evaluation result corresponding to the target image, and updates the parameters of the image quality evaluation sub-model based on the evaluation loss to obtain the trained image quality evaluation sub-model, it is specifically used for: Based on the evaluation loss of each retouched image and the target evaluation result, the evaluation loss of every two retouched images, and the evaluation loss of each retouched image and the target image, the parameters of the image quality evaluation model are updated to obtain the trained image quality evaluation sub-model; wherein, the target evaluation result is the peak signal-to-noise ratio of the retouched image and the target image.

[0132] Optionally, when acquiring multiple subsets of image samples, the processor 1010 is specifically used for: Obtain an image sample set, which includes multiple image sample pairs; Based on the target parameter difference sequence of each image sample pair, the image sample pairs in the image sample set are classified to obtain multiple image sample subsets. The target parameter difference sequence is used to characterize the parameter difference between the target image and the preprocessed image. Based on the target parameter difference sequence of image sample pairs within each image sample subset, a retouching strategy corresponding to the image sample subset is generated, and a retouching strategy label is assigned to the corresponding image sample pair.

[0133] When the electronic device 1000 executes the steps of the image processing method, the processor 1010 is used to input the multi-color space features of the image to be processed into the dynamic routing sub-model of the trained image processing model, so as to determine Q candidate retouching sub-models from P retouching sub-models of the image processing model; wherein, P≥Q, and P and Q are both positive integers; The image to be processed is input into the Q candidate retouching sub-models respectively to obtain the retouched image corresponding to each candidate retouching sub-model; The image to be processed and Q retouched images are input into the image quality assessment sub-model of the image processing model for retouching evaluation, and the target retouched image among the Q retouched images is determined.

[0134] Optionally, when the processor 1010 inputs the multi-color space features of the image to be processed into the dynamic routing sub-model of the image processing model to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model, it is specifically used for: The multi-color space features of the image to be processed are input into the dynamic routing sub-model to obtain the activation probability corresponding to each image retouching model; The Q retouching sub-models with the highest activation probability among the P retouching sub-models are determined as the Q candidate retouching sub-models.

[0135] Optionally, when the processor 1010 inputs the image to be processed and Q retouched images into the image quality evaluation sub-model of the image processing model for retouching evaluation, and determines the target retouched image among the Q retouched images, it specifically performs the following: The image to be processed and Q retouched images are input into the image quality assessment sub-model. The feature extraction layer of the image quality assessment sub-model is used to extract the first image feature of the image to be processed and the second image feature of each retouched image. The first image features are aligned with each of the second image features using the adaptive instance normalization layer of the image quality assessment sub-model, and then the features are fused after alignment to obtain the fused features of each retouched image. Based on the fusion features of the Q retouched images, the retouching evaluation is performed to obtain the evaluation results of the Q retouched images; Based on the evaluation results of the Q retouched images, the target retouched image is determined among the Q retouched images.

[0136] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.

[0137] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.

[0138] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.

[0139] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image processing model training method or image processing method embodiment and achieve the same technical effect. To avoid repetition, further details are omitted here.

[0140] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0141] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image processing model training method or image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0142] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0143] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the image processing model training method or image processing method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0144] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0146] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for training an image processing model, characterized in that, The image processing model includes a dynamic routing sub-model, M image retouching sub-models, and an image quality assessment sub-model. The method includes: Obtain multiple image sample subsets, wherein each image sample subset includes multiple image sample pairs, and each image sample pair includes a preprocessed image and a target image; For any pair of image samples in any subset of the image samples, the preprocessed image is input into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, and based on the preprocessed image and the N candidate retouching sub-models, the retouched image corresponding to each candidate retouching sub-model is obtained. The preprocessed image, the target image, and N retouched images corresponding to the preprocessed image are respectively input into the image quality assessment sub-model to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results corresponding to the target image. Based on the evaluation results of each retouched image and the evaluation results corresponding to the target image, the evaluation loss is calculated, and the parameters of the image quality evaluation sub-model are updated based on the evaluation loss to obtain the trained image quality evaluation sub-model. Where M ≥ N, and M and N are both positive integers.

2. The method according to claim 1, characterized in that, Before inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the method further includes: For any subset of the image samples, the preprocessed image is input into the image editing sub-model, the image features of the preprocessed image are extracted through the backbone feature extraction layer of the image editing sub-model, and a three-dimensional lookup table is obtained based on the image features of the preprocessed image. The image features of the preprocessed image are input into the adaptive interval module of the retouching sub-model to generate a non-uniform sampling interval. Based on the three-dimensional lookup table and the non-uniform sampling interval, the pixel value of each pixel in the preprocessed image is calculated to obtain the first predicted retouched image. Based on the reconstruction loss of the target image corresponding to the preprocessed image and the first predicted retouching image, the smoothing loss of each color channel value of each pair of pixels in the three-dimensional lookup table, and the monotonicity loss of each color channel value of each pair of pixels in the three-dimensional lookup table, the parameters of the retouching sub-model are updated to obtain the pre-trained retouching sub-model. The three-dimensional lookup table corresponding to each color channel is decomposed into three low-rank components. Based on the three low-rank components and the decomposition rank of each three-dimensional color channel lookup table, the three-dimensional lookup table is updated. The preprocessed image is input into the retouching sub-model that updates the 3D lookup table to obtain the second predicted retouched image; Based on the reconstruction loss of the target image corresponding to the preprocessed image and the second predicted retouched image, the parameters of the pre-trained retouching sub-model are updated to obtain the trained retouching sub-model.

3. The method according to claim 1 or 2, characterized in that, Before inputting the preprocessed image into the dynamic routing sub-model to determine N candidate retouching sub-models from the M retouching sub-models, the method further includes: The multi-color space features of the preprocessed image are input into the dynamic routing sub-model to obtain the prediction parameter difference sequence and prediction activation probability of each image editing sub-model. Based on the cross-entropy loss between the predicted activation probability of each retouching sub-model and the retouching strategy label of the preprocessed image, as well as the parameter prediction loss between the predicted parameter difference sequence and the target parameter difference sequence of each retouching sub-model, the parameters of the dynamic routing sub-model are updated to obtain the pre-trained dynamic routing sub-model. Based on the predicted activation probability, the mean squared error loss of the pixel-level squared error between the retouched image and the target image of each retouching sub-model is weighted and averaged to update the parameters of the pre-trained dynamic routing sub-model to obtain the trained dynamic routing sub-model. The retouched image of each retouching sub-model is the retouched image obtained by inputting the preprocessed image into each of the M retouching sub-models.

4. The method according to claim 1, characterized in that, The process involves calculating an evaluation loss based on the evaluation results of each retouched image and the evaluation result corresponding to the target image, and updating the parameters of the image quality assessment sub-model based on the evaluation loss to obtain the trained image quality assessment sub-model, including: Based on the evaluation loss of each retouched image and the target evaluation result, the evaluation loss of every two retouched images, and the evaluation loss of each retouched image and the target image, the parameters of the image quality evaluation model are updated to obtain the trained image quality evaluation sub-model; wherein, the target evaluation result is the peak signal-to-noise ratio of the retouched image and the target image.

5. The method according to claim 1, characterized in that, The acquisition of multiple image sample subsets includes: Obtain an image sample set, which includes multiple image sample pairs; Based on the target parameter difference sequence of each image sample pair, the image sample pairs in the image sample set are classified to obtain multiple image sample subsets. The target parameter difference sequence is used to characterize the parameter difference between the target image and the preprocessed image. Based on the target parameter difference sequence of image sample pairs within each image sample subset, a retouching strategy corresponding to the image sample subset is generated, and a retouching strategy label is assigned to the corresponding image sample pair.

6. An image processing method, characterized in that, include: The multi-color space features of the image to be processed are input into the dynamic routing sub-model of the image processing model according to any one of claims 1-5, so as to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model; wherein, P≥Q, and P and Q are both positive integers; The image to be processed is input into the Q candidate retouching sub-models respectively to obtain the retouched image corresponding to each candidate retouching sub-model; The image to be processed and Q retouched images are input into the image quality assessment sub-model of the image processing model for retouching evaluation, and the target retouched image among the Q retouched images is determined.

7. The method according to claim 6, characterized in that, The multi-color space features of the image to be processed are input into the dynamic routing sub-model of the image processing model to determine Q candidate retouching sub-models from the P retouching sub-models of the image processing model, including: The multi-color space features of the image to be processed are input into the dynamic routing sub-model to obtain the activation probability corresponding to each image retouching model; The Q retouching sub-models with the highest activation probability among the P retouching sub-models are determined as the Q candidate retouching sub-models.

8. The method according to claim 6, characterized in that, The step of inputting the image to be processed and Q retouched images into the image quality assessment sub-model of the image processing model for retouching evaluation, and determining the target retouched image among the Q retouched images, includes: The image to be processed and Q retouched images are input into the image quality assessment sub-model. The feature extraction layer of the image quality assessment sub-model is used to extract the first image feature of the image to be processed and the second image feature of each retouched image. The first image features are aligned with each of the second image features using the adaptive instance normalization layer of the image quality assessment sub-model, and then the features are fused after alignment to obtain the fused features of each retouched image. Based on the fusion features of the Q retouched images, the retouching evaluation is performed to obtain the evaluation results of the Q retouched images; Based on the evaluation results of the Q retouched images, the target retouched image is determined among the Q retouched images.

9. An image processing model training device, characterized in that, The image processing model includes a dynamic routing sub-model, M image retouching sub-models, and an image quality assessment sub-model; the device includes: An acquisition module is used to acquire multiple image sample subsets, wherein the image sample subsets include multiple image sample pairs, and the image sample pairs include a preprocessed image and a target image; The processing module is used to input the preprocessed image into the dynamic routing sub-model for any pair of image samples in any subset of the image samples, so as to determine N candidate retouching sub-models from the M retouching sub-models, and obtain the retouched image corresponding to each candidate retouching sub-model based on the preprocessed image and the N candidate retouching sub-models. The evaluation module is used to input the preprocessed image, the target image, and N retouched images corresponding to the preprocessed image into the image quality evaluation sub-model, so as to obtain the evaluation results of each retouched image corresponding to the preprocessed image and the evaluation results corresponding to the target image. The parameter update module is used to calculate the evaluation loss based on the evaluation results of each retouched image and the evaluation result corresponding to the target image, and update the parameters of the image quality evaluation sub-model based on the evaluation loss to obtain the trained image quality evaluation sub-model. Where M ≥ N, and M and N are both positive integers.

10. An image processing apparatus, characterized in that, include: The determining module is used to input the multi-color space features of the image to be processed into the dynamic routing sub-model of the image processing model according to claim 9, so as to determine Q candidate retouching sub-models from P retouching sub-models of the image processing model; wherein, P≥Q, and P and Q are both positive integers; The image editing module is used to input the image to be processed into the Q candidate image editing sub-models respectively, and obtain the image editing image corresponding to each candidate image editing sub-model; The determining module is further configured to input the image to be processed and the Q retouched images into the image quality assessment sub-model of the image processing model for retouching evaluation, and determine the target retouched image among the Q retouched images.