Image processing method and apparatus, and computer device and storage medium
By acquiring images under multiple styles and building prompt information, adjusting the initial stylized model, the problem of difficulty in generating multiple styles in the existing technology is solved, and efficient multi-style image generation effect is achieved.
Patent Information
- Application Number
- PCT/CN2024/110431
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-09
- Filing Date
- 2024-08-07
- Publication Date
- 2025-02-13
AI Technical Summary
The prior art is difficult to effectively generate images of multiple styles, and training multiple network models is less efficient.
By acquiring images in multiple styles, determining the style description information and content description information corresponding to the image, constructing prompt information, and adjusting the initial stylized model based on this information to generate target images of multiple styles.
The image generation ability of multiple styles is realized, the generation effect is improved, the prior information influence of the initial model is avoided, and the efficiency of image generation is improved.
Smart Images

Figure CN2024110431_13022025_PF_FP_ABST
Abstract
Description
Image processing method, device, computer equipment and storage medium
[0001] This application claims priority to Chinese patent application No. 202311000503.4 filed on August 9, 2023, the entire text of which is incorporated herein by reference as a part of this application. Technical Field
[0002] The present disclosure relates to an image processing method, apparatus, computer equipment, and storage medium. Background Art
[0003] With the rapid development of artificial intelligence (AI), generative AI (AIGC) has gradually become part of our daily lives. AIGC-based network models can generate content, such as articles, images, and audio, based on input keywords, descriptions, or images, thereby enabling content generation.
[0004] For example, when generating stylized images, users can enter prompt information, and a network model based on AIGC technology generates the corresponding stylized image. To improve the generation of a specific style, the network model is generally trained on images of that specific style. However, this method only trains a network model that focuses on a single style. To improve the generation of multiple styles, multiple network models must be trained, which is inefficient.
[0005] Summary of the Invention
[0006] The embodiments of the present disclosure at least provide an image processing method, apparatus, computer equipment, and storage medium.
[0007] In a first aspect, an embodiment of the present disclosure provides an image processing method, comprising:
[0008] Get images in multiple styles;
[0009] Determining style description information and content description information corresponding to the image; wherein the content description information corresponding to the image includes a first preset word, the style description information includes a second preset word, and the style description information corresponding to images of the same style includes the same second preset word;
[0010] Based on the style description information and the content description information corresponding to the image, prompt information corresponding to the image is constructed, and based on the prompt information, an initial stylization model is adjusted to obtain a target stylization model, wherein the target stylization model is used to generate target images of the multiple styles.
[0011] In a second aspect, an embodiment of the present disclosure further provides an image processing device, including:
[0012] Acquisition module, used to obtain images in various styles;
[0013] a determination module, configured to determine style description information and content description information corresponding to the image; wherein the content description information corresponding to the image includes a first preset word, the style description information includes a second preset word, and the style description information corresponding to images of the same style includes the same second preset word;
[0014] An adjustment module is configured to construct prompt information corresponding to the image based on the style description information corresponding to the image and the content description information, and to adjust the initial stylization model based on the prompt information to obtain a target stylization model, wherein the target stylization model is used to generate target images of the multiple styles.
[0015] In a third aspect, an embodiment of the present disclosure further provides a computer device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are performed.
[0016] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without inventive effort.
[0018] FIG1 shows a flow chart of an image processing method provided by an embodiment of the present disclosure;
[0019] FIG2 shows a schematic diagram of the architecture of an image processing device provided by an embodiment of the present disclosure;
[0020] FIG3 shows a schematic structural diagram of a computer device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the disclosure for which protection is sought, but merely represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.
[0022] Fine-tuning a large model involves freezing some of the original large model's parameters and constructing a LoRA model with a small number of parameters. By training the LoRA model, fine-tuning the original large model can be achieved. After the LoRA model is trained, when calling the large model, the frozen parameters in the large model and the trained parameters in the LoRA model can be called to implement data processing.
[0023] When LoRA training is applied to the field of image processing, it is generally necessary to first obtain text-image pairs of a specific style as training data, and obtain a large number of images of general styles as regression data. Then, a correspondence between the regression data and the training data is established. That is, the training data is a subclass of the regression data, and the image style of the training data is one of the general styles of the regression data. For example, if the training data is wedding photo data of a certain style, then the regression data is general wedding photo data containing various styles. Then, some parameters of the pre-trained large model are frozen, and fine-tuning training is performed by opening a small part of the parameters of the large model.
[0024] However, in this LoRA training method, since the training data is a text-image pair of a specific style, the trained LoRA model has a better processing effect on the specific style, and an average or poor processing effect on other styles; and since the LoRA model cannot distinguish between training data of multiple styles, it is impossible to train the LoRA model with training data of multiple styles; if you want to improve the processing effect of multiple styles, you need to train multiple LoRA models, which is inefficient.
[0025] Based on the above research, the present disclosure provides an image processing method, apparatus, computer equipment and storage medium, which can obtain images in multiple styles, and then construct prompt information corresponding to the image based on the style description information and content description information corresponding to the image; here, since the prompt information contains the style description information, decoupling between different image styles can be achieved. Furthermore, the initial stylization model is adjusted based on the prompt information, and the initial stylization model's ability to distinguish between various styles can be trained, and then target images of multiple styles can be generated through the adjusted target stylization model; in addition, since the initial stylization model is a pre-trained model, it contains relatively rich text prior information, and the style description information contains a first preset word, and the content description information includes a second preset word. In this way, the prior information of the initial stylization model can be eliminated, and the influence of the prior information of common words in the text in the style description information and the content description information on the generated target image can be avoided, thereby improving the effect of the generated image.
[0026] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0027] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0028] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0029] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested 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 electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0030] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0031] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0032] To facilitate understanding of this embodiment, an image processing method disclosed in an embodiment of the present disclosure is first introduced in detail. The execution subject of the image processing method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities. The computer device includes, for example, a terminal device or a server or other processing device. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, a wearable device, etc. In some possible implementations, the image processing method can be implemented by a processor calling computer-readable instructions stored in a memory.
[0033] 1 is a flowchart of an image processing method provided by an embodiment of the present disclosure. The method includes steps 101 to 103, wherein:
[0034] Step 101: Acquire images in multiple styles.
[0035] Step 102: Determine the style description information and content description information corresponding to the image; wherein the content description information corresponding to the image includes a first preset word, the style description information includes a second preset word, and the second preset word included in the style description information corresponding to images of the same style is the same.
[0036] Step 103: construct prompt information corresponding to the image based on the style description information corresponding to the image and the content description information, and adjust the initial stylization model based on the prompt information to obtain a target stylization model, wherein the target stylization model is used to generate target images of the multiple styles.
[0037] The following is a detailed description of the above steps.
[0038] For step 101,
[0039] The multiple styles may refer to styles to be optimized, for example, multiple styles selected by a user; or may refer to multiple styles whose popularity information satisfies preset conditions, filtered out based on popularity information corresponding to each style.
[0040] Acquiring images in multiple styles may refer to acquiring multiple images in any given style. Optionally, the number of images acquired in each style may be the same. For example, if there are N styles and M images are acquired in each style, a total of M*N images may be acquired.
[0041] In one possible implementation, when acquiring images in multiple styles, images in multiple styles may be received from users, where the images in multiple styles may be uploaded by at least one user. The above implementation is merely an example of how to acquire images, and this disclosure does not limit the specific method.
[0042] It should be noted that the above-mentioned process of acquiring images is obtained after user authorization. In the following steps, the attribute detection of the image is also correspondingly authorized by the user. The specific authorization process is described in paragraphs 10 to 13 of the specific implementation method.
[0043] For step 102,
[0044] The style description information is information used to describe the style of the image, for example, it can be a style name.
[0045] The content description information is information used to describe the content object contained in the image. The content description information may include the content object and the descriptive words corresponding to the content object. For example, the content description information may be "curly hair", "fair skin", "round eyes", etc., where "hair", "skin", "eyes", etc. are content objects, and "curly", "fair", and "round" are descriptive words.
[0046] The content description information includes a first preset word, which may be a first rare word, which may be understood as an uncommon word, for example, a word generated by a random combination of characters; the style description information includes a second preset word, which and the first preset word are both rare words, and are referred to here as the first preset word and the second preset word only to distinguish the preset words included in the style description information and the preset words included in the content description information.
[0047] In one possible implementation, for any image, when determining the content description information corresponding to the image, the following steps may be performed:
[0048] Step a1: for any image, perform attribute detection on the image to determine the initial content description information corresponding to the image; wherein the initial content description information includes the name of the content object in the image and a description word for the content object.
[0049] Step a2: replacing the description words of the content object based on the first preset words contained in the first preset word library to obtain content description information corresponding to the image.
[0050] Here, when performing attribute detection on the image, the detection may be performed by using a general labeling model, for example, a Bootstrapping Language-Image Pre-training (BLIP) model.
[0051] Optionally, after performing attribute detection based on the universal labeling model, the attributes can be expanded based on a preset paradigm. For example, if attribute detection based on the universal labeling model includes attributes A and B, and the preset paradigm may also include attributes C and D, then the image can be further tested for attributes C and D to determine their values. Attributes A, B, C, and D together constitute the initial content description information for the image.
[0052] The first preset vocabulary may include multiple first preset words, and the preset words may be rare words generated by random combination of characters. The rare words may not include existing words, that is, the rare words are words other than common words included in the common vocabulary; the number of characters contained in different preset words in the first preset vocabulary, and the specific characters contained may be different.
[0053] In a possible implementation, in addition to the first preset words, the first preset word library may also include first correspondences between some of the first preset words and historical description words, wherein the some of the first preset words are associated with the content objects described by the historical description words.
[0054] Here, the historical description words may refer to description words in the content description information of other images, and the other images may refer to images that have been replaced with preset words, that is, images whose content description information has been determined.
[0055] Since some of the first preset words are associated with the content objects described by the historical description words, if the same historical description word describes different content objects, the same historical description word may correspond to different first preset words, that is, in the first correspondence relationship, there may be a situation where the same historical description word corresponds to different first preset words.
[0056] For example, if the historical description word is "Orange", the historical description information is "Orange makeup" and "Orange lips", and the content objects described by the historical description words are "makeup" and "lips" respectively, and the content objects described by the two are different. Therefore, the historical description word "Orange" has two corresponding first preset words in the first correspondence, for example, "asd" and "mmc" respectively. Accordingly, after the description word is replaced based on the first preset words in the historical description information, "Orange makeup" is replaced with "asd makeup" and "Orange lips" is replaced with "mmc lips".
[0057] In step a2, when replacing the descriptive word of the content object based on the first preset word contained in the first preset word library, it can be determined first whether there is a first preset word corresponding to the descriptive word of the content object in the first correspondence relationship; if so, the descriptive word of the content object is directly replaced based on the determined first preset word to obtain the content description information corresponding to the image; if not, the descriptive word of the content object is replaced based on other first preset words in the first preset word library except some of the first preset words in the first correspondence relationship to obtain the content description information corresponding to the image.
[0058] Among them, when determining whether there is a first preset word corresponding to the descriptive word of the content object in the first corresponding relationship, it can be determined first whether the first corresponding relationship contains the descriptive word to be replaced (that is, the descriptive word of the content object in the current initial content description information). If not, it is directly determined that there is no first preset word corresponding to the descriptive word of the content object in the first corresponding relationship; if the first corresponding relationship contains the descriptive word to be replaced, it can be further determined whether the content object associated with the first preset word corresponding to the descriptive word contained in the first corresponding relationship is the same as the content object described by the descriptive word to be replaced. If they are the same, it is determined that there is a first preset word corresponding to the descriptive word of the content object in the first corresponding relationship.
[0059] Exemplarily, if the content description information is "orange hair" and the descriptive word to be replaced in the content description information is "orange", it is possible to first determine whether "orange" exists in the first correspondence. If so, it is possible to further determine what the content object associated with the first preset word corresponding to "orange" (for example, dfg) in the first correspondence is. If it is "lipstick", which is inconsistent with the content object "hair" in the content description information, then a preset word other than the preset word in the first correspondence (for example, wer) is randomly selected from the first preset word library to replace "orange" in the content description information. The content description information after replacement is "wer hair"; if the content object associated with the first preset word corresponding to "orange" (for example, dfg) is "hair", which is the same as the content object in the content description information, the content description information can be replaced with "dfg hair".
[0060] Furthermore, after replacing the description words of the content object based on other first preset words in the first preset word library except for some of the first preset words in the first corresponding relationship, the first corresponding relationship can also be updated based on the other first preset words and the description words of the content object.
[0061] Specifically, a correspondence between the other first preset words and the description words of the content object may be established in the first correspondence, and the other first preset words may be associated with the content object.
[0062] Continuing with the above example, after replacing "orange" based on "wer", a correspondence between "wer" and "orange" can be established in the first correspondence, and "wer" can be associated with "hair".
[0063] When determining the content description information of other images again, the corresponding first preset word may be determined according to the above method based on the corresponding relationship.
[0064] In one possible implementation, for any image, when determining the style description information corresponding to the image, any of the following methods may be used:
[0065] Method 1: For the style setting instruction of the image, determine the style description information corresponding to the image based on the second preset word carried in the style setting instruction.
[0066] Specifically, the user can select a second preset word from the second preset word library and generate a style setting instruction based on the selected preset word. In this way, the second preset word in the style description information can be directly set.
[0067] Alternatively, in another possible implementation, the user can directly set the style type of the image, and then determine the second preset word corresponding to the style type set by the user based on the second correspondence between the style type and the second preset word in the second preset vocabulary to determine the corresponding style description information of the image.
[0068] For example, if the style type of the image set by the user is style A, and in the second corresponding relationship, the second preset word corresponding to style A is "qwe", then "qwe" can be used as the style description information corresponding to the image.
[0069] If the second preset word corresponding to the style type set by the user is not found in the second correspondence, any other second preset word in the second preset word library except the preset word in the second correspondence can be used as the style description information corresponding to the image.
[0070] Correspondingly, after using any other second preset word in the second preset word library, except the preset word in the second corresponding relationship, as the style description information corresponding to the image, the second corresponding relationship can also be updated based on any other second preset word and the style type.
[0071] Method 2: Perform style detection on the image to determine initial style description information corresponding to the image, and replace the initial style description information based on a second preset word in a second preset word library to obtain style description information corresponding to the image.
[0072] Exemplarily, when performing style detection on the image, the style detection can be performed on the image through a pre-trained style detection model. The initial style description information can be understood as the style type to which the image belongs before the preset word is replaced. The replacement of the initial style description information based on the second preset word in the second preset vocabulary can be based on the second correspondence to replace the initial style description information. The specific replacement method refers to the description in method 1 and will not be repeated here.
[0073] For step 103,
[0074] In one possible implementation, constructing the prompt information corresponding to the image based on the style description information and the content description information corresponding to the image may mean that, for any image, the style description information and the content description information corresponding to the image are spliced in a preset order to obtain the prompt information.
[0075] Exemplarily, the preset order may be that the style description information comes first and the content description information comes second, that is, style description information+content description information.
[0076] The initial stylization model may refer to a pre-trained model, and the process of adjusting the initial stylization model based on the prompt information may be understood as a fine-tuning training process.
[0077] In one possible implementation, the initial stylized model may be a LoRA model. The specific method for constructing the LoRA model will be described below.
[0078] Optionally, when adjusting the initial stylization model based on the prompt information, the prompt information can be input into the initial stylization model to obtain a predicted image output by the initial stylization model, and then the initial stylization model is adjusted based on the predicted image and the prompt information.
[0079] In the Wensheng image scenario, theoretically, after the prompt information is input into the initial stylization model, the image content of the predicted image output by the initial stylization model should be consistent with the prompt information. Therefore, the model performance of the initial stylization model can be reflected by the difference between the image content of the predicted image and the prompt information.
[0080] Specifically, when adjusting the initial stylization model based on the predicted image and the prompt information, the predicted image can be subjected to attribute detection to determine the content description information of the predicted image, and then based on the difference information between the content description information of the predicted image and the prompt information, the loss value in this adjustment process can be determined, and based on the loss value, the initial stylization model can be adjusted.
[0081] In the image-to-image scenario, in addition to the prompt information, the input to the initial stylization model may also include an image corresponding to the prompt information. Theoretically, the difference between the predicted image generated by the initial stylization model based on the prompt information and the image corresponding to the prompt information should be small. Therefore, the difference between the predicted image and the image corresponding to the prompt information can reflect the model performance of the initial stylization model.
[0082] Specifically, when adjusting the initial stylization model, the prompt information can be input into the initial stylization model to obtain a predicted image output by the initial stylization model, and then the first feature of the predicted image and the second feature of the image corresponding to the prompt information can be extracted respectively, and then the feature similarity between the first feature and the second feature is calculated, and the loss value in this adjustment process is determined based on the feature similarity, and the initial stylization model is adjusted based on the loss value.
[0083] Since the prompt information includes style description information, the styles of various images can be explicitly distinguished through the style description information, so that the adjusted complete target stylization model has the ability to generate images of various styles; in addition, since both the style description information and the content description information include preset words, this can avoid the influence of the prior information in the initial stylization model on the generated image, thereby improving the image generation effect.
[0084] In one possible implementation, the initial stylization model is a LoRA model corresponding to the multi-style model; the multi-style model is a pre-trained model; and the target model includes a frozen first parameter in the multi-style model and a second parameter in the adjusted LoRA model.
[0085] The following is a detailed introduction to the construction process of the above initial stylization model and the specific training process.
[0086] First, training data can be obtained, which includes sample images and content description information corresponding to the sample images. The specific method for determining the content description information can refer to the description of the above embodiment. Here, the content description information of the sample image is the description information without the preset word replacement.
[0087] Then, based on the training data, fine-tuning training can be performed on the basis of the basic model to obtain the SD model. The basic model can be, for example, a chilloutmix model, an image generation model based on deep learning.
[0088] Since the SD model's performance may be poor in some aspects after fine-tuning, it can be combined with an open-source style model to create a base model. Here, the base model is the multi-style model described above; the open-source style model can be the same model as the final target stylized model for inference.
[0089] Then, through the method of steps 101 to 103, the prompt information is determined, and the LoRA model is constructed based on the base model, and the LoRA model is trained based on the prompt information. After the LoRA model training is completed, the model parameters frozen in the base model and the model parameters of the trained LoRA model together constitute the target stylized model.
[0090] For a detailed description of the above steps, please refer to the above embodiments and will not be repeated here.
[0091] The image processing method provided by the embodiment of the present disclosure can obtain images in multiple styles, and then construct prompt information corresponding to the image based on the style description information and content description information corresponding to the image; here, since the prompt information contains the style description information, decoupling between different image styles can be achieved. Furthermore, the initial stylization model is adjusted based on the prompt information, and the initial stylization model's ability to distinguish between various styles can be trained, and then target images of multiple styles can be generated through the adjusted target stylization model; in addition, since the initial stylization model is a pre-trained model, it contains relatively rich text prior information, and the style description information contains a first preset word, and the content description information includes a second preset word. In this way, the prior information of the initial stylization model can be eliminated, and the influence of the prior information of common words in the text in the style description information and the content description information on the generated target image can be avoided, thereby improving the effect of generating the image.
[0092] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0093] Based on the same inventive concept, an image processing device corresponding to the image processing method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned image processing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0094] 2 is a schematic diagram of the architecture of an image processing device provided by an embodiment of the present disclosure, wherein the device includes: an acquisition module 201, a determination module 202, and an adjustment module 203; wherein,
[0095] An acquisition module 201 is used to acquire images in various styles;
[0096] Determination module 202, configured to determine style description information and content description information corresponding to the image; wherein the content description information corresponding to the image includes a first preset word, the style description information includes a second preset word, and the style description information corresponding to images of the same style includes the same second preset word;
[0097] The adjustment module 203 is used to construct prompt information corresponding to the image based on the style description information corresponding to the image and the content description information, and adjust the initial stylization model based on the prompt information to obtain a target stylization model, wherein the target stylization model is used to generate target images of the multiple styles.
[0098] In a possible implementation, for any image, the determination module 202, when determining the content description information corresponding to the image, is configured to:
[0099] Performing attribute detection on the image to determine initial content description information corresponding to the image; wherein the initial content description information includes the name of the content object in the image and a descriptive word for the content object;
[0100] The description word of the content object is replaced based on the first preset word contained in the first preset word library to obtain content description information corresponding to the image.
[0101] In a possible implementation, the first preset word library includes first preset words and first correspondences between some of the first preset words and historical description words; wherein the some of the first preset words are associated with the content objects described by the historical description words;
[0102] The determining module 202, when replacing the description word of the content object based on the first preset word included in the first preset word library to obtain the content description information corresponding to the image, is used to:
[0103] determining whether there is a first preset word corresponding to the description word of the content object in the first corresponding relationship;
[0104] If yes, directly replace the description word of the content object based on the determined first preset word to obtain content description information corresponding to the image;
[0105] If not, the description words of the content object are replaced based on the other first preset words in the first preset word library except for some of the first preset words in the first corresponding relationship to obtain content description information corresponding to the image.
[0106] In one possible implementation, the device further includes an updating module 204 for replacing the description words of the content object based on other first preset words in the first preset word library except for some of the first preset words in the first correspondence, and then updating the first correspondence based on the other first preset words and the description words of the content object.
[0107] In one possible implementation, for any image, the determination module 202, when determining the style description information corresponding to the image, is configured to:
[0108] For the style setting instruction of the image, determining the style description information corresponding to the image based on the second preset word carried in the style setting instruction; or,
[0109] Performing style detection on the image to determine initial style description information corresponding to the image, and replacing the initial style description information based on a second preset word in a second preset word library to obtain style description information corresponding to the image.
[0110] In one possible implementation, the adjustment module 203, when adjusting the initial stylized model based on the prompt information, is configured to:
[0111] Inputting the prompt information into the initial stylization model to obtain a predicted image output by the initial stylization model;
[0112] The initial stylization model is adjusted based on the predicted image and the prompt information.
[0113] In a possible implementation, the preset words are words generated based on a random combination of characters; the preset words include other words except the common words included in the common word library.
[0114] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0115] Based on the same technical concept, the embodiment of the present disclosure also provides a computer device. Referring to Figure 3, there is a schematic diagram of the structure of the computer device 300 provided in the embodiment of the present disclosure. The computer device in the embodiment of the present disclosure 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), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc., or various forms of servers, such as independent servers or server clusters. The computer device shown in Figure 3 is only an example and should not bring any limitations to the functions and scope of use of the embodiment of the present disclosure.
[0116] As shown in FIG3 , a computer device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory device (ROM) 302 or a program loaded from a storage device 305 into a random access memory device (RAM) 303. Various programs and data required for the operation of the computer device 300 are also stored in the RAM 303. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0117] Typically, the following devices may be connected to I / O interface 305: input device 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output device 307 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage device 308 including, for example, a magnetic tape, hard disk, etc.; and communication device 309. Communication device 309 may allow computer device 300 to communicate with other devices wirelessly or by wire to exchange data. Although FIG3 illustrates computer device 300 with various devices, it should be understood that not all of the illustrated devices are required to be implemented or present. More or fewer devices may alternatively be implemented or present.
[0118] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the image processing method. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0119] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program executes the steps of the image processing method described in the above method embodiment. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0120] The embodiments of the present disclosure also provide a computer program product, which carries program code. The instructions included in the program code can be used to execute the steps of the image processing method described in the above method embodiment. For details, please refer to the above method embodiment and will not be repeated here.
[0121] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0122] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0123] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0124] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0125] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0126] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure shall be subject to the scope of protection of the claims.
Claims
1. An image processing method, comprising: Get images in multiple styles; Determining style description information and content description information corresponding to the image; wherein the content description information corresponding to the image includes a first preset word, the style description information includes a second preset word, and the second preset words included in the style description information corresponding to the images of the same style are the same; Based on the style description information corresponding to the image and the content description information, the prompt information corresponding to the image is constructed, and based on the prompt information, the initial stylization model is adjusted to obtain a target stylization model, wherein the target stylization model is used to generate target images of the multiple styles.
2. The method according to claim 1, wherein: The determining the content description information corresponding to the image includes: Performing attribute detection on the image to determine initial content description information corresponding to the image; wherein the initial content description information includes the name of the content object in the image and a descriptive word for the content object; The description word of the content object is replaced based on the first preset word included in the first preset word library to obtain content description information corresponding to the image.
3. The method according to claim 2, wherein: The first preset word library includes first preset words, and a first correspondence between some of the first preset words and historical description words; wherein the some of the first preset words are associated with the content object described by the historical description words; The replacing the description word of the content object based on the first preset word included in the first preset word library to obtain the content description information corresponding to the image includes: Determining whether there is a first preset word corresponding to the description word of the content object in the first corresponding relationship; If yes, directly replace the description word of the content object based on the determined first preset word to obtain content description information corresponding to the image; If not, the description words of the content object are replaced based on other first preset words in the first preset word library except for some of the first preset words in the first corresponding relationship to obtain content description information corresponding to the image.
4. The method according to claim 3, wherein: After replacing the description words of the content object based on the other first preset words in the first preset word library except for some of the first preset words in the first corresponding relationship, the method further includes: The first corresponding relationship is updated based on the other first preset words and the description words of the content object.
5. The method according to any one of claims 1 to 4, wherein: For any image, determine the style description information corresponding to the image, including: For the style setting instruction of the image, based on the second preset word carried in the style setting instruction, determine the style description information corresponding to the image; or, Performing style detection on the image to determine initial style description information corresponding to the image, and replacing the initial style description information based on a second preset word in a second preset word library to obtain style description information corresponding to the image.
6. The method according to any one of claims 1 to 5, wherein: The adjusting the initial stylized model based on the prompt information includes: Inputting the prompt information into the initial stylization model to obtain a predicted image output by the initial stylization model; The initial stylization model is adjusted based on the predicted image and the prompt information.
7. The method according to any one of claims 1 to 6, wherein: The preset words are words generated based on random combinations of characters; the preset words are other words except the common words included in the common word library.
8. An image processing device, comprising: An acquisition module, configured to acquire images in multiple styles; a determination module configured to determine style description information and content description information corresponding to the image; wherein the content description information corresponding to the image includes a first preset word, the style description information includes a second preset word, and the second preset word included in the style description information corresponding to the images of the same style is the same; The adjustment module is configured to construct prompt information corresponding to the image based on the style description information corresponding to the image and the content description information, and adjust the initial stylization model based on the prompt information to obtain a target stylization model, wherein the target stylization model is used to generate target images of the multiple styles.
9. A computer device comprising: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the image processing method according to any one of claims 1 to 7 are performed.
10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, executes the steps of the image processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image style conversion model training method and device, and image style conversion method and device
CN113850714A
Image style migration method and device, equipment and storage medium
CN114266943A
Stylized image description generation method based on transfer learning
CN115294427A
Model training method and device, stylized image generation method and device and electronic equipment
CN116309015A
Systems and methods for image style transformation
US20210150310A1