Image generation method, device, electronic device and storage medium
By connecting low-rank adaptive models in series and adjusting the target weight iteratively, the problem of poor quality of virtual makeup test images in the prior art is solved, and higher quality and realistic image generation is achieved.
Patent Information
- Application Number
- CN202411954158.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-01
AI Technical Summary
The existing deep learning models have limitations when dealing with complex and changing clothing and character features, resulting in poor quality of generated virtual makeup test images and inability to effectively integrate the actor's character and costume features.
By concatenating the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model, a second image generation model is formed and iteratively adjusted using target weights until the similarity between the generated image and the target face and the apparel is greater than the preset threshold.
The quality of virtual makeup test images is improved, so that the actor's character features and costume features can be more effectively integrated, and the generated images are more realistic.
Smart Images

Figure CN119741394A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to an image generation method, device, electronic device and storage medium. Background Art
[0002] In the film and television industry, drama production requires not only a good script but also suitable actors. However, identifying potential actors is a time-consuming and laborious task, which requires facing many tedious issues such as inviting actors to try on makeup.
[0003] In the existing technology, based on AI (Artificial Intelligence) technology and using deep learning models, virtual trial makeup images of candidate actors can be generated according to the description information of the candidate actors and trial makeup costumes, thereby reducing the cost of trial and error and speeding up the project progress.
[0004] However, the current deep learning models have certain limitations when dealing with complex and ever-changing costumes and character features, resulting in poor quality of generated images and an inability to effectively integrate the character features and clothing features of the actors, resulting in the generated virtual makeup trial images being not realistic enough. Summary of the invention
[0005] In order to solve the above technical problems, the present application shows an image generation method, device, electronic device and storage medium, so as to at least solve the problem that the deep learning model in the related art cannot effectively integrate the character features and clothing features of the actor, resulting in the generated virtual makeup trial image being not realistic enough. The technical solution of the present disclosure is as follows:
[0006] In a first aspect, the present application provides an image generation method, the method comprising:
[0007] According to the target weight, the first low-rank adaptive model and the second low-rank adaptive model are connected in series after the first image generation model to obtain a second image generation model, wherein the first low-rank adaptive model is obtained based on training of multiple candidate faces, and the second low-rank adaptive model is obtained based on training of multiple candidate clothing;
[0008] Inputting the target text information into the second image generation model for image generation processing to obtain a first generated image, wherein the target text information is used to indicate a target face and target clothing;
[0009] Determine a first similarity between the first generated image and the target face and the target clothing, and iteratively adjust the target weight based on the first similarity until the first similarity is greater than a first preset threshold, and use the first generated image currently obtained as the target generated image.
[0010] In a second aspect, an embodiment of the present invention provides an image generating device, including:
[0011] An acquisition module is used to connect the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model according to the target weight to obtain a second image generation model, wherein the first low-rank adaptive model is obtained based on training of multiple candidate faces, and the second low-rank adaptive model is obtained based on training of multiple candidate clothing;
[0012] A generation module, used for inputting target text information into the second image generation model for image generation processing to obtain a first generated image, wherein the target text information includes description information of a target face and description information of a target clothing;
[0013] An adjustment module is used to determine a first similarity between the first generated image and the target face and the target clothing, and iteratively adjust the target weight based on the first similarity until the first similarity is greater than a first preset threshold, and use the first generated image currently obtained as the target generated image.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0015] processor;
[0016] a memory for storing instructions executable by the processor;
[0017] The processor is configured to execute the instructions to implement any of the above-mentioned image generation methods.
[0018] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium. When instructions in the computer-readable storage medium are executed by a processor of an image generating electronic device, the image generating electronic device can execute any of the above-mentioned image generating methods.
[0019] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which implements any of the above-mentioned image generation methods when executed by a processor.
[0020] Compared with the prior art, this application has the following advantages:
[0021] The first low-rank adaptive model is obtained by training multiple candidate faces, and can efficiently learn and represent the features of the candidate faces, while the second low-rank adaptive model is obtained by training multiple candidate clothing, and can efficiently learn and represent the features of the candidate clothing. In this way, by connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model, the input target text information will be processed by the three models in sequence, and the first generated image will be output, which means that the output of the first image generation model is fine-tuned by using the first low-rank adaptive model and the second low-rank adaptive model, so that the obtained second image generation model can more efficiently learn the features of the candidate faces and candidate clothing, and the first low-rank adaptive model and the second low-rank adaptive model are loaded according to the corresponding target weights, and the target weights can be dynamically adjusted based on the first similarity between the first generated image and the target face and the target clothing, so the image generation effect of the second image generation model can be flexibly controlled according to the target weight, so that the final output target generated image has higher quality, and the target face and target clothing can be effectively integrated together, and the effect is more realistic. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flowchart of the steps of an image generation method of the present application;
[0023] Figure 2 It is a logical schematic diagram of an image generation method of the present application;
[0024] Figure 3 It is a structural block diagram of an image generating device of the present application;
[0025] Figure 4 is a schematic diagram of an electronic device of the present application;
[0026] Figure 5 It is a block diagram of a device for image generation of the present application. DETAILED DESCRIPTION
[0027] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0029] The present application can be applied to a server or a terminal, and the server can be a local server, other servers in the network, etc. The above-mentioned terminal can be a terminal device in various forms such as a mobile phone, a tablet computer, a desktop computer, a portable notebook computer, etc., and the embodiments of the present application are not limited to this.
[0030] The above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.
[0031] Among them, cloud technology refers to a hosting technology that unifies hardware, software, network and other resources in a wide area network or local area network to realize data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application. It can form a resource pool, which is used on demand and flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.
[0032] In some embodiments, the above-mentioned server can also be implemented as a node in a blockchain system. Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0033] In scenarios such as actor makeup trials and product sales, deep learning models can be used to generate virtual makeup trial images of candidate faces based on text descriptions, reducing trial and error costs and speeding up project progress. However, current deep learning models may have certain limitations when dealing with complex and changeable costumes and character features, resulting in poor quality of generated images, and unable to effectively integrate the character features and clothing features of the actors, resulting in the generated virtual makeup trial images being not realistic enough. Based on this, this application proposes an image generation method to solve the above problems.
[0034] Reference Figure 1 , shows a flowchart of the steps of an image generation method of the present application, which may specifically include the following steps:
[0035] In step S11, according to the target weight, the first low-rank adaptive model and the second low-rank adaptive model are connected in series after the first image generation model to obtain a second image generation model, wherein the first low-rank adaptive model is obtained based on training of multiple candidate faces, and the second low-rank adaptive model is obtained based on training of multiple candidate clothing.
[0036] In this step, firstly, the first low-rank adaptive model and the second low-rank adaptive model need to be obtained. The first low-rank adaptive model is obtained by training multiple candidate faces. During the training process, the first low-rank adaptive model can learn the key features of the candidate faces, such as the shape, contour, and skin color of the facial features, through feature extraction, low-rank decomposition and other technologies. The second low-rank adaptive model is obtained by extracting features from multiple candidate clothing. Similarly, during the training process, the second low-rank adaptive model can learn the key features of the candidate clothing, such as style, color, texture, etc., through feature extraction, low-rank decomposition and other technologies.
[0037] Among them, the feature extraction process usually relies on deep learning algorithms, such as Convolutional Neural Networks (CNN) and Long Short-Term Memory (LSTM). The weight matrices of these algorithms are usually very large. Therefore, low-rank decomposition technology can be used to decompose the weight matrix into the product of two or more matrices to reduce the number of parameters and the amount of calculation of the first low-rank adaptive model and the second low-rank adaptive model.
[0038] Then, according to the target weight, the first low-rank adaptive model and the second low-rank adaptive model can be connected in series after the first image generation model to obtain the second image generation model. That is to say, the output of the first image generation model is connected to the input of the first low-rank adaptive model, the output of the first low-rank adaptive model is connected to the input of the second low-rank adaptive model, and the output of the second low-rank adaptive model is the output of the second image generation model. Among them, the order of the first low-rank adaptive model and the second low-rank adaptive model is not limited. This process actually integrates the feature information of the candidate face and the candidate clothing into the first image generation model to obtain a new image generation model, namely the second image generation model, so that the second image generation model can generate a new image based on the feature information of the face and clothing.
[0039] Among them, the initial value of the target weight is usually set before model training. It can be randomly generated or set based on some prior knowledge or experience. The target weight will be adjusted in the subsequent iterative optimization process. The purpose of the adjustment is to make the generated target image more realistic.
[0040] The first low-rank adaptive model and the second low-rank adaptive model usually correspond to different target weights. The target weight is a bridge between the first low-rank adaptive model, the second low-rank adaptive model and the first image generation model, and determines to what extent the first low-rank adaptive model and the second low-rank adaptive model can affect the output of the first image generation model. If the value of the target weight is large, the corresponding first low-rank adaptive model or the second low-rank adaptive model will have a more significant impact on the output of the first image generation model; if the value of the target weight is small, the corresponding first low-rank adaptive model or the second low-rank adaptive model will have a relatively weak impact on the output of the first image generation model.
[0041] For example, the first target weight of the first low-rank adaptive model can be set to 1.0, and the second target weight of the second low-rank adaptive model can be set to 0.8. This means that at the current stage, the first low-rank adaptive model has a greater impact on the output of the first image generation model, while the second low-rank adaptive model has a slightly smaller impact on the output of the first image generation model than the first low-rank adaptive model.
[0042] The first image generation model is a pre-trained image generation model, which can learn the mapping relationship from text information to images, and then accept text information as input and generate corresponding images. For example, the first image generation model may be an AI drawing model.
[0043] In step S12, the target text information is input into the second image generation model for image generation processing to obtain a first generated image, wherein the target text information includes description information of the target face and description information of the target clothing.
[0044] In this step, we first need to obtain the target text information, which is a kind of input information used to guide the image generation process, usually including the description information of the target face and the description information of the target clothing. The target text information may come from the user's input, a preset template or a record in the database.
[0045] Among them, the description information of the target face may include certain characteristics of the target face, such as gender, age, hairstyle, skin color, facial features, etc., or it may be attribute information of the target face, such as name or identity code, etc.; the description information of the target clothing includes the characteristics of the clothing, such as style, color, material, texture, brand, etc.
[0046] It should be noted that, usually, the target face is a known face, such as an actor who is trying on makeup or a customer who is buying goods, while the target clothing may be known or unknown, that is, there may only be description information about the target clothing, but it is impossible to obtain the actual image of the target clothing.
[0047] Then, the target text information can be input into the second image generation model for image generation processing to obtain a first generated image. The second image generation model is a trained text-image model that can accept the target text information as input and generate a corresponding first generated image.
[0048] The first generated image is generated by the second image generation model according to the target text information, and the first generated image has similar features to the target face and target clothing, but there may also be some differences or deficiencies. Therefore, the first generated image needs to be further optimized or adjusted.
[0049] In this way, by combining the target text information and the second image generation model, a variety of images with different styles can be quickly generated, which greatly reduces the cost of trial and error, speeds up project progress, and improves overall production efficiency and quality.
[0050] In step S13, the first similarity between the first generated image and the target face and target clothing is determined, and the target weight is iteratively adjusted based on the first similarity until the first similarity is greater than a first preset threshold, and the currently obtained first generated image is used as the target generated image.
[0051] In this step, it is first necessary to determine the first similarity between the first generated image and the target face and the target clothing. The first similarity is usually achieved by calculating a certain distance or difference between the first generated image and the target face, and between the first generated image and the target clothing, such as Euclidean distance, cosine similarity, etc. The calculation of similarity may involve multiple aspects, including the shape of facial features, skin color, expression, etc., as well as the style, color, texture, etc. of clothing.
[0052] Once the first similarity is determined, the target weight can be adjusted according to the first similarity. The purpose of adjusting the target weight is to make the first generated image closer to the target face and target clothing, thereby improving the first similarity.
[0053] The process of adjusting the target weight is usually iterative, that is, each time the target weight is adjusted, a new first generated image is generated, and the first similarity between it and the target face and the target clothing is calculated, and then the target weight is adjusted again according to the new first similarity, and this is repeated. During the iterative process, it may be necessary to use an optimization algorithm to guide the adjustment of the weight, such as gradient descent, stochastic gradient descent, etc.
[0054] After each iteration, it is necessary to determine whether the first similarity between the current first generated image and the target face and target clothing is greater than a preset threshold (i.e., the first preset threshold). The first preset threshold is set according to actual needs and determines the quality requirements for the first generated image.
[0055] If the first similarity is less than the threshold, it is necessary to continue iterating and adjusting the target weight. If the first similarity is greater than the first preset threshold, it is considered that the first generated image is close enough to the target face and target clothing, and the iteration can be stopped, and the current first generated image is used as the target generated image. The target generated image has met the high similarity requirements with the target face and target clothing, and can be used for subsequent applications or analysis.
[0056] In one implementation, determining a first similarity between the first generated image and a target face and target clothing includes:
[0057] Performing face recognition on the first generated image, and determining the face similarity between the face recognition result and the target face;
[0058] Performing clothing recognition on the first generated image, and determining clothing similarity based on the clothing recognition result;
[0059] Based on the face similarity and the clothing similarity, a first similarity is determined.
[0060] That is to say, it is necessary to first extract facial features from the first generated image and compare them with the known target face to calculate the facial similarity between the face in the first generated image and the target face. Facial similarity is usually expressed by calculating the feature distance between the two, such as Euclidean distance, cosine similarity, etc. The smaller the feature distance, the higher the similarity between the two.
[0061] At the same time, clothing features such as color, texture, style, etc. can be extracted from the first generated image and compared with the known relevant data of the target clothing to calculate the clothing similarity between the clothing in the first generated image and the target clothing. This can also be achieved by calculating the feature distance between the two. In addition, the overall style and matching of the clothing can also be considered to comprehensively evaluate the similarity.
[0062] The data related to the target clothing may be an image of a known target clothing. In the absence of a real image of the target clothing, the data may be an image of other clothing having the same characteristics as the target clothing, or may be text information corresponding to the target clothing, without specific limitation.
[0063] After calculating the face similarity and clothing similarity separately, the two similarities need to be combined to determine the overall first similarity between the first generated image and the target face and target clothing. This can be achieved by weighted summation, averaging, maximum or minimum. The specific method to be selected depends on the actual application scenario and requirements. For example, if face similarity is more important than clothing similarity, a larger weight can be assigned to face similarity; vice versa.
[0064] In this way, by accurately evaluating the similarity between images, the efficiency and accuracy of subsequent tasks can be greatly improved, providing strong support for other image processing tasks.
[0065] In one implementation, the target weight includes a first target weight corresponding to the first low-rank adaptive model and a second target weight corresponding to the second low-rank adaptive model;
[0066] Iteratively adjusting the target weight based on the first similarity includes:
[0067] The first target weight and the second target weight are iteratively adjusted based on the first similarity.
[0068] As can be seen from the above, the target weight determines to what extent the first low-rank adaptive model and the second low-rank adaptive model can affect the output of the first image generation model. In other words, in order to ensure that the obtained second image generation model can produce a high-quality first generated image, the target weight can be iteratively adjusted based on the first similarity. Specifically, this adjustment is usually based on some optimization algorithm, such as gradient descent, genetic algorithm or particle swarm optimization algorithm.
[0069] By repeating the above steps, the first similarity is continuously calculated and the target weight is adjusted until the first similarity is greater than the first preset threshold. In this way, it can be ensured that the obtained second image generation model can more accurately capture the features of the target face and target clothing when generating an image, thereby generating a higher quality first generated image.
[0070] In one implementation, taking the currently obtained first generated image as the target generated image includes:
[0071] Use the feature import model to extract the features of the target face and obtain the facial features;
[0072] The currently obtained first generated image is adjusted based on the facial features to obtain a target generated image.
[0073] Among them, the feature import model is a trained neural network model that can extract facial features of the target face, such as facial features, skin color, expression, etc., for subsequent image fusion tasks. After obtaining the facial features, it is necessary to adjust the current first generated image based on the facial features, and effectively fuse the facial features with the first generated image to obtain the target generated image. For example, the feature import model can be a PULID (Pure and Lightning ID Customization) method model.
[0074] After the above feature extraction and feature fusion steps, a first generated image fused with facial features can be obtained, that is, a target generated image. Compared with the first generated image, the target generated image should be more similar to the target face visually.
[0075] Therefore, by introducing additional facial features for guidance, it is possible to enhance the facial features of the first generated image and reduce the feature pollution between the face and clothing caused by the series connection of the first low-rank adaptive model and the second low-rank adaptive model, so that the target generated image can provide a more realistic and natural visual effect and improve the user experience.
[0076] In one implementation, adjusting the currently obtained first generated image based on the facial features to obtain a target generated image includes:
[0077] Adjusting the currently obtained first generated image based on the facial features to obtain a second generated image;
[0078] Determine a second similarity between the second generated image and the target face, and iteratively adjust the model parameters of the feature import model based on the second similarity until the second similarity is greater than a second preset threshold, and use the currently obtained second generated image as the target generated image.
[0079] That is to say, firstly, it is necessary to adjust the current first generated image based on the facial features extracted from the target face, integrate the facial features of the target face into the first generated image, while keeping other parts of the first generated image unchanged or changing as little as possible.
[0080] After fusion, a second generated image containing the facial features of the target face can be obtained. The second generated image is visually closer to the target face than the first generated image. Then, the second similarity between the second generated image and the target face needs to be determined. The second similarity is usually achieved by calculating the feature distance between the two, such as Euclidean distance, cosine similarity, etc.
[0081] If the similarity between the second generated image and the target face is less than a preset threshold (ie, the second preset threshold), it is necessary to adjust the model parameters of the feature import model to improve the extraction and fusion effect of facial features.
[0082] The process of adjusting the model parameters of the feature import model is usually performed iteratively. In each iteration, the model parameters of the feature import model are updated according to the current second similarity, and a new second generated image is generated. Then, the second similarity between the new second generated image and the target face is calculated again, and the model parameters are further adjusted according to the new second similarity.
[0083] This iterative process will continue until the second similarity between the second generated image and the target face is greater than the second preset threshold. At this point, the second generated image currently obtained can be used as the target generated image. The target generated image is highly similar to the target face and also retains other useful information in the first generated image, such as clothing, background, etc., making the target generated image more natural and realistic visually.
[0084] In one implementation, before step S11, the method further includes:
[0085] Acquire multiple sample face images, where the sample face images include images of each candidate face corresponding to different clothing, and there are multiple candidate faces;
[0086] The first initial model is trained based on the face sample image to obtain a first low-rank adaptive model.
[0087] That is to say, firstly, it is necessary to obtain multiple sample face images as training data, train the first initial model, and obtain the first low-rank adaptive model, wherein the first initial model is usually a LoRA (Low-Rank Adaptation) model. The sample face images contain rich diversity to cover different faces.
[0088] The face sample images include multiple images of each candidate face corresponding to different costumes, that is, for each candidate face, multiple images of the candidate face wearing different costumes are included. This can ensure that in the subsequent first low-rank adaptive model training process, the first low-rank adaptive model can focus on the same elements and learn more about the features of the candidate face from the multiple images of each candidate face corresponding to different costumes, rather than the features of different costumes.
[0089] By performing feature extraction and low-rank decomposition processing on face sample images, a first low-rank adaptive model can be trained, and the first low-rank adaptive model can learn the key features in the face images.
[0090] In one implementation, obtaining a plurality of sample face images includes:
[0091] Obtaining a first initial image of each candidate face, and determining a clothing region of the first initial image;
[0092] The clothing area is redrawn using different clothing drawing parameters to obtain multiple images of each candidate face corresponding to different clothing as face sample images.
[0093] That is to say, firstly, for each candidate face, a first initial image can be obtained. The first initial image may be obtained from a database or image library, or may be obtained by shooting. Next, the clothing area in the first initial image needs to be determined.
[0094] Once the clothing area is determined, different clothing drawing parameters can be used to redraw the clothing area. For example, after the clothing area is determined, the clothing area in the first initial image can be separated from other areas to form a clothing mask. Usually, the size of the clothing mask is the same as the first initial image, where the position corresponding to the clothing area can be marked as a non-zero value, and other positions are marked as 0, so as to easily identify and process the clothing area. Then, the new clothing texture drawn based on the clothing drawing parameters can be applied to the position marked as a non-zero value in the clothing mask, and the position marked as 0 in the clothing mask retains the corresponding pixel point in the first initial image to obtain a face sample image. In this way, in the process of generating the face sample image, other areas can be kept unchanged and only the clothing area can be changed, so that in the subsequent first low-rank adaptive model training process, the first low-rank adaptive model can focus on the same elements and learn more features of the candidate face from multiple images of each candidate face corresponding to different clothing.
[0095] The clothing drawing parameters include clothing style, color or texture, etc. According to different clothing drawing parameters, the clothing of the candidate face in the first initial image can be changed to generate images of the candidate face wearing different clothing. During the drawing process, it may be necessary to use image processing software or algorithms to automatically or semi-automatically complete this task. For example, an image editing tool can be used to manually adjust the color, texture or style of the clothing area, or a deep learning model can be used to automatically generate a new clothing style.
[0096] Each drawing will generate an image of the candidate face wearing different clothes. Then, after multiple drawings, multiple images of each candidate face corresponding to different clothes can be obtained. These images will be used as input for subsequent training tasks, that is, face sample images.
[0097] In one implementation, training a first initial model based on a sample face image to obtain a first low-rank adaptive model includes:
[0098] The third image generation model and the first initial model are connected in series to obtain a fourth image generation model, wherein the third image generation model has the same model structure as the first image generation model;
[0099] Using the pre-acquired attribute information of each candidate face as first prompt information of the corresponding face sample image, inputting the first prompt information into the fourth image generation model to obtain a first predicted image;
[0100] Determine a first loss value between the face sample image and the first predicted image, and iteratively adjust the model parameters of the first initial model based on the first loss value until the first loss value is less than a third preset threshold, and use the currently obtained first initial model as the first low-rank adaptive model.
[0101] That is to say, the training of the first low-rank adaptive model is implemented based on the third image generation model. The third image generation model has the same model structure as the first image generation model, or the third image generation model and the first image generation model can be the same model to ensure that the trained first low-rank adaptive model can be connected in series with the first image generation model. After the third image generation model loads the first initial model, the fourth image generation model is obtained.
[0102] Then, it is necessary to obtain the attribute information of each candidate face and use it as the first prompt information of the corresponding face sample image. Therefore, the first prompt information may include the name, gender, age, race and other attribute information of the candidate face, which will be used to guide the fourth image generation model to generate a first predicted image that matches the attribute information.
[0103] The first prompt information is input into the fourth image generation model to obtain a first predicted image. The first predicted image is generated according to the first prompt information, matches the attribute information in the first prompt information, and is visually as close as possible to the real candidate face image corresponding to the first prompt information.
[0104] Next, it is necessary to determine the first loss value between the face sample image and the first predicted image. The first loss value is used to measure the difference between the first predicted image and the real face sample image, and may include multiple types of losses such as pixel-level loss, feature-level loss, and adversarial loss.
[0105] Based on this loss value, the model parameters of the first initial model can be iteratively adjusted. This adjustment process may include algorithms such as gradient descent and stochastic gradient descent. By continuously adjusting the first initial model, the first predicted image can be gradually approached to the real face sample image, thereby reducing the first loss value.
[0106] When the first loss value is less than the third preset threshold, it is considered that the current first predicted image is sufficiently close to the real face sample image, and thus, the current first initial model can be used as the first low-rank adaptive model.
[0107] In one implementation, according to the target weight, the first low-rank adaptive model and the second low-rank adaptive model are connected in series after the first image generation model and before the second image generation model is obtained, further comprising:
[0108] Acquire multiple clothing sample images, where the clothing sample images include images of each candidate clothing corresponding to a different face, and there are multiple candidate clothing;
[0109] The second initial model is trained based on the clothing sample images to obtain a second low-rank adaptive model.
[0110] That is to say, firstly, it is necessary to obtain a plurality of clothing sample images as training data, train the second initial model, and obtain the second low-rank adaptive model, wherein the second initial model is usually a LoRA model. The clothing sample images contain rich diversity to cover different clothing.
[0111] The clothing sample images include multiple images of each candidate clothing corresponding to different faces. That is, for each candidate clothing, there are multiple images of different faces wearing the candidate clothing. This ensures that in the subsequent training process of the second low-rank adaptive model, the second low-rank adaptive model can focus on the same elements and learn more about the features of the candidate clothing from the multiple images of each candidate clothing corresponding to different faces, rather than the features of different faces.
[0112] By performing feature extraction and low-rank decomposition processing on clothing sample images, a second low-rank adaptive model can be trained, and the second low-rank adaptive model can learn the key features in the clothing sample images.
[0113] In one implementation, obtaining a plurality of clothing sample images includes:
[0114] For each second initial image of the candidate clothing, determining a face region of the second initial image;
[0115] The face area is redrawn using different face drawing parameters to obtain multiple images of each candidate clothing corresponding to different faces as clothing sample images.
[0116] That is to say, for each candidate clothing, its second initial image also needs to be obtained. The second initial image may also be obtained from a database or image library, or may be obtained by shooting. Next, the face area in the second initial image needs to be determined.
[0117] Once the face region is determined, different face rendering parameters can be used to redraw the face region. The face rendering parameters include parameters such as gender, age, and skin color of the face. By redrawing, the features of the face in the second initial image can be changed to generate images of different faces wearing the same candidate clothing.
[0118] The drawing of the face area can be done automatically or semi-automatically using image processing software or algorithms. Each redrawing will produce an image of a face different from the candidate face wearing the candidate clothing. After multiple redrawings, multiple images of different faces wearing the same candidate clothing can be obtained. These images will also serve as input for subsequent training tasks, that is, clothing sample images.
[0119] In one implementation, the second initial model is trained based on the clothing image to obtain a second low-rank adaptive model, including:
[0120] The fifth image generation model is connected in series with the second initial model to obtain a sixth image generation model, wherein the fifth image generation model has the same model structure as the first image generation model;
[0121] Inputting the clothing sample image into the feature recognition model for analysis to obtain second prompt information corresponding to the clothing sample image;
[0122] Inputting the second prompt information into the sixth image generation model to obtain a second predicted image;
[0123] Determine a second loss value between the clothing sample image and the second predicted image, and iteratively adjust the model parameters of the second initial model based on the second loss value until the second loss value is less than a fourth preset threshold, and use the currently obtained second initial model as the second low-rank adaptive model.
[0124] That is, a fifth image generation model is first introduced. The fifth image generation model has the same model structure as the first image generation model, or the fifth image generation model and the first image generation model can be the same model, so as to ensure that the trained second low-rank adaptive model can be connected in series with the first image generation model.
[0125] Next, the second initial model is loaded into the fifth image generation model to obtain the sixth image generation model. Then, the clothing sample image needs to be input into the feature recognition model for analysis. This feature recognition model may be a multimodal deep learning model, such as a convolutional neural network (CNN) or a recurrent neural network (RNN), which can extract a description of the clothing from the clothing sample image as the second prompt information.
[0126] Through the analysis of the feature recognition model, the second prompt information corresponding to the clothing sample image can be obtained. The second prompt information may include feature information such as clothing style, color, material, texture, etc., which will be used to guide subsequent image generation tasks.
[0127] Then, the second prompt information is input into the sixth image generation model to obtain a second predicted image. The second predicted image is generated according to the second prompt information, matches the clothing features in the second prompt information, and is visually as close to the real clothing image as possible.
[0128] Next, it is necessary to determine the second loss value between the clothing image and the second predicted image. This loss value is used to measure the degree of difference between the predicted image and the real clothing sample image. It may include multiple types of losses such as pixel-level loss, feature-level loss, adversarial loss, etc. By calculating the second loss value, the performance of the current sixth image generation model can be evaluated and a basis for subsequent iterative adjustments can be provided.
[0129] Based on the second loss value, the second initial model can be iteratively adjusted. This adjustment process may include algorithms such as gradient descent and stochastic gradient descent. By continuously adjusting the second initial model, the second predicted image can be gradually approached to the real clothing sample image, thereby reducing the second loss value.
[0130] When the second loss value is less than the fourth preset threshold, it is considered that the current second predicted image is sufficiently close to the actual clothing sample image, and the current second initial model can be used as the second low-rank adaptive model.
[0131] Figure 2 It is a logic diagram of an image generation method in a specific embodiment of the present application, which includes the following steps:
[0132] Redrawing costumes of actor dataset: The actor face dataset is used as a set of the first initial images, and the actor face dataset is redrawn. Specifically, the actor face data is masked with clothing to keep the actor's facial features unchanged, and the clothing area is redrawn using the clothing mask to generate images of each actor wearing clothing of different styles and colors. The expanded actor dataset is used as the face sample image.
[0133] Redrawing faces in clothing dataset: The clothing dataset serves as a collection of the second initial images. The clothing dataset obtains the face area through the face recognition model, and redraws the face area to make different faces appear on the same piece of clothing, expanding the original clothing dataset as a clothing sample image.
[0134] Automatic labeling with a multimodal large model: Based on the expanded actor dataset, a unified actor name is used as the first prompt information, and a multimodal large model is used to automatically generate a unified second prompt information about the same clothing in the expanded clothing dataset.
[0135] LoRA model concatenation of raw images: train the actor's facial feature LoRA and clothing LoRA respectively as the first low-rank adaptive model and the second low-rank adaptive model; concatenate the trained actor's facial feature LoRA and clothing LoRA models with the AI drawing model, and set the first target weight of the actor's facial feature LoRA to 1.0, and the second target weight of the clothing LoRA to 0.8; input the target actor's name and description of the target clothing as the target text information, generate the actor's clothing fusion effect picture, and obtain the actor's clothing fusion effect picture of the target actor wearing the target clothing as the first generated image.
[0136] The face recognition model obtains the face similarity score: the face recognition model is used to generate the actor costume fusion effect map, and the public image of the target actor is used as the target face, and compared with the target face to obtain the face similarity score as the face similarity.
[0137] The clothing recognition model obtains the clothing similarity score: the pre-trained clothing recognition model is used to identify the generated actor clothing fusion effect image and obtain the clothing similarity score as the clothing similarity.
[0138] Dynamically adjust LoRA weights: According to the score weights set by the user, the face similarity score and the clothing similarity score are weighted and summed to obtain the final total score as the first similarity; through the first preset threshold set by the user, the first target weight and the second target weight are dynamically adjusted until the final total score meets the total score threshold set by the user.
[0139] The PULID method introduces external features: the public image of the target actor imported by the user is used as the external source of facial features. The facial features of the target actor are imported into the LoRA model concatenated raw image process through the PULID method. The actor's clothing fusion effect image is adjusted based on the facial features to obtain the second generated image.
[0140] Dynamically adjust PULID parameters: For the adjusted actor-clothing fusion effect picture, use the face recognition model to compare it with the actor's public image to obtain the second similarity; compare it with the second preset threshold set by the user to dynamically adjust the parameters in the PULID method and re-produce the image until the second similarity of the actor-clothing fusion effect picture is greater than the second preset threshold, and use it as the target image generation.
[0141] As can be seen from the above, the technical solution provided by the embodiment of the present disclosure is that the first low-rank adaptive model is obtained by training multiple candidate faces, and can efficiently learn and represent the features of the candidate faces, while the second low-rank adaptive model is obtained by training multiple candidate clothing, and can efficiently learn and represent the features of the candidate clothing. In this way, by connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model, the input target text information will be processed by the three models in sequence, and the first generated image will be output, which means that the output of the first image generation model is fine-tuned by using the first low-rank adaptive model and the second low-rank adaptive model, so that the second image generation model can learn the features of the candidate faces and candidate clothing more efficiently, and the first low-rank adaptive model and the second low-rank adaptive model are loaded according to the corresponding target weights, and the target weights can be dynamically adjusted based on the first similarity between the first generated image and the target face and the target clothing, so the image generation effect of the second image generation model can be flexibly controlled according to the target weight, so that the final output target generated image has higher quality, and the target face and target clothing can be effectively integrated together, and the effect is more realistic.
[0142] Reference Figure 3 , shows a schematic diagram of the structure of an image generating device of the present application, which may specifically include:
[0143] An acquisition module 201 is used to load the first low-rank adaptive model and the second low-rank adaptive model into the first image generation model according to the target weight to obtain the second image generation model, wherein the first low-rank adaptive model is obtained based on feature extraction of multiple candidate faces, and the second low-rank adaptive model is obtained based on feature extraction of multiple candidate clothing;
[0144] A generation module 202, configured to input target text information into the second image generation model for image generation processing to obtain a first generated image, wherein the target text information is used to indicate a target face and target clothing;
[0145] The adjustment module 203 is used to determine the first similarity between the first generated image and the target face and the target clothing, and iteratively adjust the target weight based on the first similarity until the first similarity is greater than a first preset threshold, and use the first generated image currently obtained as the target generated image.
[0146] As can be seen from the above, the technical solution provided by the embodiment of the present disclosure is that the first low-rank adaptive model is obtained by training multiple candidate faces, and can efficiently learn and represent the features of the candidate faces, while the second low-rank adaptive model is obtained by training multiple candidate clothing, and can efficiently learn and represent the features of the candidate clothing. In this way, by connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model, the input target text information will be processed by the three models in sequence, and the first generated image will be output, which means that the output of the first image generation model is fine-tuned by using the first low-rank adaptive model and the second low-rank adaptive model, so that the second image generation model can learn the features of the candidate faces and candidate clothing more efficiently, and the first low-rank adaptive model and the second low-rank adaptive model are loaded according to the corresponding target weights, and the target weights can be dynamically adjusted based on the first similarity between the first generated image and the target face and the target clothing, so the image generation effect of the second image generation model can be flexibly controlled according to the target weight, so that the final output target generated image has higher quality, and the target face and target clothing can be effectively integrated together, and the effect is more realistic.
[0147] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0148] Figure 4 It is a block diagram of an electronic device for image generation according to an exemplary embodiment, including a processor and a memory, wherein the memory is used to store computer programs; and the processor is used to execute the programs stored in the memory.
[0149] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0150] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0151] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to perform the above method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0152] In an exemplary embodiment, a computer program product is also provided. When the computer program product is executed on a computer, the computer implements the above-mentioned method for generating a comment image.
[0153] As can be seen from the above, the technical solution provided by the embodiment of the embodiment of the present invention is that the first low-rank adaptive model is obtained by training multiple candidate faces, and can efficiently learn and represent the features of the candidate faces, while the second low-rank adaptive model is obtained by training multiple candidate clothing, and can efficiently learn and represent the features of the candidate clothing. In this way, by connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model, the input target text information will be processed by the three models in sequence, and the first generated image will be output, which means that the output of the first image generation model is fine-tuned by using the first low-rank adaptive model and the second low-rank adaptive model, so that the obtained second image generation model can learn the features of the candidate faces and candidate clothing more efficiently, and the first low-rank adaptive model and the second low-rank adaptive model are loaded according to the corresponding target weights, and the target weights can be dynamically adjusted based on the first similarity between the first generated image and the target face and the target clothing, so the image generation effect of the second image generation model can be flexibly controlled according to the target weight, so that the final output target generated image has higher quality, and the target face and target clothing can be effectively integrated together, and the effect is more realistic.
[0154] Figure 5 is a block diagram of a device 800 for image generation according to an exemplary embodiment.
[0155] For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast electronic device, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0156] Reference Figure 5 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0157] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0158] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0159] The power supply component 807 provides power to the various components of the device 800. The power supply component 807 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0160] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the account. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the account. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data to be processed. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0161] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0162] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0163] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0164] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0165] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the methods described in the first and second aspects.
[0166] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to complete the above method. Optionally, for example, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0167] In an exemplary embodiment, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer is enabled to execute the image generating method described in any one of the above embodiments.
[0168] As can be seen from the above, the technical solution provided by the embodiment of the embodiment of the present invention is that the first low-rank adaptive model is obtained by training multiple candidate faces, and can efficiently learn and represent the features of the candidate faces, while the second low-rank adaptive model is obtained by training multiple candidate clothing, and can efficiently learn and represent the features of the candidate clothing. In this way, by connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model, the input target text information will be processed by the three models in sequence, and the first generated image will be output, which means that the output of the first image generation model is fine-tuned by using the first low-rank adaptive model and the second low-rank adaptive model, so that the obtained second image generation model can learn the features of the candidate faces and candidate clothing more efficiently, and the first low-rank adaptive model and the second low-rank adaptive model are loaded according to the corresponding target weights, and the target weights can be dynamically adjusted based on the first similarity between the first generated image and the target face and the target clothing, so the image generation effect of the second image generation model can be flexibly controlled according to the target weight, so that the final output target generated image has higher quality, and the target face and target clothing can be effectively integrated together, and the effect is more realistic.
[0169] Those skilled in the art will readily appreciate other implementations of the embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The embodiments of the present invention are intended to cover any variations, uses, or adaptations of the embodiments of the present invention that follow the general principles of the embodiments of the present invention and include common knowledge or customary technical means in the art that are not disclosed in the embodiments of the present invention. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the embodiments of the present invention are indicated by the following claims.
[0170] It should be understood that the embodiments of the present invention are not limited to the precise structures described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the embodiments of the present invention is limited only by the appended claims.
Claims
1. An image generation method, characterized in that: include: According to the target weight, the first low-rank adaptive model and the second low-rank adaptive model are connected in series after the first image generation model to obtain a second image generation model, wherein the first low-rank adaptive model is obtained based on training of multiple candidate faces, and the second low-rank adaptive model is obtained based on training of multiple candidate clothing; Inputting the target text information into the second image generation model for image generation processing to obtain a first generated image, wherein the target text information includes description information of the target face and description information of the target clothing; Determine a first similarity between the first generated image and the target face and the target clothing, and iteratively adjust the target weight based on the first similarity until the first similarity is greater than a first preset threshold, and use the first generated image currently obtained as the target generated image.
2. The method according to claim 1, characterized in that The determining of a first similarity between the first generated image and the target face and the target clothing includes: Performing face recognition on the first generated image, and determining the face similarity between the face recognition result and the target face; Performing clothing recognition on the first generated image, and determining clothing similarity based on the clothing recognition result; Based on the face similarity and the clothing similarity, a first similarity is determined.
3. The method according to claim 1, characterized in that The target weight includes a first target weight corresponding to the first low-rank adaptive model and a second target weight corresponding to the second low-rank adaptive model; The iteratively adjusting the target weight based on the first similarity comprises: The first target weight and the second target weight are iteratively adjusted based on the first similarity.
4. The method according to claim 1, characterized in that: The step of using the currently obtained first generated image as a target generated image includes: Extracting features of the target face using a feature import model to obtain facial features; The first generated image currently obtained is adjusted based on the facial features to obtain a target generated image.
5. The method according to claim 4, characterized in that The step of adjusting the first generated image currently obtained based on the facial features to obtain a target generated image includes: Adjusting the first generated image currently obtained based on the facial features to obtain a second generated image; Determine a second similarity between the second generated image and the target face, and iteratively adjust the model parameters of the feature import model based on the second similarity until the second similarity is greater than a second preset threshold, and use the second generated image currently obtained as the target generated image.
6. The method according to claim 1, characterized in that The method of connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model and before obtaining the second image generation model according to the target weight further includes: Acquire multiple sample face images, wherein the sample face images include images of each candidate face corresponding to different clothing, and there are multiple candidate faces; The first initial model is trained based on the face sample image to obtain a first low-rank adaptive model.
7. The method according to claim 6, characterized in that The obtaining of multiple face sample images includes: Acquire a first initial image of each candidate face, and determine a clothing region of the first initial image; The clothing area is redrawn using different clothing drawing parameters to obtain multiple images of each candidate face corresponding to different clothing as face sample images.
8. The method according to claim 6, characterized in that The step of training the first initial model based on the face sample image to obtain a first low-rank adaptive model includes: Connecting the third image generation model and the first initial model in series to obtain a fourth image generation model, wherein the third image generation model has the same model structure as the first image generation model; Using the pre-acquired attribute information of each candidate face as first prompt information of the corresponding face sample image, inputting the first prompt information into the fourth image generation model, and obtaining a first predicted image; Determine a first loss value between the face sample image and the first predicted image, and iteratively adjust the model parameters of the first initial model based on the first loss value until the first loss value is less than a third preset threshold, and use the first initial model currently obtained as the first low-rank adaptive model.
9. The method according to claim 1, characterized in that: The method of connecting the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model and before obtaining the second image generation model according to the target weight further includes: Acquire multiple clothing sample images, wherein the clothing sample images include images of each candidate clothing corresponding to a different face, and there are multiple candidate clothing; The second initial model is trained based on the clothing sample images to obtain a second low-rank adaptive model.
10. The method according to claim 9, characterized in that The step of obtaining a plurality of clothing sample images comprises: For each second initial image of the candidate clothing, determining a face region of the second initial image; The face region is redrawn using different face drawing parameters to obtain multiple images of each candidate clothing corresponding to different faces as clothing sample images.
11. The method according to claim 9, characterized in that The step of training the second initial model based on the clothing image to obtain a second low-rank adaptive model includes: Connecting the fifth image generation model and the second initial model in series to obtain a sixth image generation model, wherein the fifth image generation model has the same model structure as the first image generation model; Inputting the clothing sample image into a feature recognition model for analysis to obtain second prompt information corresponding to the clothing sample image; Inputting the second prompt information into the sixth image generation model to obtain a second predicted image; Determine a second loss value between the clothing sample image and the second predicted image, and iteratively adjust the model parameters of the second initial model based on the second loss value until the second loss value is less than a fourth preset threshold, and use the second initial model currently obtained as the second low-rank adaptive model.
12. An image generating device, characterized in that: include: An acquisition module is used to connect the first low-rank adaptive model and the second low-rank adaptive model in series after the first image generation model according to the target weight to obtain a second image generation model, wherein the first low-rank adaptive model is obtained based on training of multiple candidate faces, and the second low-rank adaptive model is obtained based on training of multiple candidate clothing; A generation module, used for inputting target text information into the second image generation model for image generation processing to obtain a first generated image, wherein the target text information includes description information of a target face and description information of a target clothing; An adjustment module is used to determine a first similarity between the first generated image and the target face and the target clothing, and iteratively adjust the target weight based on the first similarity until the first similarity is greater than a first preset threshold, and use the first generated image currently obtained as the target generated image.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the image generating method according to any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image generation method according to any one of claims 1 to 11 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the image generating method according to any one of claims 1 to 11 is implemented.