An image processing method, device, storage medium and electronic device

CN122156005APending Publication Date: 2026-06-05BEIJING ZITIAO NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2024-12-03
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

The training process of existing image processing models is time-consuming and computationally resource-intensive, requiring a large amount of training sample data.

Method used

By inserting a network adaptation module into the already trained historical model, an initial image processing model is formed, and fine-tuning is performed using sample data from the first business type, simplifying the training process and reducing sample data requirements and computational resource consumption.

Benefits of technology

It simplifies the training process of image processing models, reduces the amount of sample data required, and improves training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156005A_ABST
    Figure CN122156005A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide an image processing method and device, a storage medium and an electronic device. The method comprises: obtaining a first image, processing the first image based on a trained image processing model to obtain a second image; wherein the trained image processing model is obtained by training an initial image processing model based on sample data of a first service type, the initial image processing model comprises a trained historical training model of a second service type and at least one to-be-trained network adaptation module inserted in the trained historical training model; the number and insertion position of the at least one to-be-trained network adaptation module in the historical training model are determined based on the first service type. The historical training model is reused to obtain an image processing model adapted to the first service type, which simplifies the training process of the image processing model of the first service type and improves the training efficiency of the image processing model of the first service type.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to image processing technology, and more particularly to an image processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] In the field of image processing, neural network models, such as image processing models, are widely accepted and used to process images, which can accelerate the efficiency of image processing.

[0003] The training process for image processing models typically involves learning from scratch using a large amount of training data. End-to-end training is commonly used, directly learning the mapping relationship between the image to be processed and the target image. However, this training method requires a large amount of training sample data, is time-consuming, and consumes significant computational resources. Summary of the Invention

[0004] This disclosure provides an image processing method, apparatus, storage medium, and electronic device. By improving the structure of a historical training model through a network adaptation module, an initial image processing model is obtained. The initial image processing model is then trained through fine-tuning to obtain an image processing model. This simplifies the training process of the image processing model, reduces the number of training sample data, and lowers the computational resource consumption of the fine-tuning process.

[0005] In a first aspect, embodiments of this disclosure provide an image processing method, including:

[0006] A first image is acquired, and the first image is processed based on a trained image processing model to obtain a second image;

[0007] The trained image processing model is obtained by training an initial image processing model based on sample data of a first service type. The initial image processing model includes a trained historical training model of a second service type and at least one network adaptation module to be trained inserted into the trained historical training model. The number of the at least one network adaptation module to be trained and its insertion position in the historical training model are determined based on the first service type.

[0008] The first image is the image to be processed under the first service type, and the second image is the target image corresponding to the first image under the first service type.

[0009] Secondly, embodiments of this disclosure also provide an image processing apparatus, comprising:

[0010] The image acquisition module is used to acquire the first image;

[0011] An image processing module is used to process the first image based on a trained image processing model to obtain a second image;

[0012] The trained image processing model is obtained by training an initial image processing model based on sample data of a first service type. The initial image processing model includes a trained historical training model of a second service type and at least one network adaptation module to be trained inserted into the trained historical training model. The number of the at least one network adaptation module to be trained and its insertion position in the historical training model are determined based on the first service type.

[0013] The first image is the image to be processed under the first service type, and the second image is the target image corresponding to the first image under the first service type.

[0014] Thirdly, embodiments of this disclosure also provide an electronic device, characterized in that the electronic device comprises:

[0015] One or more processors;

[0016] Storage device for storing one or more programs.

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method provided in any embodiment of this disclosure.

[0018] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image processing method provided in any embodiment of this disclosure.

[0019] In this embodiment, based on a historical training model for a second business type, at least one network adaptation module is used to adapt the historical training model to the first business type, resulting in an initial image processing module adapted to the first business type. The initial image processing module is then trained with small samples based on sample data from the first business type to obtain an image processing model for the first business type. Historical training models from a second business type (different from the first business type) are reused to obtain an image processing model adapted to the first business type, simplifying the training process of the image processing model for the first business type, reducing the amount of sample data required for the first business type, and improving the training efficiency of the image processing model for the first business type. Attached Figure Description

[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0021] Figure 1 This is a schematic flowchart of an image processing method provided in an embodiment of this disclosure;

[0022] Figure 2 This is a schematic diagram of the structure of a historical training model;

[0023] Figure 3 This is a schematic diagram of the structure of a historical training model;

[0024] Figure 4 This is a schematic diagram of the structure of an image processing model provided in an embodiment of this disclosure;

[0025] Figure 5 This is a schematic diagram of the structure of an image processing model provided in an embodiment of this disclosure;

[0026] Figure 6 This is a schematic diagram of the structure of a network adapter module provided in an embodiment of this disclosure;

[0027] Figure 7 This is a schematic diagram of the structure of a network adapter module provided in an embodiment of this disclosure;

[0028] Figure 8 This is a schematic diagram of the structure of an image processing model provided in an embodiment of this disclosure;

[0029] Figure 9 This is a schematic diagram of the structure of a network adapter module provided in an embodiment of this disclosure;

[0030] Figure 10 This is a schematic diagram of the structure of a network adapter module provided in an embodiment of this disclosure;

[0031] Figure 11 This is a schematic diagram illustrating the state of model parameters during the training process of the initial image processing model provided in this embodiment of the disclosure;

[0032] Figure 12 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of this disclosure;

[0033] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0034] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0035] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0036] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0037] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0038] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0039] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0040] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0041] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0042] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0043] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0044] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0045] Figure 1 This is a flowchart illustrating an image processing method provided in an embodiment of the present disclosure. This embodiment is applicable to a scenario where, based on a historical training model of a second business type, the historical training model is improved through a network adaptation module, and the improved initial image processing model is fine-tuned using sample data of a first business type to obtain an image processing model for the first business type. The image to be processed for the first business type is then processed based on the image processing model. This method can be executed by an image processing device, which can be implemented in software and / or hardware. Optionally, it can be implemented through an electronic device, such as a mobile terminal, a PC, or a server.

[0046] like Figure 1 As shown, the method includes:

[0047] S110, Obtain the first image.

[0048] S120. The first image is processed based on the trained image processing model to obtain the second image.

[0049] In this embodiment, the image processing model can be understood as a machine learning model that processes images in the first business type. The first image is the image to be processed under the first business type, and the second image is the target image corresponding to the first image under the first business type.

[0050] Optionally, the first business type can be an image restoration scenario. Accordingly, the first image is the image to be restored, and the second image is the restored image output from the first image after image restoration by an image processing model. The image to be restored can be a low-resolution image, which can be understood as an image with a resolution lower than a preset resolution, or an image with a bitrate lower than a preset bitrate. For example, the image to be restored can be an image that has undergone image compression or transmission, or an image acquired using a low-resolution device. Optionally, the image to be restored here can be a video frame from a video to be modified. The image processing model for the image restoration scenario can be trained based on sample data from the image restoration scenario and has image restoration functionality. The sample data for the image restoration scenario can include the sample image to be restored and the image with restoration labels. The image to be modified is input into the image processing model, and the restored image is output. The image resolution of the restored image is higher than that of the image to be restored, thereby improving image clarity.

[0051] Optionally, the first business type can be an image generation scenario based on a skeleton image. Accordingly, the first image can be a skeleton image, and the second image can be a generated image corresponding to the skeleton image, where the pose of the object in the generated image matches the skeleton pose in the skeleton image. For example, the first image can be a human skeleton image, and correspondingly, the second image can be a human image, where the human pose in the second image is consistent with the human skeleton pose in the first image. Exemplary examples include, but are not limited to, standing, running, and jumping poses. The image processing model for the image generation scenario can be trained based on sample data from the image generation scenario, which includes sample skeleton images and label images.

[0052] It is understandable that the first business type is not limited and can be set according to needs. The first image and the second image can be different in different first business types.

[0053] In this embodiment, the image processing model is obtained by fine-tuning an initial image processing model using sample data from a first business type. The initial image processing model includes a previously trained historical training model for a second business type and at least one network adaptation module to be trained inserted into the previously trained historical training model. This historical training model is a pre-trained neural network model for the second business type. Optionally, the historical training model is a pre-trained diffusion model. The second business type differs from the first business type. Based on the historical training model of the second business type, the initial image processing model is obtained using the historical training model and at least one network adaptation module, thus reusing the historical training model. Furthermore, by fine-tuning the initial image processing model using sample data from the first business type, an image processing model for the first business type is obtained. Since the model parameters in the historical training model are pre-trained, there is no need to learn the initial image processing model from scratch, which simplifies the training process, reduces the amount of sample data in the first business type, reduces the computational resource consumption during image processing model training, and accelerates the training efficiency of the image processing model.

[0054] It is understood that the input to the historical training model can include, but is not limited to, one or more of the following: text, images, and audio; and the output of the historical training model can be an image. There are no restrictions here on the second business type of the historical training model, nor on its network structure.

[0055] Optionally, the initial image processing model is determined by inserting at least one network adapter module into a historical training model of the second service type. The number of at least one network adapter module to be trained and its insertion position in the historical training model are determined based on the first service type. For image processing models of different first service types, the number of at least one network adapter module to be trained and / or the insertion position of the network adapter module in the historical training model may be different.

[0056] The historical training model includes an encoder, an intermediate processing module, and a decoder. The intermediate processing module includes multiple processing blocks, at least one of which is a preset processing block. A network adapter module is inserted at a preset position corresponding to at least one preset processing block in the intermediate processing module. For example, one network adapter module is inserted at the preset position corresponding to each preset processing block, and this preset position can be located before the preset processing block. Optionally, the encoder can be a variational autoencoder, and the decoder can be a variational autodecoder.

[0057] The number of network adaptation modules and their insertion position in the intermediate processing module can vary depending on the different first service types, and can be determined according to the different first service types. Optionally, the preset processing block includes at least the first processing block in the intermediate processing module, that is, a network adaptation module is inserted before the first processing block of the intermediate processing module. Optionally, when the number of network adaptation modules is greater than 1, the preset processing block includes the first processing block in the intermediate processing module and at least one other processing block besides the first processing block.

[0058] It is understood that the network structure of the intermediate processing module is not limited. For example, see [link to example]. Figure 2 and Figure 3 , Figure 2 and Figure 3 These are schematic diagrams of the structure of a historical training model. Figure 2 The intermediate processing module in it is a transformer network structure. Figure 3 The intermediate processing module in the network is a U-Net network structure; each intermediate processing module includes multiple processing blocks, but the internal structure of each processing block in different intermediate processing modules can be different. Figure 3 The seven processing blocks in the intermediate processing module are just one example.

[0059] For example, see Figure 4 and Figure 5 , Figure 4 and Figure 5 These are schematic diagrams of the structure of an image processing model provided in an embodiment of this disclosure. Figure 4 The image processing model in the model is obtained by combining a historical training model and a network adaptation module, which is inserted before the first processing block in the intermediate processing module of the historical training model. Figure 5 The image processing model in this example is derived from a combination of a historical training model and multiple network adaptation modules. The number of network adaptation modules can be the same as the number of processing blocks in the intermediate processing modules of the historical training model. One network adaptation module is inserted before each processing block in the intermediate processing module. It is understood that in other embodiments, the number of network adaptation modules can be less than the number of processing blocks in the intermediate processing modules of the historical training model. For example, a network adaptation module can be inserted before the first processing block in the intermediate processing module of the historical training model, or one or more processing blocks can be randomly selected from the other processing blocks in the intermediate processing module of the historical training model (excluding the first processing block), and corresponding network adaptation modules can be inserted to form different image processing models. Figure 4 or Figure 5 The historical training model in the middle can be Figure 2 or Figure 3 Any network structure in it. It is understandable that... Figure 4 and Figure 5 The reverse arrow pointing from the intermediate processing block n to the first network adaptation module indicates cyclic execution. The output features of processing block n are used as the input of the first network adaptation module and processed cyclically by the intermediate processing module until the number of iterations is satisfied. The output features of processing block n are then used as the input of the decoder to obtain the decoder's output, which is the second image.

[0060] Based on the above embodiments, the intermediate processing module and at least one network adaptation module can form an extended processing module. Accordingly, the initial image processing model for the first service type includes an encoder, an extended processing module, and a decoder. Fine-tuning the initial image processing model yields an image processing model for the first service type, which includes an encoder, an extended processing module, and a decoder. The extended processing module is obtained by inserting the network adaptation module into preset positions corresponding to at least one of the preset processing blocks in the intermediate processing module; that is, the extended processing module includes the plurality of processing blocks and at least one trained network adaptation module.

[0061] Optionally, processing the first image based on the trained image processing model to obtain the second image may include: inputting the first image to the encoder and outputting image features; obtaining random noise information and inputting the random noise information and the image features to the extended processing module to obtain intermediate features; and inputting the intermediate features to the decoder to output the second image.

[0062] Random noise information can be generated based on a noise simulator. This random noise information can be of a preset noise type, such as Gaussian noise or Poisson noise, and can be set according to noise requirements. The noise type of random noise information can be the same or different in different first service types.

[0063] The first image is used as input information to the encoder, which encodes the first image and outputs image features. The image features and random noise information are used as input information to the extended processing module, which processes the image features and random noise information to obtain intermediate features.

[0064] In the extended processing module, at least one trained network adaptation module and multiple processing blocks are sequentially connected based on a preset connection relationship. Based on this connection relationship, random noise information and image features are processed sequentially until an intermediate feature is output. Optionally, the extended processing module performs multiple loop processing steps. For example, in the first loop processing step, random noise information and image features are input into the extended processing module, outputting a first loop feature. The first loop feature and image features are then used as new input information for the extended processing module for a second loop processing step, yielding a second loop feature. The second loop feature and image features are then input again for a third loop processing step, and so on, until the nth loop processing step is completed, at which point an intermediate feature is output. Here, n is an integer greater than 1.

[0065] The intermediate features are used as input to the decoder, and the decoder processes the intermediate features to obtain the second image.

[0066] Optionally, adjacent network adaptation modules in the extended processing module are skip-connected; adjacent network adaptation modules may include at least one processing block. The first network adaptation module in the extended processing module is skip-connected to the second network adaptation module, the second network adaptation module is skip-connected to the third network adaptation module, and so on. The input information of the first network adaptation module in the extended processing module is the image features and random noise information output by the encoder, or the image features output by the encoder and the output features of the extended processing module in the previous loop processing. The input information of other network adaptation modules in the extended processing module besides the first network adaptation module includes the output features of the previous network adaptation module and the output features of the previous processing block. The input information of each processing block can be the output features of the previous processing block or the output features of the previous network adaptation module.

[0067] For different network structures in the intermediate processing module, the structure of the network adapter module inserted in the intermediate processing module is also different to improve the compatibility between the network adapter module and the intermediate processing module. Optionally, the structure of the network adapter module is determined based on the structure of the historical training model, or the structure of the network adapter module is determined based on the structure of the intermediate processing module in the historical training model.

[0068] The intermediate processing module is a transformer network structure; the network adaptation module adapted to the transformer network structure includes a first feature processing block, a scaling layer, a shifting layer, and a fully connected layer; for example, see Figure 6 , Figure 6This is a schematic diagram of the structure of a network adaptation module provided in an embodiment of this disclosure. The first feature processing module includes a normalization layer, an activation function layer, and a linear layer connected in sequence.

[0069] The processing procedure of any network adaptation module in the extended processing module may include: inputting the first input feature to the first feature processing block to obtain a first output feature; the first input feature includes the image feature or the output feature of the previous processing block; inputting the second input feature and the first output feature to the scaling layer to obtain a scaling feature; the second input feature includes the random noise information or the output feature of the previous network adaptation module; inputting the fusion feature of the scaling feature and the first output feature to the displacement layer to output a displacement feature; and inputting the displacement feature and the first output feature to the fully connected layer to obtain the output feature of the network adaptation module.

[0070] For the first network adaptation module in the extended processing module, the first input feature is image features, and the second input feature is random noise information. For the other network adaptation modules in the extended processing module besides the first network adaptation module, the first input feature is the output feature of the previous processing block, and the second input feature is the output feature of the previous network adaptation module.

[0071] The scaling layer scales the input information to a suitable range for easier computation. The scaling function can be a statistical function, including but not limited to averaging, standard deviation, minimum, and maximum functions. The shift layer is used to translate the features.

[0072] Optionally, the intermediate processing module is a U-Net network structure; the network adaptation module adapted to the U-Net network structure includes: multiple second feature processing blocks and convolutional blocks; for example, any second feature processing block may include a normalization layer, an activation function layer, and a 2D convolutional layer connected in sequence. See also, for an example. Figure 7 , Figure 7 This is a schematic diagram of the structure of a network adapter module provided in an embodiment of this disclosure.

[0073] The processing procedure of any network adaptation module in the extended processing module may include: inputting the first input feature to the first second feature processing block to obtain a second output feature; the first input feature includes the image feature or the output feature of the previous processing block; inputting the fused feature of the second output feature and the second input feature to at least one other second feature processing block to obtain a third output feature; the second input feature includes the random noise information or the output feature of the previous network adaptation module; and inputting the third output feature to the convolution block to obtain the output feature of the network adaptation module. The input and output ends of at least one second feature processing block other than the first second feature processing block in the extended processing module are skip-connected. Any network adaptation module includes at least two second feature processing blocks, for example, Figure 7 The network adaptation module includes three second feature processing blocks.

[0074] For the first network adaptation module in the extended processing module, the first input feature is image features, and the second input feature is random noise information; for other network adaptation modules in the extended processing module besides the first network adaptation module, the first input feature is the output feature of the previous processing block, and the second input feature is the output feature of the previous network adaptation module.

[0075] The technical solution of this embodiment, based on the historical training model of the second business type, adapts the historical training model through at least one network adaptation module to obtain an initial image processing module adapted to the first business type. The initial image processing module is then trained with small samples based on sample data from the first business type to obtain an image processing model for the first business type. Historical training models from the second business type, which are different from the first business type, are reused to obtain an image processing model adapted to the first business type. This simplifies the training process of the image processing model for the first business type, reduces the amount of sample data required for the first business type, and improves the training efficiency of the image processing model for the first business type. Furthermore, at least one network adaptation module is inserted into the intermediate processing module of the historical training model. Different network adaptation modules are set for different network structures in the intermediate processing module, enabling adaptation to historical training models with different network structures. This improves the reuse of different historical training models and avoids the problem of incompatibility between the network adaptation module and the historical training model.

[0076] In some embodiments, the second service type includes a service type that generates images based on text; correspondingly, the historical training model of the second service type can process text features. Correspondingly, an image processing model formed based on the historical training model and at least one network adaptation module can process text features.

[0077] Optionally, the image processing model includes a semantic processing module, an encoder, an extended processing module, and a decoder, wherein the semantic processing module is connected to the extended processing module. Based on the historically trained model, the semantic processing module is further configured to extract text features from the first image. Here, the text features of the first image can be its semantic features. The semantic features of the first image can provide a semantic reference for the image processing model in processing the first image, improving the accuracy of the output second image.

[0078] Optionally, processing the first image based on a trained image processing model to obtain the second image includes: inputting the first image into a semantic processing module to obtain semantic features corresponding to the first image; inputting the first image into the encoder to obtain image features; acquiring random noise information, and inputting the random noise information, the image features, and the semantic features into the extended processing module to obtain intermediate features; and inputting the intermediate features into the decoder to output the second image.

[0079] Semantic processing models can include large language models and text encoders. For example, a large language model can be a multimodal large language model (MM-LLMs). The large language model is used to extract semantic information from the first image to obtain semantic features, which can be in text form. The text encoder is used to encode the semantic features in text form to obtain semantic features in the form of embeddings.

[0080] Random noise information, image features, and semantic features are used as input information to the extended processing module. This module processes these elements to obtain intermediate features. This improves the comprehensiveness of the features provided by the extended processing module, enhancing the accuracy of the intermediate features and further improving the accuracy of the second image.

[0081] For example, participate Figure 8 , Figure 8 This is a schematic diagram of the structure of an image processing model provided in an embodiment of this disclosure. Figure 8 In the middle, skip connections are made between adjacent network adaptation modules. Figure 8 Only the skip connection between the first network adapter module and the second network adapter module is shown; skip connections between other network adapter modules are not shown. Figure 8 The semantic features output by the semantic processing module are respectively input to each network adaptation module and each processing block in the extended processing module. Figure 8 Only a portion is shown.

[0082] Figure 8The random noise information, image features, and semantic features are input into the first network adaptation module to obtain the output features of the first network adaptation module. The output features of the first network adaptation module and the semantic features are then input into the first processing block to obtain the output features of the first processing block. The output features of the first processing block, the output features of the first network adaptation module, and the semantic features are then input into the second network adaptation module to obtain the output features of the second network adaptation module. The output features of the second network adaptation module and the semantic features are then input into the second processing block to obtain the output features of the second processing block. This process continues until the intermediate features output by the extended processing model are obtained.

[0083] in, Figure 8 The time information in the process can be the loop time information in the loop processing of the extended processing model. For example, in the first loop processing, the time information can be 1, in the second loop processing, the time information can be 2, and so on, until the time information meets the preset loop condition, the loop processing process ends and the intermediate feature is output.

[0084] Building upon the semantic processing module within the image processing module, the input information for each network adaptation module in the extended processing module includes semantic features. Correspondingly, the network adaptation module includes a speech feature processing block. Optionally, the speech feature processing block may include activation function layers and fully connected layers.

[0085] For example, see Figure 9 and Figure 10 , Figure 9 and Figure 10 These are schematic diagrams of the network adaptation module provided in the embodiments of this disclosure. Figure 9 The network adapter module in the code can be a network adapter module suitable for transformer network structures. Figure 10 The network adapter module in the document can be a network adapter module suitable for the U-Net network structure.

[0086] Figure 9 In this process, the first input feature is input to the first feature processing block; the semantic feature is input to the speech feature processing block to obtain the semantic processing feature; the semantic processing feature, the second input feature, and the first output feature are input to the scaling layer for scaling processing. The fused feature of the scaling feature and the first output feature is input to the displacement layer to output the displacement feature; the displacement feature and the first output feature are input to the fully connected layer to obtain the output feature of the network adaptation module.

[0087] Figure 10In this process, the first input feature is input into the first second feature processing block to obtain the second output feature; the semantic feature is input into the speech feature processing block to obtain the semantic processing feature; the fused feature of the semantic processing feature, the second output feature, and the second input feature is input into at least one other second feature processing block to obtain the third output feature; the second input feature includes the random noise information or the output feature of the previous network adaptation module; the third output feature is input into the convolution block to obtain the output feature of the network adaptation module.

[0088] The technical solution of this disclosure embodiment, in the case that the historical training model is a text-to-image scene model, sets up a semantic processing model on the basis of the trained model, so that the image processing model for extracting the first business type can extract the semantic features of the first image, providing semantic features for the image processing model for the first business type to process the first image, providing feature comprehensiveness, and further improving the accuracy of the second image.

[0089] Based on the above embodiments, any processing block in the intermediate processing module includes multiple original processing sub-blocks; for example, the original processing sub-blocks may include, but are not limited to, convolutional sub-blocks, self-attention sub-blocks, etc. Correspondingly, any processing block in the extended processing module includes multiple original processing sub-blocks and at least one original processing sub-block with a corresponding branch sub-block; the branch sub-block is the network sub-block to be trained. Optionally, at least one original processing sub-block with a branch sub-block may include a self-attention sub-block. For example, at least one original processing sub-block may be set in parallel with the corresponding branch sub-block; taking a self-attention sub-block as an example, the self-attention sub-block and the corresponding branch block are set in parallel.

[0090] The input information of the original processing sub-block is input to the original processing sub-block and its corresponding branch sub-block, respectively, and a fusion processing result is output. The fusion processing result is obtained by fusing the output result of the original processing sub-block and the output result of the branch sub-block. For example, the fusion processing result can be obtained by concatenating the channels of the output result of the original processing sub-block and the output result of the branch block.

[0091] In the process of obtaining the image processing model for the first service type by fine-tuning the initial image processing model, the model parameters of at least one network adaptation module in the extended processing module and the branch sub-blocks in each processing block are updated to obtain the trained image processing model for the first service type.

[0092] Based on the above embodiments, the training method of the image processing module includes: freezing the original model parameters of the historical training model in the initial image processing model; training the initial image processing model based on sample data of the first service type, updating the model parameters to be adjusted in the initial image processing model, and obtaining a trained image processing module. Optionally, the model parameters to be adjusted include the model parameters of the network adaptation module. Optionally, the model parameters to be adjusted include the model parameters of at least one network adaptation module in the extended processing module and the branch sub-blocks in each processing block.

[0093] Figure 11 This is a schematic diagram illustrating the state of model parameters during the training process of the initial image processing model provided in the embodiments of this disclosure. Figure 11 The gray network blocks are network blocks in a trainable parameter state, while the white network blocks are network blocks in a frozen parameter state.

[0094] In this embodiment, sample images of the first business type are input into the initial image processing model to be trained to obtain predicted images. A loss function is generated based on the predicted images and the corresponding label images of the sample images. The parameters of the model to be adjusted in the initial image processing model are then adjusted based on the loss function. This process continues until a trained image processing module is obtained. In the above training process, only local model parameters in the initial image processing model are updated, reducing the computational resources consumed during training and accelerating the convergence efficiency of the training process.

[0095] Figure 12 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of the present disclosure, as shown below. Figure 12 As shown, the device includes an image acquisition module 210 and an image processing module 220.

[0096] Image acquisition module 210 is used to acquire the first image;

[0097] Image processing module 220 is used to process the first image based on a trained image processing model to obtain a second image;

[0098] The trained image processing model is obtained by training an initial image processing model based on sample data of the first service type. The initial image processing model includes a trained historical training model of the second service type and at least one network adaptation module to be trained inserted into the trained historical training model. The number of the at least one network adaptation module to be trained and its insertion position in the historical training model are determined based on the first service type.

[0099] The first image is the image to be processed under the first service type, and the second image is the target image corresponding to the first image under the first service type.

[0100] Based on the above embodiments, optionally, the historical training model includes an encoder, an intermediate processing module, and a decoder, and the network adaptation module is located at the corresponding position of at least one preset processing block in the intermediate processing module; the intermediate processing module includes multiple processing blocks, and the preset processing block is at least one of the multiple processing blocks; the preset processing block includes at least the first processing block in the intermediate processing module.

[0101] Based on the above embodiments, optionally, the image processing module includes an encoder, an extended processing module, and a decoder; wherein, the extended processing module includes the plurality of processing blocks and at least one trained network adaptation module; adjacent network adaptation modules in the extended processing module are connected in skip connections;

[0102] Image processing module 220 is configured to: input the first image to the encoder to obtain image features; acquire random noise information; input the random noise information and the image features to the extended processing module to obtain intermediate features; and input the intermediate features to the decoder to output the second image. Specifically, the plurality of processing blocks and the at least one trained network adaptation module in the extended processing module process the random noise information and the image features sequentially based on connection relationships to output the intermediate features.

[0103] Optionally, the second business type includes a business type that generates images based on text; the image processing model further includes a semantic processing module connected to the extended processing module;

[0104] Image processing module 220 is used to: input the first image to semantic processing module to obtain semantic features corresponding to the first image;

[0105] The first image is input into the encoder to obtain image features;

[0106] Obtain random noise information, and input the random noise information, the image features, and the semantic features into the extended processing module to obtain intermediate features;

[0107] The intermediate features are input into the decoder, and the second image is output.

[0108] Based on the above embodiments, optionally, the intermediate processing module is a transformer network structure; the network adaptation module includes a first feature processing block, a scaling layer, a displacement layer and a fully connected layer;

[0109] Image processing module 220 is further configured to: input the first input feature to the first feature processing block to obtain a first output feature; the first input feature includes the image feature or the output feature of the previous processing block; input the second input feature and the first output feature to the scaling layer to obtain a scaling feature; the second input feature includes the random noise information or the output feature of the previous network adaptation module; input the fusion feature of the scaling feature and the first output feature to the displacement layer to output a displacement feature; and input the displacement feature and the first output feature to the fully connected layer to obtain the output feature of the network adaptation module.

[0110] Based on the above embodiments, optionally, the intermediate processing module is a U-Net network structure; the network adaptation module includes: multiple second feature processing blocks and convolutional blocks;

[0111] The image processing module 220 is further configured to: input the first input feature to the first second feature processing block to obtain a second output feature; the first input feature includes the image feature or the output feature of the previous processing block; input the fused feature of the second output feature and the second input feature to at least one other second feature processing block to obtain a third output feature; the second input feature includes the random noise information or the output feature of the previous network adaptation module; and input the third output feature to the convolution block to obtain the output feature of the network adaptation module.

[0112] Based on the above embodiments, optionally, the first service type includes an image restoration scenario, the first image is an image to be restored, and the second image is a restored image corresponding to the image to be restored.

[0113] The image processing apparatus provided in this disclosure can execute the image processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method.

[0114] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0115] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 13 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 13The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 13 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0116] like Figure 13 As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.

[0117] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 13 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0118] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0119] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0120] The electronic device provided in this embodiment and the image processing method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0121] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the image processing method provided in the above embodiments.

[0122] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0123] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0124] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0125] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to:

[0126] The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the electronic device causes the electronic device to: acquire a first image; process the first image based on a trained image processing model to obtain a second image; wherein the trained image processing model is obtained by training an initial image processing model based on sample data of a first service type, the initial image processing model is determined by inserting at least one network adaptation module into a historical training model of a second service type, the historical training model includes an encoder, an intermediate processing module, and a decoder, and the network adaptation module is inserted into a preset position corresponding to at least one preset processing block in the intermediate processing module; the first image is an image to be processed under the first service type, and the second image is a target image corresponding to the first image under the first service type.

[0127] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0128] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0129] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".

[0130] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0131] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0132] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0133] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0134] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. An image processing method, characterized in that, include: A first image is acquired, and the first image is processed based on a trained image processing model to obtain a second image; The trained image processing model is obtained by training an initial image processing model based on sample data of the first business type. The initial image processing model includes a trained historical training model of the second business type and at least one network adaptation module to be trained inserted into the trained historical training model. The number of at least one network adaptation module to be trained and its insertion position in the historical training model are determined based on the first service type. The first image is the image to be processed under the first service type, and the second image is the target image corresponding to the first image under the first service type.

2. The method according to claim 1, characterized in that, The historical training model includes an encoder, an intermediate processing module, and a decoder, and the network adaptation module is located at the corresponding position of at least one preset processing block in the intermediate processing module. The intermediate processing module includes multiple processing blocks, and the preset processing block is at least one of the multiple processing blocks. The preset processing block includes at least the first processing block in the intermediate processing module.

3. The method according to claim 2, characterized in that, The image processing module includes an encoder, an extended processing module, and a decoder; wherein, the extended processing module includes the plurality of processing blocks and at least one trained network adaptation module; adjacent network adaptation modules in the extended processing module are connected in skip connections; The method further includes: The first image is input into the encoder to obtain image features; Random noise information is acquired, and the random noise information and the image features are input into the extended processing module to obtain intermediate features; wherein, the multiple processing blocks and the at least one trained network adaptation module in the extended processing module process the random noise information and the image features sequentially based on the connection relationship, and output the intermediate features; The intermediate features are input into the decoder, and the second image is output.

4. The method according to claim 3, characterized in that, The second business type includes the business type of generating images based on text; The image processing model further includes a semantic processing module, which is connected to the extended processing module; The method further includes: The first image is input into the semantic processing module to obtain the semantic features corresponding to the first image; The first image is input into the encoder to obtain image features; Obtain random noise information, and input the random noise information, the image features, and the semantic features into the extended processing module to obtain intermediate features; The intermediate features are input into the decoder, and the second image is output.

5. The method according to claim 3 or 4, characterized in that, The intermediate processing module is a transformer network structure; the network adaptation module includes a first feature processing block, a scaling layer, a displacement layer, and a fully connected layer. The method further includes: The first input feature is input to the first feature processing block to obtain the first output feature; the first input feature includes the image feature or the output feature of the previous processing block. The second input feature and the first output feature are input to the scaling layer to obtain the scaling feature; the second input feature includes the random noise information or the output feature of the previously mentioned network adaptation module. The fusion feature of the scaling feature and the first output feature is input into the displacement layer, and the displacement feature is output. The displacement feature and the first output feature are input into the fully connected layer to obtain the output feature of the network adaptation module.

6. The method according to claim 3 or 4, characterized in that, The intermediate processing module is a U-Net network structure; The network adaptation module includes: multiple second feature processing blocks and convolutional blocks; The method further includes: The first input feature is input into the first second feature processing block to obtain the second output feature; the first input feature includes the image feature or the output feature of the previous processing block. The fused feature of the second output feature and the second input feature is input into at least one other second feature processing block to obtain a third output feature; the second input feature includes the random noise information or the output feature of the aforementioned network adaptation module; The third output feature is input into the convolutional block to obtain the output feature of the network adaptation module.

7. The method according to claim 1, characterized in that, The first service type includes an image restoration scenario, where the first image is the image to be restored, and the second image is the restored image corresponding to the image to be restored.

8. An image processing apparatus, characterized in that, include: The image acquisition module is used to acquire the first image; An image processing module is used to process the first image based on a trained image processing model to obtain a second image; The trained image processing model is obtained by training an initial image processing model based on sample data of the first business type. The initial image processing model includes a trained historical training model of the second business type and at least one network adaptation module to be trained inserted into the trained historical training model. The number of at least one network adaptation module to be trained and its insertion position in the historical training model are determined based on the first service type. The first image is the image to be processed under the first service type, and the second image is the target image corresponding to the first image under the first service type.

9. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described in any one of claims 1-7.

10. A storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to perform the image processing method as described in any one of claims 1-7.