An incremental difference-based automatic layer separation method, device and medium

By using the incremental difference algorithm to decompose the AI ​​image processing process into multiple editable layers, the problems of non-editable layers and opaque processing in existing technologies are solved, thereby achieving controllability and adjustability of AI processing results and reducing computational resource consumption.

CN121120866BActive Publication Date: 2026-02-13CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511669388.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-14
Publication Date
2026-02-13
Estimated Expiration
2045-11-14

AI Technical Summary

Technical Problem

Existing AI image processing technologies cannot achieve layer separation, resulting in uneditable output, lack of layer structure, opaque processing, and high computational resource consumption.

Method used

An automatic layer separation method based on incremental difference is adopted. Through layer-aware task decomposition and incremental difference algorithm, the AI ​​image processing process is decomposed into multiple editable layers, an intelligent task decomposition mechanism is established, and editing requirements are automatically identified and optimized operation step sequence is generated.

Benefits of technology

It achieves controllability and adjustability of AI processing results, allowing users to view and modify any layer, reducing computational resource consumption and improving editing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120866B_ABST
    Figure CN121120866B_ABST
Patent Text Reader

Abstract

The application provides a kind of layer automatic separation method, device and medium based on incremental difference, method includes: in response to obtaining image editing request, according to image editing request and corresponding source image, layer perception task decomposition is carried out, image processing task parameter is determined, image processing task parameter includes task complexity and operation step sequence;According to image processing task parameter, corresponding AI model is called to carry out image processing, and the image processing result of each step is obtained;According to the image processing result of each step, difference layer extraction is carried out by incremental difference extraction algorithm, and the layer information corresponding to the image processing result of each step is obtained;The image processing result of each step is saved as editable layer format file, and layer stack is obtained, wherein each layer is marked with corresponding layer information.The application realizes the controllability and adjustability of AI processing result, and the user can view and modify any layer.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a layer automatic separation method and device based on incremental difference and medium. BACKGROUND

[0002] With the rapid development of Artificial Intelligence (AI) technology in the field of image processing, current AI image editing tools can already generate high-quality images according to text descriptions.

[0003] However, the existing AI image processing technology has significant limitations, such as non-editable output, lack of layer structure, etc.

[0004] Therefore, how to realize layer separation in the image editing process has become a problem to be solved. SUMMARY

[0005] The technical problem to be solved by the present application is to solve the above-mentioned problems of the prior art, and to provide a layer automatic separation method and device based on incremental difference and medium to solve the problems existing in the prior art.

[0006] In a first aspect, the present application provides a layer automatic separation method based on incremental difference, which comprises:

[0007] S1, in response to obtaining an image editing request, performing layer-aware task decomposition according to the image editing request and the corresponding source image, determining image processing task parameters, the image processing task parameters including task complexity and operation step sequence;

[0008] S2, according to the image processing task parameters, calling the corresponding AI model to process the image, obtaining the image processing result of each step;

[0009] S3, according to the image processing result of each step, performing difference layer extraction through incremental difference extraction algorithm, obtaining the layer information corresponding to the image processing result of each step;

[0010] S4, saving each step of the image processing result as an editable layer format file to obtain a layer stack, wherein each layer is marked with corresponding layer information.

[0011] In some embodiments, S1 comprises:

[0012] S11, performing feature extraction on the source image to obtain image features, and performing natural language processing on the image editing request to obtain text key information, the text key information including operation type;

[0013] S12, complexity evaluation is performed according to the image features and the text key information, and task complexity is obtained;

[0014] S13, initial operation step sequence is determined according to the text key information and the task complexity;

[0015] S14, layer type pre-judgment is performed on each step in the initial operation step sequence, and corresponding layer-friendly prompt words are obtained according to the layer type pre-judgment result of each step, the layer-friendly prompt words are used to constrain the processing process and output result of the AI model;

[0016] S15, friendliness score is performed on each step, and friendliness level of the corresponding step is determined according to the score result, the friendliness level is used to determine whether the step needs to be optimized or split;

[0017] S16, step reservation, optimization or splitting processing is performed according to the friendliness level of each step, and the final operation step sequence is obtained.

[0018] In some embodiments, in S11, the image features include at least one of a visual feature vector, a color histogram, color distribution statistics of an HSV color space, an edge density map, and a subject region mask;

[0019] The text key information includes operation type, target object, source attribute, and target attribute.

[0020] In some embodiments, S12 includes:

[0021] S121, color conversion complexity, texture reservation complexity, and semantic understanding complexity are respectively calculated according to the image features and the text key information;

[0022] S122, task complexity is determined based on the color conversion complexity, the texture reservation complexity, and the semantic understanding complexity.

[0023] In some embodiments, S121 includes:

[0024] Color range span, color distribution entropy, and color conflict degree are calculated according to the color histogram and the color distribution statistics of the HSV color space in the image features, and the source attribute and the target attribute in the text key information, and color conversion complexity CTC is obtained by weighted summation based on the color range span, the color distribution entropy, and the color conflict degree;

[0025] An edge density is calculated according to an edge density map in the image feature, a texture detail complexity is obtained by performing a gray level co-occurrence matrix analysis on the source image, a structural integrity requirement is calculated according to a subject region mask in the image feature, and a texture preservation complexity TPC is obtained by weighted summation based on the edge density, the texture detail complexity and the structural integrity requirement;

[0026] The image editing request and the source image are input to extract a semantic embedding vector and calculate a semantic gap based on a pre-trained CLIP model of a contrastive text-image pair, a context dependency degree of a target object and a surrounding environment is calculated using a semantic segmentation model, an object complexity is calculated according to the subject region mask, and a semantic understanding complexity SUC is obtained by weighted summation based on the semantic gap, the context dependency degree and the object complexity.

[0027] In some embodiments, S122 comprises:

[0028] Adaptive weights of the color conversion complexity CTC, the texture preservation complexity TPC and the semantic understanding complexity SUC are determined according to an operation type in the textual key information;

[0029] A complexity interaction factor among the color conversion complexity CTC, the texture preservation complexity TPC and the semantic understanding complexity SUC is calculated;

[0030] A task complexity is calculated according to the color conversion complexity CTC, the texture preservation complexity TPC, the semantic understanding complexity SUC, the adaptive weights and the complexity interaction factor.

[0031] In some embodiments, in S14, a layer type pre-judgment is performed on each step in the initial operation step sequence, comprising:

[0032] Step features of each step are extracted respectively, the step features comprising an operation type feature, an influence dimension feature, an action range feature and a data change feature;

[0033] The layer type pre-judgment is performed based on a decision tree according to the step features of each step, comprising:

[0034] A range of editable parameters of the layer is predicted;

[0035] A blending mode of the layer is predicted;

[0036] A dependency relationship of the layer is predicted;

[0037] A visual impact area of the layer is predicted;

[0038] An editing priority of the layer is evaluated.

[0039] In some embodiments, in S14, the corresponding layer-friendly prompt word is obtained according to the layer type prediction result of each step, including:

[0040] According to the layer type prediction result of each step, an operation constraint description is constructed, including an action range constraint, a reserved content constraint, and a parameterization constraint;

[0041] According to the operation constraint description, the corresponding layer-friendly prompt word is obtained by querying the prompt word template, and the layer-friendly prompt word is used to constrain the action range, the reserved content, the parameterization method, and the output format.

[0042] In some embodiments, S15 includes:

[0043] S151, according to the operation locality, the parameterization degree, and the separability of the step, a friendliness score of each step is obtained, and a score result of each step is obtained;

[0044] S152, according to the size relationship between the score result and the friendliness level determination threshold, the friendliness level of the corresponding step is determined.

[0045] In some embodiments, S151 includes:

[0046] According to the action area proportion of the step, an operation locality score of the step is determined, and the operation locality score is inversely proportional to the action area proportion;

[0047] According to the number of adjustable parameters of the step, a parameterization degree score of the step is determined, and the parameterization degree score is proportional to the number of adjustable parameters;

[0048] According to the independence of the step relative to other steps, a separability score of the step is determined, and the separability score is proportional to the independence of the step relative to other steps;

[0049] According to the operation locality score, the parameterization degree score, and the separability score of each step, a weighted sum is performed to obtain a score result of each step.

[0050] In some embodiments, S152 includes:

[0051] If the score result is greater than or equal to a first preset threshold, it is determined that the corresponding friendliness level is high friendliness, and the high friendliness represents that the step is reserved;

[0052] If the score result is greater than or equal to a second preset threshold and less than the first preset threshold, it is determined that the corresponding friendliness level is medium friendliness, the medium friendliness represents that the step is optimized, and the second preset threshold is less than the first preset threshold;

[0053] If the score result is less than a second preset threshold, it is determined that the corresponding friendliness level is low friendliness, and the low friendliness represents that the step is split.

[0054] In some embodiments, S3, comprising:

[0055] S31, determining a corresponding reference image according to an image processing result of each step;

[0056] S32, performing three-domain difference analysis according to the image processing result of each step and the corresponding reference image to obtain a three-domain analysis result, wherein the three-domain difference analysis includes pixel domain difference analysis, frequency domain difference calculation, and semantic domain difference calculation;

[0057] S33, determining a final layer type of the image processing result of each step based on the three-domain analysis result, and the layer information includes the three-domain analysis result and the final layer type.

[0058] In some embodiments, in S32, the pixel domain difference analysis includes:

[0059] performing pixel-by-pixel difference calculation on the image processing result of each step and the corresponding reference image to obtain a pixel difference map of each color channel;

[0060] calculating a difference amplitude on the pixel difference map, and generating a change mask according to a preset amplitude threshold, the change mask identifying a pixel region where a significant change occurs;

[0061] based on the pixel difference map and the change mask, calculating a pixel domain statistical feature, the pixel domain statistical feature including a difference mean, a difference standard deviation, and a maximum difference value, for quantifying the change intensity and distribution range at the pixel level.

[0062] In some embodiments, in S32, the frequency domain difference calculation includes:

[0063] performing two-dimensional fast Fourier transform on each color channel of the image processing result of each step and the corresponding reference image respectively to obtain a frequency domain representation;

[0064] calculating an amplitude spectrum difference of the two frequency domain representations, and separating the amplitude spectrum difference into high-frequency changes and low-frequency changes according to the size of the frequency components, wherein the high-frequency changes correspond to changes in texture and edge details, and the low-frequency changes correspond to changes in overall tone and brightness;

[0065] generating a frequency mask according to the distribution characteristics of the high-frequency changes and the low-frequency changes, the frequency mask being used to distinguish the change types in different frequency ranges.

[0066] In some embodiments, in S32, the semantic domain difference calculation includes:

[0067] using a pre-trained semantic segmentation model to perform semantic feature extraction on the image processing result of each step and the corresponding reference image, to obtain the semantic category and semantic feature vector of each pixel;

[0068] comparing the semantic category distribution of the two images to determine the pixel region where the semantic category change occurs;

[0069] calculating the difference of the semantic feature vectors to obtain the change intensity at the semantic level;

[0070] using a CLIP model to extract image semantic embedding vectors of the image processing result of each step and the corresponding reference image respectively, calculating the similarity between the two embedding vectors to obtain a high-level semantic change index, the high-level semantic change index being used to evaluate the degree of change of the overall semantic content of the image.

[0071] In a second aspect, the present application provides a device for automatically separating layers based on incremental difference, comprising:

[0072] a task decomposition module configured to, in response to obtaining an image editing request, perform layer-aware task decomposition according to the image editing request and the corresponding source image, and determine image processing task parameters, the image processing task parameters including task complexity and operation step sequence;

[0073] an image processing module configured to, according to the image processing task parameters, call a corresponding AI model to perform image processing, and obtain the image processing result of each step;

[0074] an incremental difference module configured to, according to the image processing result of each step, perform difference layer extraction through an incremental difference extraction algorithm, and obtain the layer information corresponding to the image processing result of each step;

[0075] a result saving module configured to save the image processing result of each step as an editable layer format file, and obtain a layer stack, wherein each layer is marked with corresponding layer information.

[0076] In a third aspect, the present application provides a device for automatically separating layers based on incremental difference, comprising a memory and a processor, the memory storing a computer program, and the processor being configured to run the computer program to implement the method for automatically separating layers based on incremental difference of the first aspect.

[0077] In a fourth aspect, the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, and the computer program being executed by a processor to implement the method for automatically separating layers based on incremental difference of the first aspect.

[0078] This application provides an automatic layer separation method, apparatus, and medium based on incremental difference. The method includes: responding to an image editing request, performing layer-aware task decomposition based on the image editing request and the corresponding source image to determine image processing task parameters, including task complexity and a sequence of operation steps; calling a corresponding AI model to perform image processing based on the image processing task parameters to obtain the image processing result of each step; extracting difference layers using an incremental difference extraction algorithm based on the image processing result of each step to obtain layer information corresponding to the image processing result of each step; and saving the image processing result of each step as an editable layer format file to obtain a layer stack, wherein each layer is marked with corresponding layer information. This application provides an automatic layer separation method based on incremental difference, which can automatically decompose the AI ​​image processing process into multiple editable layers, so that each processing step generates an independent layer; this application establishes an intelligent task decomposition mechanism to automatically identify editing needs and generate an optimized sequence of operation steps; in addition, this application uses an incremental difference algorithm to accurately extract the layer data corresponding to each editing operation from continuous AI output. This application achieves controllability and adjustability of AI processing results, allowing users to view and modify any layer without affecting other layers. Attached Figure Description

[0079] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0080] Figure 1 A flowchart illustrating an automatic layer separation method based on incremental difference, provided for an embodiment of this application;

[0081] Figure 2 A flowchart illustrating yet another automatic layer separation method based on incremental difference provided in this application embodiment;

[0082] Figure 3 A flowchart of the incremental differential extraction algorithm provided in the embodiments of this application;

[0083] Figure 4 A schematic diagram of an automatic layer separation device based on incremental difference provided in an embodiment of this application;

[0084] Figure 5 This is a schematic diagram of another automatic layer separation device based on incremental difference provided in an embodiment of this application.

[0085] The specific embodiments of the present application have been shown through the above drawings, and will be described in more detail hereinafter. The drawings and the written description are not intended to limit the scope of the present application in any way, but to explain the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0086] In order for those skilled in the art to better understand the technical solutions of the present application, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0087] It can be understood that the specific embodiments and drawings described herein are only used to explain the present application, but not to limit the present application.

[0088] It can be understood that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0089] It can be understood that, for the convenience of description, only parts related to the present application are shown in the drawings of the present application, and parts unrelated to the present application are not shown in the drawings.

[0090] It can be understood that each unit and module involved in the embodiments of the present application can only correspond to one entity structure, or can be composed of multiple entity structures, or multiple units and modules can be integrated into one entity structure.

[0091] It can be understood that the terms "first", "second" and the like in the embodiments of the present application are used to distinguish different objects, or to distinguish different treatments of the same object, but not to describe a specific order of the object.

[0092] It can be understood that the functions and steps marked in the flowcharts and block diagrams of the present application can occur in an order different from that marked in the drawings without conflict.

[0093] It can be understood that in the flowcharts and block diagrams of the present application, the system, device, equipment, method according to the embodiments of the present application are shown as possible implementation architecture, function and operation. Each block in the flowchart or block diagram can represent a unit, module, program segment, code, which contains executable instructions for realizing the specified function. Moreover, each block or combination of blocks in the block diagram and flowchart can be realized by a hardware-based system for realizing the specified function, or by a combination of hardware and computer instructions.

[0094] It can be understood that the units and modules involved in the embodiments of the present application can be realized in the form of software or hardware, for example, the units and modules can be located in a processor.

[0095] It can be understood that the specific values of the parameters in the present application are only exemplary, and in actual application, parameter optimization adjustment processing can be performed based on specific requirements.

[0096] Currently, image editing schemes mainly include the following:

[0097] 1. Traditional image editing software (such as Photoshop): adopts manual layer editing method, users need to manually create each layer and perform operations such as selection, masking, and color adjustment. Although complete layer management functions are provided, the operation is complex, time-consuming, and requires high professional skills.

[0098] 2. Existing AI image processing scheme (such as nano-banana model): input source image and text instructions, directly output final processing result. For example, input "change black clothes to white", the AI model will output a finished picture of white clothes. Although this method is simple to operate, it outputs a single flat image and lacks intermediate editing states.

[0099] 3. Semi-automatic image processing tools: some tools provide batch processing functions, but still require manual presetting of processing parameters and cannot intelligently decompose complex editing tasks into independent layer operations.

[0100] After research, the main shortcomings of the prior art are:

[0101] 1. Output non-editability: the existing AI model outputs the final synthesized image, and users cannot independently adjust each link in the processing process. If modification is required, the entire image must be regenerated.

[0102] 2. Lack of layer structure: AI processing results lack the layer information required for professional image editing, and cannot meet the needs of designers for fine control.

[0103] 3. Processing process is not transparent: the AI model runs in a "black box" manner, and users cannot understand and control the intermediate processing steps.

[0104] 4. Low efficiency of repetitive work: for batch similar tasks (such as multi-color version display of e-commerce products), the complete processing process needs to be repeatedly executed, and the intermediate results cannot be reused.

[0105] 5. Consumes a large amount of computing resources: each new dialogue or new prompt word sent by the user requires the large model to be recalculated, which also consumes a large amount of computing resources.

[0106] Based on the above shortcomings, the application provides an automatic layer separation method based on incremental difference, which can automatically decompose the AI image processing process into multiple editable layers. In addition, an intelligent task decomposition mechanism is established to automatically identify editing requirements and generate optimized operation step sequences. Furthermore, through the incremental difference algorithm, the layer data corresponding to each editing operation is accurately extracted from the continuous AI output. The application enables each processing step to generate an independent layer, achieving controllability and adjustability of AI processing results. Users can view and modify any layer without affecting other layers.

[0107] The technical solutions of the application and how the technical solutions solve the above technical problems will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes may not be described again in some examples. The embodiments of the application will be described below with reference to the accompanying drawings.

[0108] The application provides an automatic layer separation method based on incremental difference. The working process of the method can be realized by electronic devices such as computers, handheld smart terminals, etc. For ease of explanation, the method execution subject in the embodiments of the application is a computer.

[0109] Figure 1 A schematic diagram of the automatic layer separation method based on incremental difference provided by the embodiments of the application is shown in Figure 2 Another schematic diagram of the automatic layer separation method based on incremental difference provided by the embodiments of the application is shown in Figure 1 and Figure 2 As shown in the above two figures, the application provides an automatic layer separation method based on incremental difference, which includes steps S1-S4, specifically as follows:

[0110] S1, in response to obtaining an image editing request, performing layer-aware task decomposition according to the image editing request and the corresponding source image, determining image processing task parameters, the image processing task parameters including task complexity and operation step sequence;

[0111] Wherein, the image editing request is a text processing request user_request from the user, indicating what processing needs to be performed on the source image source_image. The image editing request is, for example, "change the black clothes in the picture to white", and the source image format is an RGB image matrix with a size of WxHx3.

[0112] In this step, a class named TaskAnalyzerAgent is defined, which is a task analysis agent specially used for analyzing image editing related user requests and converting them into structured task processing steps.

[0113] The design idea of this step is to convert the user's natural language request into a structured task flow that can be understood by machines. It is suitable for image editing applications and serves as a bridge between user requirements and actual processing. Through this analysis, the image processing process can be more accurate and systematic.

[0114] S2, according to the image processing task parameters, calling the corresponding AI model for image processing, getting the image processing result of each step;

[0115] In this step, a class named AIExecutor is defined, which has the core function of calling AI models to process images according to the preset step sequence, realizing the generation process from the source image to the final result. The processing process of AIExecutor includes:

[0116] (1) Initialization: Create two lists results and context, where results is used to store the processing result of each step, and context is used to save the context information in the processing process.

[0117] (2) Step-by-step processing: Loop through each step in the step list, use the source image (source_image) as input in the first step, and use the output of the previous step as input in the subsequent steps. In addition, according to the prompt corresponding to each step, the operation that the AI model needs to perform is constrained.

[0118] (3) Call AI model: Call the AI model (such as nano-banana model) through the self.ai_model.process method, input the input image, prompt and context information of the current step to the AI model.

[0119] (4) Record results: Store the processing result of each step (including step ID, input, output and operation type) in the results list, and add the output of the current step to the context for reference by subsequent steps.

[0120] (5) Return results: Finally return the results list containing all step processing information, recorded as step_results.

[0121] In this step, the role of AIExecutor is to convert the previously analyzed step-by-step operations (such as the steps obtained from TaskAnalyzerAgent) into actual image processing procedures, by calling AI models step by step, and finally completing the image editing task requested by the user. This step-by-step execution method can make the complex image processing process more controllable, and also facilitate the tracking and adjustment of the effect of each step.

[0122] S3、According to the image processing result of each step, the difference layer extraction is performed through the incremental difference extraction algorithm, and the layer information corresponding to the image processing result of each step is obtained;

[0123] In this step, a class named IncrementalDiffExtractor is defined, and its core function is to extract the incremental difference layer from the step-by-step processed image results, similar to the adjustment layer in image editing software (such as Photoshop), which records the specific changes brought by each operation.

[0124] This step uses the core method extract_layers, which specifically includes:

[0125] (1) Receive two parameters: step_results (step-by-step processing result list) and source_image (source image);

[0126] (2) Traverse each processing result, and extract the difference layer by comparing the current step output with the reference image (previous step result or source image);

[0127] (3) Collect all step difference layers into the layers list and return.

[0128] In this step, the key method intelligent_diff_extraction for intelligent difference extraction is implemented, which is responsible for intelligently extracting the differences between two images (current result and reference image) and generating the corresponding adjustment layer, which specifically includes:

[0129] (1) Multi-domain difference analysis: analyze the difference from three dimensions:

[0130] Pixel domain difference (directly compare pixel value changes);

[0131] Frequency domain difference (analyze the changes of different frequency components in the image);

[0132] Semantic segmentation difference (analyze the changed area from the content semantic angle).

[0133] (2) Intelligent layer type determination: generate different adjustment layers according to the operation type:

[0134] Color Mapping operation (COLOR_MAPPING) -> Generate HSL adjustment layers (Hue / Saturation / Lightness adjustment);

[0135] Highlight reconstruction or shadow adjustment -> Generate curve adjustment layers;

[0136] Other operations -> Generate pixel layers (directly record pixel changes).

[0137] (3) Generate layer attributes: determine the blending mode (such as COLOR, OVERLAY, etc.), opacity and mask (based on semantic differences) for each layer.

[0138] In this step, the role of IncrementalDiffExtractor is to convert each step of AI processing into an interpretable and editable layer form, just like the layer editing function in professional image editing software. This makes the entire image processing process more transparent and facilitates subsequent adjustments and modifications of specific steps without having to run the entire process again.

[0139] For example, in the case of "black clothes changed to white", it can extract the difference layers corresponding to each operation step such as "subject extraction", "color mapping", "highlight reconstruction", etc., clearly showing which parts of the image are changed at each step.

[0140] Figure 3 The flowchart of the incremental difference extraction algorithm provided by the embodiments of the present application is shown in Figure 3 , wherein, is the source image, is the output image of each step, is the incremental difference result, and the following is a specific working principle description:

[0141] Input sequence: from receiving the source image , a series of output images after N AI processing steps are obtained .

[0142] Difference calculation: the core innovation point is not to simply calculate the difference between the final image and the original image, but to calculate the incremental difference between adjacent steps , which can accurately capture the independent contribution of each operation step.

[0143] Three-domain analysis: analyze each difference result in three dimensions:

[0144] Pixel domain: analyze the changes of RGB values, brightness, and color;

[0145] Frequency domain: identify changes in texture and details through FFT transformation;

[0146] Semantic domain: Understand the operation type and editing intent.

[0147] Intelligent decision: Based on the three-domain analysis results, intelligently determine the type of layer to generate (adjustment layer or pixel layer) and its parameters.

[0148] S4, save the image processing results of each step as editable layer format files to obtain a layer stack, where each layer is marked with corresponding layer information.

[0149] In this step, the final output contains a stack structure of multiple independent editable layers, each with specific blending mode and opacity settings, and marked with corresponding layer information.

[0150] In this step, a class named LayerManager is defined, which manages and processes the difference layers extracted earlier, and finally generates a savable professional image file (such as PSD format) and verifies whether the result meets the original requirements.

[0151] The role of LayerManager is to convert the layer information processed and extracted in previous steps into a format that can be recognized by professional image editing software (such as Photoshop), while ensuring that the final result meets user requirements. By saving as PSD format, users can further adjust the parameters of each layer (such as opacity, blending mode, etc.) in image editing software to achieve more flexible post-editing.

[0152] For example, in the case of "black T-shirt changed to white", it will organize all the layers corresponding to the processing steps into a complete PSD file, and users can directly open and modify the effect of a certain step (such as adjusting the opacity of the shadow) in Photoshop.

[0153] The present application provides an automatic layer separation method based on incremental difference, which can automatically decompose the AI image processing process into multiple editable layers, making each processing step generate an independent layer. The present application establishes an intelligent task decomposition mechanism, automatically identifies editing requirements and generates an optimized operation step sequence. In addition, the present application uses an incremental difference algorithm to accurately extract layer data corresponding to each editing operation from continuous AI output. The present application realizes the controllability and adjustability of AI processing results, and users can view and modify any layer without affecting other layers.

[0154] In some embodiments, S1, including S11-S16, is as follows:

[0155] S11, performing feature extraction on the source image to obtain image features, and performing natural language processing on the image editing request to obtain textual key information, the textual key information including an operation type;

[0156] In some embodiments, in S11, the image features include at least one of a visual feature vector, a color histogram, color distribution statistics in an HSV (Hue, Saturation, Value) color space, an edge density map, and a subject region mask;

[0157] Optionally, each of the image features described above can be obtained through feature extraction in the following manner:

[0158] a) using a pre-trained convolutional neural network (such as ResNet-50) to extract a visual feature vector V_visual with a dimension of 2048;

[0159] b) calculating a color histogram H_color of the image to statistically analyze color distribution in the HSV color space;

[0160] c) using an edge detection algorithm (such as the Canny operator) to generate an edge density map E_edge;

[0161] d) using a semantic segmentation model (such as DeepLabV3) to generate a subject region mask M_subject.

[0162] In the present application, the functions of each of the image features described above are as follows:

[0163] (1) Visual feature vector: used for complexity evaluation (judging overall image complexity) in step S12;

[0164] (2) Color histogram and HSV color distribution: used for calculating color conversion complexity in step S12;

[0165] (3) Edge density map: used for calculating texture preservation complexity in step S12;

[0166] (4) Subject region mask: used for calculating semantic understanding complexity in step S12, and for pre-judging the layer type (determining the range of action) in step S14.

[0167] In some embodiments, in S11, the textual key information includes an operation type, a target object, a source attribute, and a target attribute.

[0168] Specifically, the pre-trained BERT model (Bidirectional Encoder Representations from Transformers, a pre-trained language model based on the Transformer architecture) is used to encode the image editing request user_request into a semantic vector V_text with a dimension of 768. Then, key information is extracted through named entity recognition (NER), such as:

[0169] Target object: entity_object = "T-shirt";

[0170] Operation type: operation_type = "color transformation";

[0171] Source attribute: source_attr = "black";

[0172] Target attribute: target_attr = "white".

[0173] S12, complexity evaluation is performed according to the image features and the textual key information, and the task complexity is obtained;

[0174] In some embodiments, S12 includes:

[0175] S121, color conversion complexity, texture preservation complexity, and semantic understanding complexity are calculated according to the image features and the textual key information, respectively;

[0176] S122, the task complexity is determined based on the color conversion complexity, the texture preservation complexity, and the semantic understanding complexity.

[0177] In some embodiments, S121 includes:

[0178] According to the color histogram in the image features and the color distribution statistics of the HSV color space, and the source attribute and the target attribute in the textual key information, the color range span, the color distribution entropy, and the color conflict degree are calculated. Based on the color range span, the color distribution entropy, and the color conflict degree, the color conversion complexity CTC (Color Transformation Complexity) is obtained by weighted summation.

[0179] According to the edge density in the image features, edge density is calculated, gray level co-occurrence matrix analysis is performed on the source image to obtain texture detail complexity, structure integrity requirement is calculated according to the main body area mask in the image features, and based on the edge density, texture detail complexity and structure integrity requirement, texture preservation complexity TPC is obtained by weighted summation;

[0180] The image editing request and the source image are input into a CLIP model (Contrastive Language-Image Pre-training, a pre-training model based on contrastive text-image pairs) to extract semantic embedding vectors and calculate semantic gap, a semantic segmentation model is used to calculate the context dependence degree of the target object and the surrounding environment, object complexity is calculated according to the main body area mask, and based on the semantic gap, context dependence degree and object complexity, semantic understanding complexity SUC is obtained by weighted summation.

[0181] In some embodiments, S122 comprises:

[0182] According to the operation type in the text key information, adaptive weights of the color conversion complexity CTC, the texture preservation complexity TPC and the semantic understanding complexity SUC are determined ;

[0183] The complexity interaction factor between the color conversion complexity CTC, the texture preservation complexity TPC and the semantic understanding complexity SUC is calculated;

[0184] According to the color conversion complexity CTC, the texture preservation complexity TPC, the semantic understanding complexity SUC, the adaptive weights and the complexity interaction factor, the task complexity is calculated.

[0185] Specifically, the task complexity is calculated by the following formula:

[0186] ;

[0187] Wherein, complexity_total represents the task complexity, complexity_color represents the color conversion complexity, complexity_texture represents the texture preservation complexity, complexity_semantic represents the semantic understanding complexity, and interaction_factor represents the complexity interaction factor.

[0188] where the complexity interaction factor interaction_factor is determined by the following factors:

[0189] (1) Color and texture interaction:

[0190] There may be some interaction between color and texture, especially in image editing and image generation, color changes may affect the texture performance, and vice versa. Therefore, the interaction between color and texture can be determined by calculating the similarity or difference between color and texture. The value of the interaction factor can be defined as:

[0191] ;

[0192] where α is the adjustment coefficient, representing the strength of the interaction between color and texture.

[0193] (2) Texture and semantic interaction:

[0194] The influence of semantic information (such as target objects, background areas) on texture is also an important factor. For different objects in the image, the texture features may change according to the semantic context. The definition of the interaction factor can be:

[0195] ;

[0196] where β is the adjustment coefficient, representing the strength of the interaction between texture and semantics.

[0197] (3) Color and semantic interaction:

[0198] The relationship between color and semantics is also very important, especially in image content recognition and editing. Different colors have different effects in different semantic backgrounds. The definition of the interaction factor can be:

[0199] ;

[0200] where γ is the adjustment coefficient, representing the strength of the interaction between color and semantics.

[0201] Final interaction factor calculation:

[0202] To get the comprehensive interaction factor interaction_factor, the three interaction factors mentioned above can be weighted and averaged:

[0203] ;

[0204] wherein λ1, λ2, λ3\lambda_1, \lambda_2, \lambda_3λ1,λ2,λ3 are adjustment coefficients for controlling the weight of each interaction factor in the total interaction factor.

[0205] In this application, color, texture and semantic complexity respectively represent color complexity, texture complexity and semantic complexity in the image, which are usually obtained by analyzing the pixel distribution, texture atlas and semantic segmentation result of the image. The interaction factor reflects the mutual influence between different complexities, and the contribution of each complexity is adjusted by weighting, so as to enhance the calculation result of the comprehensive complexity.

[0206] After obtaining the task complexity, the complexity level is determined, for example:

[0207] If the task complexity is less than a first complexity threshold (for example, 0.3), it is determined that the complexity level is "simple";

[0208] If the task complexity is greater than or equal to the first complexity threshold (for example, 0.3) and less than a second complexity threshold (for example, 0.7), it is determined that the complexity level is "medium", wherein the first complexity threshold is less than the second complexity threshold;

[0209] If the task complexity is greater than or equal to the second complexity threshold (for example, 0.7), it is determined that the complexity level is "complex".

[0210] The difference between the complexity evaluation method of the present application and the traditional image complexity evaluation method is that the traditional method evaluates the image processing difficulty and focuses on the characteristics of the image itself; the method of the present application evaluates the layer separation friendliness and focuses on the influence of editing operation on the layer structure, which is specifically reflected in:

[0211] (1) Color conflict degree is introduced to evaluate the adverse effect of color conversion on non-target area;

[0212] (2) Structural integrity requirement is introduced to evaluate the difficulty of maintaining the original structure during editing;

[0213] (3) Context dependence degree is introduced to evaluate the influence of the semantic association between the object and the background on layer separation;

[0214] (4) Complexity interaction factor is introduced to quantify the nonlinear superposition effect of multi-dimensional complexity;

[0215] (5) The weight is adaptively adjusted according to the task type.

[0216] S13, determining an initial operation step sequence according to the text key information and the task complexity;

[0217] The number of steps included in the initial operation step sequence is proportional to the task complexity, for example, if the task complexity level is simple, the first number (e.g. 3-4) of steps are corresponding, if the task complexity level is medium, the second number (e.g. 5-7) of steps are corresponding, and if the task complexity level is complex, the third number (e.g. 8-10) of steps are corresponding.

[0218] Specifically, according to the operation type and the task complexity in the text key information, a matched initial operation step sequence preliminary_steps is retrieved from a predefined operation template library.

[0219] For example, for the "color transformation" type and the task complexity of 0.85 (corresponding to the complex level), the retrieved basic step sequence is as follows: ["subject extraction", "texture analysis", "color mapping", "highlight reconstruction", "shadow adjustment", "detail enhancement", "ambient light adaptation"], a total of 7 steps.

[0220] In addition, after retrieving the basic step sequence, a step ID and an operation description are assigned to each basic step in the basic step sequence.

[0221] S14, layer type pre-judgment is performed on each step in the initial operation step sequence, and a corresponding layer-friendly prompt word is obtained according to the layer type pre-judgment result of each step, the layer-friendly prompt word is used to constrain the processing process and the output result of the AI model;

[0222] In this application, the role of the layer-friendly prompt word is as follows:

[0223] (1) Constrain the output of the AI model: ensure that the generated image processing result is convenient for subsequent layer separation;

[0224] (2) Guide the processing range: limit the operation area of AI through range constraint and content reservation constraint;

[0225] (3) Ensure parameterized output: require the AI to output adjustable parameters intermediate results, rather than completely fused final images;

[0226] (4) Optimize layer quality: make the changes produced by each step more easily extracted as independent layers by the difference algorithm.

[0227] In some embodiments, in S14, the layer type pre-judgment is performed on each step in the initial operation step sequence, including:

[0228] Respectively extract the step features of each step, the step features including operation type features, impact dimension features, range of action features, data change features;

[0229] According to the step features of each step, the layer type is pre-judged based on a decision tree, including:

[0230] predicting an editable parameter range of the layer;

[0231] predicting a blending mode of the layer;

[0232] predicting a dependency relationship of the layer;

[0233] predicting a visual impact area of the layer;

[0234] evaluating an editing priority of the layer.

[0235] Specifically, when the layer type is pre-judged, first, for each step in the initial operation step sequence, the following pre-judgment process is performed:

[0236] (1) extracting step features, including: operation type features, impact dimension features, action range features, and data change features;

[0237] (2) pre-judging the layer type based on a decision tree, and the pre-judgment is predicted_layer_type = "HSL_ADJUSTMENT";

[0238] a) predicting an editable parameter range of the layer: based on predicted_layer_type = "HSL_ADJUSTMENT", querying a parameter definition library;

[0239] b) predicting a blending mode of the layer: based on the layer type and the operation intention, predicting the best blending mode;

[0240] c) predicting a dependency relationship of the layer: analyzing the action range;

[0241] d) predicting a visual impact area of the layer: based on the dependent mask layer, predicting the affected pixel area: calculating the area ratio of the impact area;

[0242] e) evaluating an editing priority of the layer: user attention score; parameter sensitivity score; visual saliency score.

[0243] In the present application, the roles of the above-mentioned prediction results are as follows:

[0244] (1) editable parameter range: used in step S14 to generate "parameterization constraints" in layer-friendly prompt words;

[0245] (2) blending mode: used to set the correct layer blending mode (such as normal, overlay, color, etc.) when saving the layer in step S4;

[0246] (3) dependency relationship: used to determine the sequence when the step is split in step S16;

[0247] (4) Visual impact area: "Action range constraint" in the generated prompt word in step S14;

[0248] (5) Editing priority: friendliness score for step S15, high priority operation needs more independent layers.

[0249] In some embodiments, in S14, according to the predicted result of the layer type of each step, the corresponding layer-friendly prompt word is obtained, including:

[0250] According to the predicted result of the layer type of each step, an operation constraint description is constructed, including action range constraint, reserved content constraint, and parameterization constraint;

[0251] According to the operation constraint description, the corresponding layer-friendly prompt word is obtained by querying the prompt word template, and the layer-friendly prompt word is used to constrain the action range, the reserved content, the parameterization method, and the output format.

[0252] Specifically, when generating the layer-friendly prompt word, the operation constraint description is constructed first, specifically including the action range constraint, the reserved content constraint, and the parameterization constraint; then, the prompt word template library is queried, the corresponding template is searched according to predicted_layer_type= "HSL_ADJUSTMENT", template variable filling is performed, and the final layer-friendly prompt word is generated. The layer-friendly prompt word is used to realize the following functions:

[0253] (1) Clearly define the action range ("ONLY to subject region");

[0254] (2) Specify the reserved content ("Preserve texture details");

[0255] (3) Declare the parameterization method ("HSL transformation with specific parameters");

[0256] (4) Suggest the output format ("suitable for HSL adjustment layer").

[0257] S15, friendliness score for each step, determine the friendliness level of the corresponding step according to the score result, the friendliness level is used to determine whether the step needs to be optimized or split;

[0258] In some embodiments, S15 includes:

[0259] S151, scoring each step according to the operation locality, parameterization degree, and separability of the step, to obtain a score result of each step;

[0260] S152, determining the friendliness level of the corresponding step according to the size relationship between the score result and the friendliness level determination threshold.

[0261] In some embodiments, S151 includes:

[0262] According to the proportion of the action area of the step, determining the operation locality score of the step, the operation locality score being inversely proportional to the proportion of the action area, that is, the smaller the proportion of the action area, the higher the score;

[0263] According to the number of adjustable parameters of the step, determining the parameterization degree score of the step, the parameterization degree score being proportional to the number of adjustable parameters, that is, the more adjustable parameters, the higher the score;

[0264] According to the independence of the step relative to other steps, determining the separability score of the step, the separability score being proportional to the independence of the step relative to other steps, that is, the stronger the independence of the step relative to other steps, the higher the score;

[0265] According to the operation locality score, the parameterization degree score, and the separability score of each step, performing weighted summation to obtain the score result of each step.

[0266] For example, the friendliness score result of each step can be obtained by the following formula:

[0267] ;

[0268] wherein, represents the friendliness score, represents the operation locality score, represents the parameterization degree score, represents the separability score, , , are the weights corresponding to the operation locality score, the parameterization degree score, and the separability score, respectively.

[0269] In some embodiments, S152 includes:

[0270] If the score result is greater than or equal to a first preset threshold, it is determined that the corresponding friendliness level is high friendliness, and the high friendliness represents retaining the step;

[0271] If the score result is greater than or equal to a second preset threshold and less than the first preset threshold, it is determined that the corresponding friendliness level is medium friendliness, the medium friendliness represents optimizing the step, and the second preset threshold is less than the first preset threshold.

[0272] If the score result is less than the second preset threshold, it is determined that the corresponding friendliness level is low friendliness, which represents the step is split.

[0273] For example, the following is an example of friendliness level determination:

[0274] If the friendliness score is greater than or equal to 0.7, it is determined that the corresponding friendliness level is high friendliness, and the step is retained.

[0275] If the friendliness score is greater than or equal to 0.4 and less than 0.7, it is determined that the corresponding friendliness level is medium friendliness, and the step is optimized.

[0276] If the friendliness score is less than 0.4, it is determined that the corresponding friendliness level is low friendliness, and the step is split.

[0277] S16, according to the friendliness level of each step, the step is retained, optimized or split, and the final operation step sequence is obtained.

[0278] Among them, the following splitting strategy is adopted to split the low friendliness step:

[0279] a) Analyze the sub-operations contained in the operation;

[0280] b) Generate an independent step for each sub-operation;

[0281] c) Update the step sequence;

[0282] d) Update the dependency relationship of the subsequent steps.

[0283] Among them, step optimization mainly refers to splitting or improving certain operation steps (especially low friendliness steps) when performing image editing tasks to improve processing efficiency and the editability of results. Step optimization not only focuses on the decomposition of operations, but also focuses on how to adjust the execution order and operation method of each operation. The following is a specific description and example of some optimization strategies:

[0284] Optimization method: parameterized optimization, optimization prompt word, avoid excessive overlapping operation.

[0285] Suppose in the image editing process, there is a step of "adjusting the brightness and contrast of the image", the complexity of this step is low, but its "friendliness level" is low, which means that this operation may affect other parts of the image, making it difficult to adjust other layers independently.

[0286] Example 1: Optimization of brightness and contrast adjustment

[0287] Step analysis:

[0288] Step "Adjust brightness and contrast" involves overall brightness adjustment and contrast enhancement of the image. The operation of this step may have a global impact on the entire image, resulting in the inability to adjust certain areas after editing.

[0289] Sub-operation splitting:

[0290] Split strategy: "Brightness adjustment" and "contrast enhancement" are split into two independent steps.

[0291] Step 1: Perform "local brightness adjustment" - adjust brightness only for a specific area of the image (such as dark parts).

[0292] Step 2: Perform "global contrast enhancement" - adjust contrast for the entire image.

[0293] Optimize step sequence:

[0294] After optimization, the brightness adjustment step and the contrast enhancement step handle different image areas respectively, which can avoid mutual interference when both are in effect. For example, the dark parts of the image can be adjusted in brightness independently, while the enhancement of contrast will only affect the visual effect of the entire image without interfering with brightness adjustment.

[0295] Update the dependency relationship of subsequent steps:

[0296] The optimized operation steps will provide more independence for subsequent processing steps (such as color adjustment, sharpening, etc.). The new step sequence becomes:

[0297] Step 1: Local brightness adjustment;

[0298] Step 2: Global contrast enhancement;

[0299] Step 3: Color balance adjustment (dependent on step 2);

[0300] Step 4: Sharpening (dependent on steps 1 and 2);

[0301] In this way, each step of image editing can be more accurate and flexible, and each layer can be adjusted independently.

[0302] Optionally, for batch tasks, layer reusability analysis is performed, which specifically includes: checking historical task cache, identifying reusable steps, and generating reuse optimization suggestions.

[0303] The present application integrates all pre-judgment information by performing step reservation, optimization or splitting, constructs complete step objects, generates complete output data structures, outputs the final layer-oriented operation step sequence LayerOrientedPlan, and passes it to subsequent steps.

[0304] In this application, the subsequent effects of the operation step sequence LayerOrientedPlan include:

[0305] (1) For in step S2, the AI model performs AI processing according to the operation step sequence, the pre-judged layer attributes, and the layer-friendly prompt words; the AI model knows what type of layer should be generated at each step when performing processing, and can actively optimize the output;

[0306] (2) For in step S3, there is prior knowledge when extracting differential layers through the incremental differential extraction algorithm, knowing what type of layer should be extracted;

[0307] (3) It can be verified whether the actual extraction result meets the pre-judgment, and if not, the correction process is triggered.

[0308] Through the processing flow of S11-S16 contained in step S1 of the present application, the following technical effects are achieved:

[0309] a) Layer planning is completed: the pre-judgment of layer type, parameter, mixing mode and other attributes is completed in task layering, which improves the success rate of subsequent layer extraction compared to the traditional method of "post-extraction".

[0310] b) Active guidance of AI generation: through the generation of layer prompt words, the AI model is actively guided to generate layered output, which improves the editability of the final layer.

[0311] c) Step intelligent optimization: through layer consistency evaluation, the operation steps that are not conducive to layer extraction are automatically identified and split, ensuring that the output of all steps can be converted into independent layers.

[0312] d) Batch task acceleration: through layer reusability analysis, layers that can be reused in batch similar tasks can improve processing efficiency.

[0313] e) User experience improvement: through pre-judged editing priority, the system can prepare the quick editing interface of the layout that is most likely to need adjustment for the user in advance, and the transaction response speed is improved.

[0314] In some embodiments, when performing step S2, the present application adopts a context management mechanism for multi-step AI execution, and through the establishment of an intelligent context management mechanism, feature reuse, constraint submission, and quality tracking are realized in the multi-step AI execution process, thereby improving batch task processing efficiency and realizing the accuracy of the hierarchy, which specifically includes the following steps:

[0315] (1) Initialize the processing context data structure and create a context object, including: historical processing records, feature cache, constraint mapping, quality score records, and reuse management;

[0316] (2) Obtain the data obtained in step S1, including: operating a sequence of steps LayerOrientedPlan and a source image source_image, combining an AI image processing model instance ai_model (such as nano-banana), and extracting key information, including: each operation step steps_sequence = LayerOrientedPlan.steps, and reuse opportunity information reuse_opportunities = LayerOrientedPlan.reuse_opportunities;

[0317] (3) Initialize feature cache: perform one-time feature extraction on the source image and store it in feature_cache, including: extract visual features, extract texture descriptors, generate edge maps, and calculate color statistics;

[0318] (4) Check and load reusable layer cache: query the historical task database and load constraint information (if any);

[0319] (5) Loop to execute AI processing of each step: initialize the execution loop, store the execution result of each step, check if the cache layer can be reused, build the input data of the current step, extract relevant features from the context (to avoid repeated calculation), build enhanced prompt words (integrate context constraints), call the AI model to perform processing, evaluate the output quality, build the step result object, record it to the historical processing record, update the constraint mapping (constraint propagation mechanism), quality check and automatic correction (optional), cache the current step result for reuse (optional), add the result to the output list, and continue the loop to process the next step.

[0320] (6) Generate an execution summary report: statistical execution performance, generate a quality report, generate a constraint satisfaction report, and build the final output.

[0321] In some embodiments, S3 includes:

[0322] S31, determine a corresponding reference image according to the image processing result of each step;

[0323] S32, perform three-domain difference analysis according to the image processing result of each step and the corresponding reference image to obtain a three-domain analysis result, wherein the three-domain difference analysis includes pixel domain difference analysis, frequency domain difference calculation, and semantic domain difference calculation;

[0324] S33, determine a final layer type of the image processing result of each step based on the three-domain analysis result, and the layer information includes the three-domain analysis result and the final layer type.

[0325] In the present application, step S3 accurately extracts the editable layer data corresponding to each editing operation from the continuous AI processing results through three-domain analysis (pixel domain, frequency domain, semantic domain) and intelligent layer type determination. The reference image corresponding to the image processing result of each step is the image processing result of the previous step, and the reference image corresponding to the image processing result of the first step is the source image.

[0326] In some embodiments, in S32, the pixel domain difference analysis includes:

[0327] The pixel-by-pixel difference calculation is performed on the image processing result of each step and the corresponding reference image to obtain a pixel difference map for each color channel.

[0328] The difference amplitude is calculated for the pixel difference map, and a change mask is generated according to a preset amplitude threshold, the change mask identifying the pixel region that has undergone significant changes.

[0329] Based on the pixel difference map and the change mask, a pixel domain statistical feature is calculated, including the difference mean, difference standard deviation, and maximum difference value, which are used to quantify the change intensity and distribution range at the pixel level.

[0330] The calculation formula of the pixel-by-pixel difference is:

[0331] Δ(x,y)=|I_current(x,y)-I_ref(x,y)|;

[0332] Where Iref(x,y)I_{\text{ref}}(x, y)Iref(x,y) can be the pixel value of the previous frame in the image sequence, or the corresponding pixel value of the reference template image; Icurrent(x,y)I_{\text{current}}(x, y)Icurrent(x,y) is the image pixel value of the current frame or the current processing stage.

[0333] The difference Δ(x,y)\Delta(x, y)Δ(x,y) between the two represents the brightness or color change of the pixel before and after processing, and is used to distinguish between static and dynamic regions of the image. By statistically analyzing the difference results of all pixel points, the overall change trend of the image can be obtained, providing initial feature input for subsequent frequency domain difference and semantic difference.

[0334] Where (x,y) represents the spatial coordinates of the pixel in the image, where xxx is the horizontal position index of the pixel, and yyy is the vertical position index of the pixel. Each pixel point can be regarded as a unit position in the two-dimensional matrix of the image.

[0335] Where Icurrent(x, y) represents the pixel value of the current step image at pixel coordinate (x, y), reflecting the brightness or color intensity of the current image at this position.

[0336] If the image is a grayscale image, Icurrent(x, y) represents the grayscale value (usually in the range of 0-255).

[0337] If the image is a color image, it can be represented as component values of multiple channels (such as RGB three-channel color intensity values), at which point the weighted average value can be calculated or taken by channel.

[0338] Where Iref(x, y) represents the pixel value of the reference image at pixel coordinate (x, y), usually the corresponding pixel value of the previous processing step or the original image, serving as a comparison reference. It reflects the brightness or color characteristics of the image in the unchanged state.

[0339] Where Δ(x, y) represents the difference magnitude between the current pixel point in the current image and the reference image, i.e., the pixel-level change amount. Its physical meaning is the absolute change degree of pixel intensity (brightness or color value) between the two image states, and the larger the value, the more significant the pixel change. This difference value can reflect the intensity characteristics of image changes, commonly used in change region detection, hierarchical identification, or layer separation calculations.

[0340] Where the absolute value symbol || represents the absolute value operation of the difference value, used to eliminate the influence of the change direction (lightening or darkening) and only retain the size of the change intensity. Through absolute value operation, the difference value can always be non-negative, thus facilitating subsequent statistical analysis and threshold judgment.

[0341] On this basis, the following pixel domain statistical features can be calculated by counting the difference values of all pixel points:

[0342] Difference mean: reflects the average change amplitude of the entire image, used to evaluate the global change intensity;

[0343] Difference standard deviation: reflects the dispersion degree of the change amplitude, used to describe the uniformity of the change region;

[0344] Maximum difference value: reflects the intensity of the most significant pixel in the image, used to detect local mutations or significant regions.

[0345] In the pixel domain difference analysis, the thresholding method of difference magnitude is to distinguish the significant change region and the background region by comparing the difference magnitude of each pixel using a preset threshold, including the following processing process:

[0346] 1. Calculate the difference magnitude: calculate the pixel-level difference of the image to obtain the difference magnitude map (Δ(x,y)\Delta(x, y)Δ(x,y)) of each pixel, the formula is:

[0347]

[0348] Where IcurrentI_{\text{current}}Icurrent is the current image, IrefI_{\text{ref}}Iref is the reference image.

[0349] 2. Set threshold: select a threshold TTT to distinguish the significant change and the background region. When the difference magnitude Δ(x,y)>T\Delta(x, y) > TΔ(x,y)>T, it is considered that the pixel has a significant change.

[0350] 3. Generate mask: based on the threshold, generate a change mask M(x,y)M(x, y)M(x,y), if Δ(x,y)>T\Delta(x, y) > TΔ(x,y)>T, then M(x,y)=1M(x, y) = 1M(x,y)=1, indicating that the pixel has changed, otherwise M(x,y)=0M(x, y) = 0M(x,y)=0.

[0351] 4. Apply threshold mask: the mask can be used for further image processing, such as extracting the change region and performing subsequent analysis.

[0352] In some embodiments, in S32, the frequency domain difference calculation includes:

[0353] Performing two-dimensional fast Fourier transform on each color channel of the image processing result of each step and the corresponding reference image respectively to obtain a frequency domain representation;

[0354] Calculating the amplitude spectrum difference of the two frequency domain representations, and separating the amplitude spectrum difference into high frequency change and low frequency change according to the size of the frequency component, wherein the high frequency change corresponds to the change of texture and edge details, and the low frequency change corresponds to the change of overall tone and brightness;

[0355] Generating a frequency mask according to the distribution characteristics of the high frequency change and the low frequency change, the frequency mask is used to distinguish the change type of different frequency ranges.

[0356] ​where the two-dimensional fast Fourier transform (2D FFT) is used to analyze the changes in the image from the frequency domain. The specific steps are as follows:

[0357] 1. Calculate 2D FFT: Perform a two-dimensional Fourier transform on each color channel (e.g., RGB) of the image separately. The Fourier transform formula is:

[0358] ;

[0359] where F(u, v) is the frequency domain representation, and I(x, y) is the original image.

[0360] 2. Calculate the amplitude spectrum: Calculate the amplitude spectrum |F(u, v)| of the Fourier transform, which represents the energy intensity of the image at different frequencies.

[0361] Separate high-frequency and low-frequency components: Set a frequency threshold fthreshold and divide the frequency spectrum into high-frequency and low-frequency parts according to the size of the frequency components. High-frequency components correspond to the details and textures of the image, and low-frequency components correspond to the colors and brightness of the image.

[0362] 3. Generate a frequency mask: Based on the separation of high-frequency and low-frequency components, generate a frequency mask for subsequent image processing.

[0363] In this step, the method for determining the separation threshold of high-frequency / low-frequency is based on the energy distribution of the frequency spectrum: by analyzing the energy distribution of the image spectrum, determine the region where most of the energy is concentrated. If the image spectrum is concentrated in the low-frequency part, the threshold can be set to a lower frequency value.

[0364] In this step, the generation rule of the frequency mask is based on the frequency domain difference, and the specific steps are as follows:

[0365] (1) Calculate the frequency difference: Perform a Fourier transform on the image to obtain the amplitude spectrum in the frequency domain, and calculate the difference in the frequency domain between the two images.

[0366] (2) Set a threshold: According to the frequency difference, set a threshold Tfreq, when the frequency difference is greater than the threshold, it is considered that the frequency component has changed significantly.

[0367] (3) Generate a frequency mask: if the frequency difference ΔF(u,v) > Tfreq, then the frequency mask Mfreq(u,v) = 1, indicating that the frequency component needs to be preserved; otherwise, Mfreq(u,v) = 0.

[0368] (4) Apply the frequency mask: use the mask to separate the high-frequency and low-frequency parts of the image, and further perform image editing operations.

[0369] In some embodiments, in S32, the semantic domain difference calculation includes:

[0370] Using a pre-trained semantic segmentation model, the semantic feature of each step of image processing result and the corresponding reference image is extracted, and the semantic category and semantic feature vector of each pixel are obtained;

[0371] Comparing the semantic category distribution of the two images, the pixel area where the semantic category changes is determined;

[0372] Calculate the difference of the semantic feature vector to get the change intensity of the semantic level;

[0373] Using the CLIP model, the image semantic embedding vector of each step of image processing result and the corresponding reference image is extracted, the similarity between the two embedding vectors is calculated, and the high-level semantic change index is obtained. The high-level semantic change index is used to evaluate the change degree of the overall semantic content of the image.

[0374] In some embodiments, in S32, the three-domain analysis results are fused to generate a comprehensive difference mask by performing pixel domain difference analysis, frequency domain difference calculation, and semantic domain difference calculation.

[0375] In some embodiments, S33 includes: according to the pixel domain difference analysis result, the frequency domain difference calculation result, and the semantic domain difference calculation result, performing decision tree determination to determine the final layer type of each step of image processing result.

[0376] For example, the present application includes but is not limited to determining the layer type by the following determination rules:

[0377] If significant changes are detected in the color channel (such as the a, b components of the RGB or Lab space), and the luminance component changes less, then the layer type is determined to be “color adjustment layer”;

[0378] If a significant change in high-frequency components (obtained by frequency domain difference calculation) is detected while the low-frequency components remain basically unchanged, the layer type is determined to be "sharpening / detail enhancement layer";

[0379] If the pixel domain and semantic domain differences simultaneously represent the addition or deletion of local content regions (such as object insertion or removal) in the image, the layer type is determined to be "content change layer".

[0380] For ease of understanding, the following is an application example of the technical solution of the present application, specifically the complete implementation process of changing a black T-shirt to white, as follows:

[0381] 1.1 Initial input

[0382] The input of this embodiment includes:

[0383] Source image: a 2000x2000 pixel photo of the front of a black T-shirt, made of pure black cotton material, with obvious fabric texture and wrinkles;

[0384] User requirements: change the black T-shirt to white, and maintain a natural and realistic effect while preserving the original texture details;

[0385] Output requirements: generate a PSD format file containing multiple editable layers.

[0386] 1.2 Task analysis process (step S1)

[0387] The system first intelligently analyzes the input image and requirements:

[0388] Image feature recognition:

[0389] Main color analysis: the system detects that the main color of the T-shirt is dark black (RGB value is about 20, 20, 20);

[0390] Material identification: cotton fabric features are identified through texture analysis algorithms;

[0391] Complexity evaluation: changing black to white is a high-difficulty task (complexity score 0.85 / 1.0), as it requires reconstructing a large amount of detail information, and a 7-step operation sequence is automatically generated;

[0392] Based on the task complexity, the system automatically generates the following operation steps:

[0393] (1) Main body extraction step: accurately extract the T-shirt contour to generate a main body image with a transparent channel;

[0394] (2) Texture analysis step: analyze and save the fabric texture features to prepare for subsequent processing;

[0395] (3) Color mapping step: Perform intelligent color conversion from black to white;

[0396] (4) High light reconstruction step: Add natural high light effects to white clothes;

[0397] (5) Shadow adjustment step: Recalculate the shadows suitable for white clothes;

[0398] (6) Detail enhancement step: Enhance details such as stitches, buttons, etc.

[0399] (7) Ambient light adaptation step: Add ambient reflections to enhance realism.

[0400] 1.3 AI model execution process (step S2)

[0401] The system inputs the above 7 steps into the AI image processing model (such as nano-banana) in turn, using a multi-round dialogue method:

[0402] (1) First round execution - main body extraction:

[0403] Input: Original black T-shirt picture;

[0404] Instructions: "Extract the main body of the T-shirt, preserve the precise edge details, including the subtle fibers of the fabric edge";

[0405] Output: T-shirt main body image with precise Alpha channel, background transparentized.

[0406] (2) Second round execution - texture analysis:

[0407] Input: Output result of the first round;

[0408] Instructions: "Analyze the texture pattern of cotton fabric, create a texture feature map";

[0409] Output: Enhanced image containing texture information.

[0410] (3) Third round execution - color mapping:

[0411] Input: Output result of the second round;

[0412] Instructions: "Map black to white, use nonlinear conversion to preserve texture details";

[0413] Output: T-shirt image with color converted to white.

[0414] (4) Fourth round execution - high light reconstruction:

[0415] Input: Output result of the third round;

[0416] Instruction: "Add natural highlights suitable for white cotton clothing";

[0417] Output: Image with realistic highlight effects.

[0418] (5) Round 5 Execution - Shadow Adjustment:

[0419] Input: Output from Round 4;

[0420] Instruction: "Adjust shadow density and color to suit white fabric";

[0421] Output: Image with optimized shadows.

[0422] (6) Round 6 Execution - Detail Enhancement:

[0423] Input: Output from Round 5;

[0424] Instruction: "Enhance the detail clarity of stitches, buttons, and labels";

[0425] Output: Image with enhanced details.

[0426] (7) Round 7 Execution - Ambient Light Adaptation:

[0427] Input: Output from Round 6;

[0428] Instruction: "Add reflection effects of studio ambient light";

[0429] Output: Final white T-shirt image.

[0430] 1.4 Incremental Difference Layer Extraction (Step S3)

[0431] The system extracts 7 independent editing layers from the 7 consecutive output results through an incremental difference algorithm:

[0432] (1) Layer 1 - Main Mask Layer:

[0433] Extraction Method: Difference between Step 1 output and original image, extract Alpha channel information;

[0434] Layer Content: Accurate selection mask of T-shirt, edge feathering radius 0.5 pixels;

[0435] Layer Properties: Normal blending mode, opacity 100%;

[0436] Effect: Define editing range, protect background from being affected.

[0437] (2) Layer 2 - Texture Protection Layer:

[0438] Extraction Method: Compare the frequency domain differences between Step 2 and Step 1;

[0439] Layer Content: Feature map of fabric texture, including warp and weft texture patterns;

[0440] Layer Properties: Overlay mode, 100% opacity;

[0441] Action: Ensures that subsequent operations do not destroy the original texture.

[0442] (3) Layer 3 - Color Adjustment Layer:

[0443] Extraction Method: Analyze the color change pattern between Step 3 and Step 2;

[0444] Layer Content: Not pixel data, but hue / saturation / lightness adjustment parameters;

[0445] Hue Shift: 0 degrees (no shift);

[0446] Saturation: -100 (complete desaturation);

[0447] Lightness: +95 (significantly increased);

[0448] Layer Properties: Color blending mode, 100% opacity;

[0449] Action: Achieve black-to-white color conversion.

[0450] (4) Layer 4 - Highlight Enhancement Layer:

[0451] Extraction Method: Identify the newly added highlight area in Step 4;

[0452] Layer Content: Curve adjustment data, focusing on enhancing bright areas;

[0453] Layer Properties: Overlay blending mode, 80% opacity;

[0454] Action: Make white clothes have a natural luster.

[0455] (5) Layer 5 - Shadow Adjustment Layer:

[0456] Extraction Method: Compare the dark changes between Step 5 and Step 4;

[0457] Layer Content: New shadow distribution map, including wrinkle shadows;

[0458] Layer Properties: Positive film under mode, 65% opacity;

[0459] Action: Provide soft shadows suitable for white clothes.

[0460] (6) Layer 6 - Detail Sharpening Layer:

[0461] Extraction method: Extract the enhanced high-frequency details in Step 6;

[0462] Layer content: Sharpening information of details such as stitches, buttons, etc.

[0463] Layer properties: Linear light mode, opacity 50%;

[0464] Effect: Highlight the clarity of detail elements.

[0465] (7) Layer 7 - Ambient Light Layer:

[0466] Extraction method: Identify the newly added ambient reflections in Step 7;

[0467] Layer content: Reflection effect of ambient light;

[0468] Layer properties: Color filter mode, opacity 30%;

[0469] Effect: Increase the realistic ambient lighting effect.

[0470] 1.5 Layer Saving (Step S4)

[0471] The system will stack the 7 layers in the correct order to generate the final PSD file, where the layer stack structure (from top to bottom) is: Ambient Light Layer (topmost layer), Detail Sharpening Layer, Shadow Adjustment Layer, Highlight Enhancement Layer, Color Adjustment Layer, Texture Protection Layer, Main Body Mask Layer, Source Image (background layer, locked state).

[0472] 1.6 Verification

[0473] The verification process includes: the system simulates all layers to generate a preview image; compares and verifies with user requirements; confirms that the white T-shirt effect is natural and the texture is well preserved; saves as "output_white_tshirt.psd" file.

[0474] Output file characteristics: File size: about 45MB; contains 8 independent layers; each layer can be edited separately; supports further adjustment in Photoshop.

[0475] It should be understood that, although the steps in the flowcharts in the above embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other orders. Moreover, at least part of the steps in the figure can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order is not necessarily sequential, but can be alternately executed with at least part of other steps or sub-steps or stages of other steps.

[0476] Figure 4 A schematic diagram of an automatic layer separation device based on incremental difference provided by an embodiment of the present application is shown in FIG. 1, which comprises a device for automatic layer separation based on incremental difference, and the device comprises: Figure 4

[0477] A task decomposition module 11 is configured to respond to an image editing request, perform task decomposition for layer perception according to the image editing request and a corresponding source image, and determine image processing task parameters, including task complexity and operation step sequence.

[0478] An image processing module 12 is configured to call a corresponding AI model to perform image processing according to the image processing task parameters, and obtain image processing results of each step.

[0479] An incremental difference module 13 is configured to perform difference layer extraction through an incremental difference extraction algorithm according to the image processing results of each step, and obtain layer information corresponding to the image processing results of each step.

[0480] A result saving module 14 is configured to save the image processing results of each step as an editable layer format file, and obtain a layer stack, wherein each layer is marked with corresponding layer information.

[0481] For the limitation of the automatic layer separation device based on incremental difference, reference can be made to the limitation of the automatic layer separation method based on incremental difference in the above embodiments of the present application, which will not be repeated here.

[0482] Figure 5 Another schematic diagram of an automatic layer separation device based on incremental difference provided by an embodiment of the present application is shown in FIG. 2, which comprises a device for automatic layer separation based on incremental difference, and the device comprises: Figure 5 a memory 22 and a processor 21, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method in the above embodiments of the present application.

[0483] ​The memory is connected with the processor, and can be a flash memory or a read-only memory or other memory, and the processor can be a central processing unit or a single-chip microcomputer.

[0484] In some embodiments, the present application provides a computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, implements the method in any of the above embodiments of the present application.

[0485] The computer readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, computer program modules or other data. The computer readable storage medium includes but is not limited to RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disc (DVD) or other optical disc storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer.

[0486] It can be understood that the above embodiments are only exemplary embodiments for illustrating the principles of the present application, and the present application is not limited thereto. Various modifications and improvements can be made by those skilled in the art without departing from the spirit and essence of the present application, and these modifications and improvements are also considered to be within the protection scope of the present application.

Claims

1. A method for automatic layer separation based on incremental difference, characterized in that, The method includes: S1. In response to obtaining an image editing request, perform layer-aware task decomposition based on the image editing request and the corresponding source image, and determine image processing task parameters, wherein the image processing task parameters include task complexity and operation step sequence; wherein the operation step sequence is obtained based on the task complexity; S2. According to the sequence of operation steps, call the corresponding AI model to perform image processing and obtain the image processing result of each step; S3. Based on the image processing results of each step, the difference layer is extracted using the incremental difference extraction algorithm to obtain the layer information corresponding to the image processing results of each step. S4. Save the image processing results of each step as an editable layer format file to obtain a layer stack, where each layer is labeled with corresponding layer information.

2. The automatic layer separation method based on incremental difference according to claim 1, characterized in that, S1 includes: S11. Extract image features from the source image and perform natural language processing on the image editing request to obtain text key information, the text key information including operation type; S12. Based on the image features and the key text information, perform a complexity assessment to obtain the task complexity. S13. Determine the initial operation step sequence based on the key text information and the task complexity; S14. Perform layer type prediction for each step in the initial operation step sequence, and obtain the corresponding layer-friendly prompt words based on the layer type prediction result of each step. The layer-friendly prompt words are used to constrain the processing process and output results of the AI ​​model. S15. Calculate the friendliness score for each step and determine the friendliness level of the corresponding step based on the score results. The friendliness level is used to determine whether the step needs to be optimized or split. S16. Based on the friendliness level of each step, retain, optimize, or split the steps to obtain the final sequence of operation steps.

3. The automatic layer separation method based on incremental difference according to claim 2, characterized in that, In S11, the image features include at least one of the following: visual feature vector, color histogram, color distribution statistics of HSV color space, edge density map, and main region mask; The key information in the text includes operation type, target object, source attribute, and target attribute.

4. The automatic layer separation method based on incremental difference according to claim 3, characterized in that, S12 includes: S121. Calculate the color conversion complexity, texture preservation complexity, and semantic understanding complexity based on the image features and the key text information, respectively. S122. Determine the task complexity based on the color conversion complexity, texture preservation complexity, and semantic understanding complexity.

5. The automatic layer separation method based on incremental difference according to claim 4, characterized in that, S121 includes: Based on the color histogram and color distribution statistics of the HSV color space in the image features, as well as the source and target attributes in the text key information, the color range span, color distribution entropy and color conflict degree are calculated. Based on the color range span, color distribution entropy and color conflict degree, the color conversion complexity CTC is obtained by weighted summation. The edge density is calculated based on the edge density map in the image features. The texture detail complexity is obtained by performing gray-level co-occurrence matrix analysis on the source image. The structural integrity requirement is calculated based on the main region mask in the image features. The texture preservation complexity (TPC) is obtained by weighted summation based on the edge density, texture detail complexity, and structural integrity requirement. The image editing request and the source image input are used to extract semantic embedding vectors based on the pre-trained CLIP model of contrasting text-image pairs and calculate the semantic gap. The semantic segmentation model is used to calculate the contextual dependency of the target object and its surrounding environment. The object complexity is calculated based on the main region mask. The semantic understanding complexity (SUC) is obtained by weighted summation based on the semantic gap, contextual dependency, and object complexity.

6. The automatic layer separation method based on incremental difference according to claim 5, characterized in that, S122, including: The adaptive weights of the color conversion complexity (CTC), texture preservation complexity (TPC), and semantic understanding complexity (SUC) are determined based on the operation type in the key text information. Calculate the complexity interaction factor among the color conversion complexity (CTC), texture preservation complexity (TPC), and semantic understanding complexity (SUC); The task complexity is calculated based on the color conversion complexity (CTC), texture preservation complexity (TPC), semantic understanding complexity (SUC), adaptive weights, and complexity interaction factors.

7. The automatic layer separation method based on incremental difference according to claim 2, characterized in that, In S14, layer type prediction is performed for each step in the initial operation step sequence, including: Extract the step features for each step, including operation type features, impact dimension features, scope of effect features, and data change features; Based on the characteristics of each step, layer type prediction is performed using a decision tree, including: The range of editable parameters for the prediction layer; Predict the blending mode of the layer; Predict the dependencies of the layers; Predict the visual impact area of ​​the layer; Prioritize the editing of the evaluation layer.

8. The automatic layer separation method based on incremental difference according to claim 7, characterized in that, In S14, based on the layer type prediction result of each step, the corresponding layer-friendly prompt words are obtained, including: Based on the layer type prediction results for each step, an operation constraint description is constructed, which includes scope constraints, content retention constraints, and parameterization constraints. Based on the operation constraint description, the corresponding layer-friendly prompt words are obtained by querying the prompt word template. The layer-friendly prompt words are used to constrain the scope of application, retained content, parameterization method, and output format.

9. The automatic layer separation method based on incremental difference according to claim 2, characterized in that, S15 includes: S151. Based on the operational locality, parameterization degree, and separability of the steps, a friendliness score is given for each step to obtain the score result for each step. S152. Based on the relationship between the scoring results and the friendliness level threshold, determine the friendliness level for the corresponding step.

10. The automatic layer separation method based on incremental difference according to claim 9, characterized in that, S151 includes: The operational locality score of a step is determined based on the proportion of the area of ​​effect of that step, and the operational locality score is inversely proportional to the proportion of the area of ​​effect. The parameterization score of a step is determined based on the number of adjustable parameters in that step, and the parameterization score is proportional to the number of adjustable parameters. A separability score is determined based on the independence of a step from other steps, and the separability score is proportional to the independence of a step from other steps. The score for each step is obtained by weighting and summing the scores based on the operational locality score, parameterization score, and separability score.

11. The automatic layer separation method based on incremental difference according to claim 9, characterized in that, S152 includes: If the rating result is greater than or equal to the first preset threshold, the corresponding friendliness level is determined to be high friendliness, and the high friendliness characterization step is retained; If the rating result is greater than or equal to the second preset threshold and less than the first preset threshold, then the corresponding friendliness level is determined to be medium friendliness. The medium friendliness characterization step is optimized, and the second preset threshold is less than the first preset threshold. If the score is less than the second preset threshold, the corresponding friendliness level is determined to be low friendliness, and the low friendliness characterization is broken down into steps.

12. The automatic layer separation method based on incremental difference according to claim 1, characterized in that, S3 includes: S31. Determine the corresponding reference image based on the image processing results of each step; S32. Perform three-domain difference analysis based on the image processing results of each step and the corresponding reference image to obtain the three-domain analysis results. The three-domain difference analysis includes pixel domain difference analysis, frequency domain difference calculation, and semantic domain difference calculation. S33. Based on the three-domain analysis results, determine the final layer type of the image processing result for each step. The layer information includes the three-domain analysis results and the final layer type.

13. The automatic layer separation method based on incremental difference according to claim 12, characterized in that, In S32, the pixel domain difference analysis includes: Pixel-by-pixel difference calculation is performed on the image processing results of each step and the corresponding reference image to obtain the pixel difference map of each color channel; The difference magnitude is calculated for the pixel difference map, and a change mask is generated according to a preset magnitude threshold. The change mask identifies the pixel regions that have undergone significant changes. Based on the pixel difference map and change mask, pixel domain statistical features are calculated, including the mean difference, standard deviation of difference, and maximum difference value, which are used to quantify the intensity and distribution range of pixel-level changes.

14. The automatic layer separation method based on incremental difference according to claim 12, characterized in that, In S32, the frequency domain differential calculation includes: Two-dimensional fast Fourier transform is performed on each color channel of the image processing result and the corresponding reference image at each step to obtain the frequency domain representation; The amplitude spectrum difference between the two frequency domains is calculated, and the amplitude spectrum difference is separated into high-frequency variation and low-frequency variation according to the magnitude of the frequency components. The high-frequency variation corresponds to the change in texture and edge details, and the low-frequency variation corresponds to the change in overall hue and brightness. A frequency mask is generated based on the distribution characteristics of the high-frequency and low-frequency changes. The frequency mask is used to distinguish the change types in different frequency ranges.

15. The automatic layer separation method based on incremental difference according to claim 12, characterized in that, In S32, the semantic domain difference calculation includes: The pre-trained semantic segmentation model is used to extract semantic features from the image processing results and the corresponding reference image at each step, so as to obtain the semantic category and semantic feature vector of each pixel. Compare the semantic category distribution of two images to determine the pixel regions where semantic category changes occur; Calculate the differences in the semantic feature vectors to obtain the intensity of semantic-level changes; The CLIP model is used to extract the image semantic embedding vectors of the image processing results and the corresponding reference images at each step. The similarity between the two embedding vectors is calculated to obtain a high-level semantic change index, which is used to evaluate the degree of change in the overall semantic content of the image.

16. An automatic layer separation device based on incremental difference, characterized in that, The device includes: The task decomposition module is configured to, in response to an image editing request, perform layer-aware task decomposition based on the image editing request and the corresponding source image, and determine image processing task parameters, wherein the image processing task parameters include task complexity and operation step sequence; wherein the operation step sequence is obtained based on the task complexity. The image processing module is configured to call the corresponding AI model to perform image processing according to the sequence of operation steps, and obtain the image processing result of each step; The incremental difference module is configured to extract the difference layer based on the image processing results of each step using an incremental difference extraction algorithm, thereby obtaining the layer information corresponding to the image processing results of each step. The results saving module is configured to save the image processing results of each step as an editable layer format file, resulting in a layer stack, where each layer is labeled with corresponding layer information.

17. An automatic layer separation device based on incremental difference, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to implement the incremental difference-based automatic layer separation method as described in any one of claims 1-15.

18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the automatic layer separation method based on incremental difference as described in any one of claims 1-15.

Citation Information

Patent Citations

  • Fashionable image editing method and device based on self-attention mechanism

    CN115082295A

  • Image Processing Method, Electronic Device and Non-Transient Computer Readable Medium

    US20240177271A1