Methods for generating and changing avatars
By determining the text description information and image vector of the face image, the pre-trained Vincentian graph model is used to generate a cross-species avatar containing facial features, which solves the problem of a single avatar replacement method in the existing technology and achieves personalized user experience and Improved feature richness.
Patent Information
- Application Number
- CN202310086661.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-19
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2043-01-19
AI Technical Summary
In the existing technology, the user avatar replacement method is relatively fixed, and it is difficult to personalizedly generate cross-species avatars containing facial features, which limits the richness of user experience and product functions.
By determining the text description information and image vector of the face image, the pre-trained Vincentian graph model is used to generate the target species avatar corresponding to the target face, ensuring that the generated avatar contains facial features and species features.
It realizes the personalized generation of user-specific cross-species avatars, improves the user experience and entertainment fun of product functions, and enhances the core competitiveness of the avatar generation function.
Smart Images

Figure CN116110099B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to technical fields such as artificial intelligence, deep learning, and cloud computing. Background Art
[0002] Almost all current applications can customize user avatars, which can bring users a better experience. However, the current avatar change methods are relatively fixed. One method is to give some default images to users as avatars, and the other method is to use pictures uploaded by users as avatars. Summary of the invention
[0003] The present invention provides a method for generating an avatar and a method for replacing an avatar.
[0004] According to one aspect of the present disclosure, a method for generating an avatar is provided, comprising:
[0005] Determine first text description information according to the facial image of the target face; wherein the first text description information is at least used to characterize facial features of the facial image;
[0006] Determining a first image vector of the face image; and
[0007] A pre-trained vincent graph model corresponding to the target species is used to generate a target species avatar corresponding to the target human face according to the first image vector and the first text description information; wherein the target species avatar includes facial features corresponding to the human face features.
[0008] According to another aspect of the present disclosure, a method for replacing an avatar is provided, which is applied to an application program of a terminal, and includes:
[0009] In response to a user's avatar replacement instruction, determining a target species that the user needs to convert and a face image uploaded by the user; and
[0010] According to the human face image and the target species, the avatar generation method of any embodiment of the present disclosure is used to generate an avatar of the target species to be replaced by the user; wherein the avatar of the target species to be replaced includes facial features corresponding to the human face features.
[0011] According to another aspect of the present disclosure, there is provided a device for generating an avatar, comprising:
[0012] A first determination module is used to determine first text description information according to a facial image of a target face; wherein the first text description information is at least used to characterize facial features of the facial image;
[0013] A second determining module, configured to determine a first image vector of a face image; and
[0014] The first generation module is used to generate a target species avatar corresponding to a target human face by using a pre-trained vincent graph model corresponding to the target species according to the first image vector and the first text description information; wherein the target species avatar includes facial features corresponding to the human face features.
[0015] According to another aspect of the present disclosure, there is provided a device for changing an avatar, which is applied to an application program of a terminal, and includes:
[0016] A response module, for responding to a user's avatar change instruction, determining a target species that the user needs to convert and a face image uploaded by the user; and
[0017] The second generation module is used to generate a target species avatar to be replaced by the user based on the human face image and the target species, using the avatar generation method of any embodiment of the present disclosure; wherein the target species avatar to be replaced contains facial features corresponding to human face features.
[0018] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any method in the embodiments of the present disclosure.
[0022] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any method according to the embodiments of the present disclosure.
[0023] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.
[0024] According to the technology disclosed in the present invention, by migrating the facial features of a target face to a target species, a cross-species avatar exclusive to the target face can be generated.
[0025] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0027] Figure 1 is a flowchart of a method for generating an avatar according to an embodiment of the present disclosure;
[0028] Figure 2 is an application schematic diagram of the method for generating an avatar according to an embodiment of the present disclosure;
[0029] Figure 3 is a flowchart of a method for generating an avatar according to an embodiment of the present disclosure;
[0030] Figure 4 is a flowchart of a method for generating an avatar according to an embodiment of the present disclosure;
[0031] Figure 5 is a flowchart of a method for replacing an avatar according to an embodiment of the present disclosure;
[0032] Figure 6 is a schematic diagram of a device for generating an avatar according to an embodiment of the present disclosure;
[0033] Figure 7 is a schematic diagram of a device for replacing an avatar according to an embodiment of the present disclosure;
[0034] Figure 8 It is a block diagram of an electronic device used to implement the method for generating an avatar and / or the method for replacing an avatar according to the embodiments of the present disclosure. DETAILED DESCRIPTION
[0035] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0036] like Figure 1 As shown, the embodiment of the present disclosure provides a method for generating an avatar, including:
[0037] Step S101: Determine first text description information according to a face image of a target face, wherein the first text description information is at least used to characterize face features of the face image.
[0038] Step S102: Determine a first image vector of the face image. And
[0039] Step S103: using the pre-trained vincent graph model corresponding to the target species, according to the first image vector and the first text description information, generating a target species avatar corresponding to the target human face, wherein the target species avatar includes facial features corresponding to the human face features.
[0040] According to the embodiments of the present disclosure, it should be noted that:
[0041] The method for generating an avatar according to the embodiment of the present disclosure can be applied to the avatar changing scenario of an application (app). Currently, almost all apps can replace the user avatar that is configured to the user by default in the application when the user logs in. Through the method of the embodiment of the present disclosure, the user can replace an exclusive cross-species avatar that contains the user's own facial features. The method for generating an avatar according to the embodiment of the present disclosure can also be applied to the user's picture beautification or picture retouching scenarios. When the user does not want to show his or her real face in the photo, but wants to reflect his or her presence in the photo, the method of the embodiment of the present disclosure can be used to replace the image of the user's head area (i.e., avatar) in the photo with a cross-species avatar containing the user's own facial features.
[0042] A face image can be understood as an image that contains only the face area, or an image in which most of the area is occupied by the face area. A face image can be an image obtained by directly capturing the target face, or an image obtained by segmenting and cropping an image containing the target face.
[0043] The first text description information (text prompt) at least includes information related to the facial features represented by the facial image. The first text description information may be information generated based on one or more facial features in the facial image, and these facial features are combined into a text description information to guide the text graph model to generate an avatar of the target species with the facial features of the target face. Figure 2 As shown in the face image on the left, the face features include the gender feature that the face is male, the facial expression feature that the mouth of the face is smiling, the facial accessory feature that the face is wearing glasses, and the hair feature that the face has side bangs. Figure 2 The first text description information generated from the facial features shown in the facial image on the left side of the figure may be "the face is a smiling male with side bangs and glasses". In addition to information related to the facial features, the first text description information may also include information related to the target species avatar to be generated, for example, avatar style information, according to which the style and image clarity of the target species avatar to be generated may be determined.
[0044] The facial features in the facial image can be extracted from the facial image using deep learning technology. The specific method of extracting the facial features from the facial image can be any method in the prior art, which is not specifically limited here.
[0045] The facial features may include at least one of facial accessory features, hair features, skin color features, eye features, expression features, gender features, age features and face shape features. Among them, facial accessory features may include: whether to wear glasses, the shape of glasses (for example, square glasses, round glasses, oval glasses, etc.), the type of glasses (for example, goggles, sunglasses, ordinary glasses, etc.), whether to wear earrings, the shape of earrings, etc. Hair features may include: whether there is hair, whether there is bangs, the length of hair, hair color, whether there is a beard, the shape of beard, the position of beard, etc. Skin color features include: skin color (for example, black skin color, yellow skin color, white skin color, etc.). Eye features include: big eyes, small eyes, open eyes, closed eyes, etc. Expression features include: no expression, happy expression (for example, smiling, laughing), sad expression, etc. Gender features: gender male or female. Age features: children, youth, middle-aged, elderly, etc. Face shape features: square face, round face, pointed face, etc.
[0046] The first image vector can be understood as a potential representation extracted based on the face image and used to characterize the face image.
[0047] Target species can be understood as animals and / or plants. Animals can include rabbits, cats, dogs, birds, etc. Plants can include flowers, trees, etc.
[0048] The pre-trained Vincent graph model corresponding to the target species can be understood as a Vincent graph model that can generate an image of the target species. The Vincent graph model can adopt any model in the prior art that can generate an image based on a text description, and is not specifically limited here. For example, the Vincent graph model can adopt any one of the cross-modal generation model (ernie-vilg), the stable diffusion model (stable diffusion), the first generation image generation model (DALLE) and the second generation image generation model (DALLE-2).
[0049] The target species avatar corresponding to the target human face can be understood as a cross-species avatar that combines the facial features of the target human face with the facial features of the target species, and contains both the facial features of the human face and the characteristics of the species itself. Figure 2 As shown, Figure 2 The image on the right is a very cute personal rabbit avatar corresponding to the target face. The target species avatar contains both the facial features of the rabbit (target species) and the Figure 2 Facial features of the face image on the middle left (wearing glasses, bangs, smiling, big eyes).
[0050] According to the technology of the embodiment of the present disclosure, it is possible to combine the facial image piece of the target face given by the user with the image of a specific species to generate a cross-species avatar that is similar to the user's face and has the species' own characteristics. Using the technology of the embodiment of the present disclosure, a cross-species avatar can be generated for each user in a personalized manner, allowing users to experience the fun of AI (Artificial Intelligence) generating images, improving the user's entertainment interest, and thus improving the core competitiveness of app products with the avatar generation function and enriching product functions. At the same time, the technology of the embodiment of the present disclosure, by inputting the first text description information and the first image vector generated based on the facial image into the Vincent graph model, can better guide the Vincent graph model to generate an avatar of the target species with the facial features of the target face, and can better transfer the features of the face to the target species, so that the generated target species avatar is more visually similar to the user's face.
[0051] In one implementation, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, wherein step S101: determining first text description information according to a facial image of a target face includes:
[0052] Step S1011: Determine facial features based on the facial image of the target face.
[0053] Step S1012: Determine first text description information according to facial features.
[0054] According to the embodiments of the present disclosure, it should be noted that:
[0055] The facial features can be obtained from the facial image based on any existing extraction model of facial feature attributes. For example, a densenet (densely connected convolutional network) classification model can be used.
[0056] According to the technology of the embodiment of the present disclosure, the first text description information is generated according to the facial features, so that when the first text description information is input into the Vincent graph model, it can better guide the Vincent graph model to generate an avatar of the target species with the facial features of the target face.
[0057] In one implementation, the method for generating an avatar according to an embodiment of the present disclosure includes steps S101 to S103, and steps S1011 and S1012, wherein step S1011: before determining facial features based on a facial image of a target face, the method further includes:
[0058] Perform face recognition on the target image to determine the position information of the target face in the target image.
[0059] According to the position information, the target image is cropped and preprocessed to obtain a facial image corresponding to the target face.
[0060] According to the embodiments of the present disclosure, it should be noted that:
[0061] The target image can be understood as an image obtained by directly capturing the target face, or an image containing the target face.
[0062] The position information can be understood as the specific coordinate position of the image area occupied by the target face in the target image. For example, the position information includes the coordinate information of each pixel corresponding to the contour area of the target face. For another example, the position information includes the coordinate information of all pixel points corresponding to the target face.
[0063] The specific method of cropping preprocessing can adopt any face cropping and segmentation technology in the prior art, which is not specifically limited here, and can extract a face image containing only the target person from the target image. For example, the face cropping and segmentation model BiSeNet (Bilateral Segmentation Network) is used to perform cropping preprocessing on the target image. The face cropping and segmentation model can identify and segment various parts of the face, such as hair, eyes, nose and mouth, and finally generate a face image that only retains the face part.
[0064] According to the technology of the embodiment of the present disclosure, by performing cropping preprocessing on the target image, an image containing only the human face can be obtained, which can achieve better accuracy when extracting facial features and avoid interference of background information in the image on facial feature extraction. Through cropping preprocessing, the Vincent graph model can ultimately generate a higher quality head portrait of the target species.
[0065] In one implementation, the method for generating an avatar according to an embodiment of the present disclosure includes steps S101 to S103, and steps S1011 and S1012, wherein step S1011: determining facial features according to a facial image of a target face includes:
[0066] The facial feature extraction model is used to extract features from the facial image of the target face to determine the facial features.
[0067] According to the embodiments of the present disclosure, it should be noted that:
[0068] The facial features can be obtained from the facial image based on any existing extraction model of facial feature attributes. For example, a densenet (densely connected convolutional network) classification model can be used.
[0069] According to the technology of the embodiments of the present disclosure, by performing feature extraction on a facial image, it is possible to generate first text description information based on the facial features, so that when the first text description information is input into a Vincent graph model, it can better guide the Vincent graph model to generate an avatar of the target species having the facial features of the target face.
[0070] In one implementation, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, and steps S1011 and S1012, wherein step S1012: determining first text description information according to facial features includes:
[0071] Step S10121: Determine semantic information of facial features.
[0072] Step S10122: Determine the species category information of the target species.
[0073] Step S10123: Determine the first text description information according to the semantic information and the species category information.
[0074] According to the embodiments of the present disclosure, it should be noted that:
[0075] Semantic information can be understood as information that represents the meaning of facial features.
[0076] Species category information is used to characterize a specific species. For example, based on the species category information, the target species can be determined to be rabbit, cat, dog, etc.
[0077] The first text description information of the embodiment of the present disclosure includes not only description information associated with facial features, but also related information of the target species avatar to be generated.
[0078] According to the technology of the embodiments of the present disclosure, the first text description information is generated based on the semantic information of the facial features and the species category information, so that when the first text description information is input into the Vincent graph model, it can better guide the Vincent graph model to generate an avatar of the target species with the facial features of the target face.
[0079] In one implementation, the method for generating an avatar in an embodiment of the present disclosure includes steps S101 to S103, steps S1011 and S1012, and steps S10121 to S10123, wherein step S10123: determining first text description information according to semantic information and species category information includes:
[0080] Determine the avatar style information of the target species avatar to be generated.
[0081] The first text description information is determined according to the semantic information, the species category information and the avatar style information.
[0082] According to the embodiments of the present disclosure, it should be noted that:
[0083] The avatar style information may include image definition information and / or image style information. Image definition information includes, but is not limited to, 4k (4096×2160 pixel resolution), HQ (High Quality) or 8K (7680×4320 pixel resolution). Image style information includes, but is not limited to, digital portrait and 3D (Dimensions) rendering.
[0084] According to the technology of the embodiments of the present disclosure, the first text description information is generated based on the semantic information of the facial features, the species category information and the avatar style information. When the first text description information is input into the Vincent graph model, it can better guide the Vincent graph model to generate an avatar of the target species that meets the user's needs and has the facial features of the target face.
[0085] In one implementation, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, wherein step S102: determining a first image vector of a face image includes:
[0086] Using a variational auto-encoder (VAE), the face image is encoded into a first image vector.
[0087] According to the embodiments of the present disclosure, it should be noted that:
[0088] The first image vector is a vector representation of the face image in a low-dimensional space.
[0089] According to the technology of the embodiment of the present disclosure, the first image vector of the face image can be accurately obtained through the variational autoencoder.
[0090] In one embodiment, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, wherein step S103: using a pre-trained Vincent graph model corresponding to the target species, according to the first image vector and the first text description information, generating an avatar of the target species corresponding to the target face, including:
[0091] Step S1031: using a cross-modal model in a pre-trained text graph model corresponding to the target species, convert the first text description information into a first text vector.
[0092] Step S1032: using the diffusion model in the pre-trained text graph model, and generating a target species avatar corresponding to the target human face according to the first text vector and the first image vector.
[0093] According to the embodiments of the present disclosure, it should be noted that:
[0094] The cross-modal model can be any model in the prior art that can realize the cross-modal transformation of text to image, and is not specifically limited here. For example, the CLIP model (Contrastive Language-Image Pre-training) can be used.
[0095] The diffusion model may adopt any model in the prior art and is not specifically limited here.
[0096] According to the technology of the embodiment of the present disclosure, under the guidance of the first text vector, a potential representation of the target species avatar is generated through a diffusion model, thereby accurately generating the target species avatar corresponding to the target human face.
[0097] In one embodiment, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, and steps S1031 to S1032, wherein step S1031: using a cross-modal model in a pre-trained vincent graph model corresponding to the target species, converting the first text description information into a first text vector includes:
[0098] The first text description information is encoded into a first text vector using a text encoder of a cross-modal model in a pre-trained text graph model corresponding to the target species.
[0099] According to the technology of the embodiment of the present disclosure, through a cross-modal text encoder, the text semantic information of the facial features in the first text description information and the information of the specific species image can be combined, so as to better integrate the text description composed of facial features into the generation process of the target species avatar.
[0100] In one embodiment, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, and steps S1031 to S1032, wherein step S1032: using the diffusion model in the pre-trained Vincent graph model, according to the first text vector and the first image vector, generating a target species avatar corresponding to the target face, including:
[0101] Step S10321: Generate a second image vector based on the first text vector and the first image vector by using the diffusion model in the pre-trained text graph model.
[0102] Step S10322: Use the variational self-decoder of VAE to decode the second image vector to generate a head image of the target species corresponding to the target face.
[0103] According to the embodiments of the present disclosure, it should be noted that:
[0104] The diffusion model can be constructed based on U-Net (convolutional neural network for two-dimensional image segmentation).
[0105] The second image vector can be understood as the potential representation of the association between facial features and the target species in the target species portrait.
[0106] According to the technology of the embodiment of the present disclosure, the second image vector that has been continuously denoised by the diffusion model can be converted into an image of a specific species with human facial attributes by using the variational self-decoder of VAE.
[0107] In one embodiment, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, steps S1031 to S1032, and steps S10321 to S10322, wherein step S10321: using a diffusion model in a pre-trained text graph model to generate a second image vector according to a first text vector and a first image vector, includes:
[0108] The first image vector is mixed with the first Gaussian noise vector to obtain a mixed vector.
[0109] The diffusion model in the pre-trained text graph model is used to generate a second image vector according to the first text vector and the mixed vector.
[0110] According to the embodiments of the present disclosure, it should be noted that:
[0111] The first Gaussian noise can be understood as the random noise used in the diffusion model.
[0112] According to the technology of the embodiment of the present disclosure, by adding a first Gaussian noise vector to the diffusion model, the diffusion model can generate a second image vector that more accurately generates a potential representation of the association between facial features and the target species in the target species portrait based on the first text vector and the mixed vector.
[0113] In one implementation, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S103, wherein the training process of the pre-trained Wensheng graph model includes:
[0114] Step S104: Determine second text description information based on the species sample image of the target species, wherein the second text description information is used to characterize the facial features of the target species.
[0115] Step S105: Determine the third image vector of the species sample image.
[0116] Step S106: training the initial text-based graph model according to the second text description information and the third image vector to obtain a pre-trained text-based graph model.
[0117] According to the embodiments of the present disclosure, it should be noted that:
[0118] The number of species sample images can be selected and adjusted as needed and is not specifically limited here.
[0119] The second text description information at least includes information related to the facial features represented by the species sample image. The second text description information may be information generated based on one or more facial features in the species sample image, and these facial features are combined into a piece of text description information to guide the training of the initial text image model. The second text description information may be "a smiling rabbit with big eyes".
[0120] When the target species is an animal, the facial features may include at least one of the target species' eye features (big eyes, small eyes, open eyes, closed eyes, etc.), the target species' expression features (happy, fierce, open mouth, bared teeth, etc.), and the target species' gender features.
[0121] Facial features can be extracted from species sample images using deep learning technology. The specific method of extracting facial features from species sample images can be any method in the prior art, which is not specifically limited here.
[0122] The third image vector can be understood as a potential representation extracted based on the species sample image for characterizing the species sample image.
[0123] Target species can be understood as animals and / or plants. Animals can include rabbits, cats, dogs, birds, etc. Plants can include flowers, trees, etc.
[0124] The initial text graph model can adopt any model in the prior art that can generate images based on text descriptions, and is not specifically limited here. For example, the initial text graph model can adopt any one of the cross-modal generation model (Ernie-Vilg), the stable diffusion model (Stable Diffusion), the first generation image generation model (DALLE) and the second generation image generation model (DALLE-2).
[0125] According to the technology of the embodiments of the present disclosure, in order to establish a connection between text description information and the target species, the initial Vincent graph model is fine-tuned by inputting the species sample image and the second text description information, so that the pre-trained Vincent graph model obtained after training can directly achieve cross-modal alignment in the two modalities of image and text description information corresponding to the image.
[0126] In one implementation, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S106, wherein step S104: determining second text description information according to a species sample image of the target species includes:
[0127] Based on the species sample images of the target species, the facial features of the target species are determined.
[0128] According to the facial features, second text description information is determined.
[0129] According to the embodiments of the present disclosure, it should be noted that:
[0130] Facial features can be obtained from species sample images based on any existing facial feature attribute extraction model. For example, a densenet (densely connected convolutional network) classification model can be used.
[0131] According to the technology of the embodiments of the present disclosure, by generating the second text description information based on facial features, the second text description information can better guide the initial text graph model to perform model training when it is input into the initial text graph model.
[0132] In one embodiment, the method for generating an avatar in the embodiment of the present disclosure includes steps S101 to S106, wherein step S106: training an initial text graph model according to the second text description information and the third image vector to obtain a pre-trained text graph model includes:
[0133] The second text description information is encoded into a second text vector using the text encoder of the initial text graph model.
[0134] The cosine similarity between the second text vector and the third image vector is calculated using the text encoder of the initial text-graph model.
[0135] According to the cosine similarity, the text encoder of the initial text-graph model is trained. By optimizing the loss function, the similarity between the second text vector and the third image vector is as large as possible.
[0136] The second text vector, the third image vector and the second Gaussian noise vector are input into the diffusion model of the initial text graph model, and the diffusion model of the initial text graph model is trained based on the Markov chain process.
[0137] According to the trained text encoder and the trained diffusion model, a pre-trained text graph model is obtained.
[0138] According to the embodiments of the present disclosure, it should be noted that:
[0139] Training the text encoder of the initial text-based graph model can be understood as fine-tuning the text encoder. In order to establish the connection between the text description information of the image and the image, the second text vector and the third image vector are input to fine-tune the text encoder, so that the text-based graph model can directly achieve cross-modal alignment between the two modalities of the image and the text description information corresponding to the image.
[0140] Training the diffusion model of the initial text graph model can be understood as fine-tuning the diffusion model. The fine-tuning process of the diffusion model includes the diffusion process and the inverse diffusion process. It is mainly hoped that the diffusion model can learn a set of probability distributions through the input second text vector and the third image vector. According to this probability distribution, the random noise can be continuously denoised to restore the original image, as shown in the following figure: where represents random noise and represents the original image after denoising. The diffusion process is the process of continuously adding noise to the original input species sample image so that the species sample image is converted into Gaussian noise. The diffusion process is a Markov chain process, and the noise added each time is known. The training process of the diffusion model can refer to the existing training process of the diffusion model.
[0141] The diffusion model can be constructed based on U-Net (convolutional neural network for two-dimensional image segmentation).
[0142] According to the technology of the embodiment of the present disclosure, the fine-tuned text encoder of the cross-modal model of text to image can better encode text description information into text vectors to guide the generation of target species avatars. The fine-tuned diffusion model can generate avatars in the style of the target species and with human characteristic attributes by continuously denoising the random noise (the second Gaussian noise vector).
[0143] In one example, if Figure 3 As shown, the method for generating an avatar includes:
[0144] Perform face recognition on the target image to determine the position information of the target face in the target image.
[0145] According to the position information, the target image is preprocessed by face segmentation and cropping to obtain a face image corresponding to the target face.
[0146] Determine facial features based on the facial image of the target face.
[0147] The face image is encoded by using a variational autoencoder to obtain a first image vector.
[0148] The first text description information is converted into a first text vector by using a text encoder of a cross-modal model in a pre-trained text graph model corresponding to the target species.
[0149] A diffusion model in a pre-trained text graph model is used to generate a second image vector according to the first text vector and the first image vector.
[0150] The second image vector is decoded by using a variational self-decoder to generate a head image of the target species corresponding to the target human face.
[0151] In one example, if Figure 4 As shown in Figure 1, the training process of the pre-trained Wensheng graph model includes:
[0152] The second text description information is determined based on a small amount of species sample images of the target species.
[0153] Image encoding is performed on a small number of species sample images to determine the third image vector of the species sample images.
[0154] The cosine similarity between the second text vector and the third image vector is calculated using the text encoder of the initial text-graph model.
[0155] The text encoder of the initial text graph model is trained based on cosine similarity.
[0156] The second text vector, the third image vector and the second Gaussian noise vector are input into the diffusion model of the initial text graph model, and the diffusion model of the initial text graph model is trained based on the Markov chain process.
[0157] According to the trained text encoder and the trained diffusion model, a pre-trained text graph model is obtained.
[0158] like Figure 5 As shown, the embodiment of the present disclosure provides a method for changing an avatar, which is applied to an application program of a terminal, and includes:
[0159] Step S501: In response to the user's avatar change instruction, determine the target species that the user needs to convert and the face image uploaded by the user.
[0160] Step S502: Based on the human face image and the target species, the avatar generation method of any embodiment of the present disclosure is used to generate an avatar of the target species to be replaced by the user, wherein the avatar of the target species to be replaced includes facial features corresponding to the human face features.
[0161] According to the embodiments of the present disclosure, it should be noted that:
[0162] The face image uploaded by the user is obtained by photographing the user's face, or by cropping and preprocessing a historical image selected by the user from a local terminal.
[0163] The application of the terminal can be understood as the application installed on the mobile terminal, and can also be understood as the application or web page installed on the computer terminal.
[0164] According to the technology of the embodiment of the present disclosure, it is possible to combine the facial image piece of the target face given by the user with the image of a specific species to generate a cross-species avatar that is similar to the user's face and has the species' own characteristics. Using the technology of the embodiment of the present disclosure, a cross-species avatar can be generated for each user in a personalized manner, allowing users to experience the fun of AI (Artificial Intelligence) generating images, improving the user's entertainment interest, and thus improving the core competitiveness of app products with the avatar generation function and enriching product functions. At the same time, the technology of the embodiment of the present disclosure, by inputting the first text description information and the first image vector generated based on the facial image into the Vincent graph model, can better guide the Vincent graph model to generate an avatar of the target species with the facial features of the target face, and can better transfer the features of the face to the target species, so that the generated target species avatar is more visually similar to the user's face.
[0165] In one implementation, the method for replacing an avatar in the embodiment of the present disclosure includes step S501 and step S502, and further includes:
[0166] Determines the current avatar for the user in the application.
[0167] Replace the current portrait with the portrait of the target species to be replaced.
[0168] According to the embodiments of the present disclosure, it should be noted that:
[0169] The current avatar can be understood as the avatar configured by the application for the user by default.
[0170] like Figure 6 As shown, the embodiment of the present disclosure provides a device for generating an avatar, including:
[0171] The first determination module 610 is used to determine first text description information according to the face image of the target face, wherein the first text description information is at least used to characterize the face features of the face image.
[0172] The second determination module 620 is used to determine the first image vector of the face image.
[0173] The first generation module 630 is used to generate a target species avatar corresponding to a target human face using a pre-trained vincent graph model corresponding to the target species according to the first image vector and the first text description information, wherein the target species avatar includes facial features corresponding to the human face features.
[0174] In one implementation, the first determining module 610 includes:
[0175] The first determination submodule is used to determine facial features based on the facial image of the target face.
[0176] The second determination submodule is used to determine the first text description information according to the facial features.
[0177] In one implementation, the first determining module 610 further includes:
[0178] The third determination submodule is used to perform face recognition on the target image and determine the position information of the target face in the target image.
[0179] The preprocessing submodule is used to perform cropping preprocessing on the target image according to the position information to obtain a facial image corresponding to the target face.
[0180] In one implementation, the first determining submodule is used to:
[0181] The facial feature extraction model is used to extract features from the facial image of the target face to determine the facial features.
[0182] In one implementation, the second determining submodule is used to:
[0183] Determine semantic information of facial features.
[0184] Determine species category information for target species.
[0185] The first text description information is determined according to the semantic information and the species category information.
[0186] In one embodiment, determining the first text description information according to the semantic information and the species category information includes:
[0187] Determine the avatar style information of the target species avatar to be generated.
[0188] The first text description information is determined according to the semantic information, the species category information and the avatar style information.
[0189] In one implementation, the avatar style information includes image clarity information and / or image style information.
[0190] In one implementation, the second determining module 620 is configured to:
[0191] Using a variational autoencoder, the face image is encoded into a first image vector.
[0192] In one implementation, the first generation module 630 includes:
[0193] The conversion submodule is used to convert the first text description information into a first text vector by using a cross-modal model in a pre-trained text graph model corresponding to the target species.
[0194] The generation submodule is used to generate a target species avatar corresponding to the target human face according to the first text vector and the first image vector by using the diffusion model in the pre-trained text graph model.
[0195] In one embodiment, the conversion submodule is used to:
[0196] The first text description information is encoded into a first text vector using the text encoder of the cross-modal model in the pre-trained text graph model corresponding to the target species
[0197] In one embodiment, the generation submodule is used to:
[0198] A diffusion model in a pre-trained text graph model is used to generate a second image vector according to the first text vector and the first image vector.
[0199] The second image vector is decoded by using a variational self-decoder to generate a head image of the target species corresponding to the target human face.
[0200] In one embodiment, using a diffusion model in a pre-trained text graph model, generating a second image vector according to a first text vector and a first image vector includes:
[0201] The first image vector is mixed with the first Gaussian noise vector to obtain a mixed vector.
[0202] The diffusion model in the pre-trained text graph model is used to generate a second image vector according to the first text vector and the mixed vector.
[0203] In one embodiment, the diffusion model is constructed based on a convolutional neural network for two-dimensional image segmentation.
[0204] In one embodiment, the facial features include at least one of facial accessory features, hair features, skin color features, eye features, expression features, gender features, age features, and face shape features.
[0205] In one embodiment, the target species includes animals and / or plants.
[0206] In one embodiment, the Wensheng graph model adopts any one of a cross-modal generation model, a stable diffusion model, a first-generation image generation model, and a second-generation image generation model.
[0207] In one embodiment, the apparatus for generating an avatar further includes a training module for:
[0208] The fourth determination submodule is used to determine second text description information according to the species sample image of the target species, wherein the second text description information is used to characterize the facial features of the target species.
[0209] The fifth determination submodule is used to determine the third image vector of the species sample image.
[0210] The training submodule is used to train the initial text-based graph model according to the second text description information and the third image vector to obtain a pre-trained text-based graph model.
[0211] In one implementation, the fourth determining submodule is used to:
[0212] Based on the species sample images of the target species, the facial features of the target species are determined.
[0213] According to the facial features, second text description information is determined.
[0214] In one embodiment, the facial features include at least eye features of the target species or expression features of the target species.
[0215] In one embodiment, the training submodule is used to:
[0216] The second text description information is encoded into a second text vector using the text encoder of the initial text graph model.
[0217] The cosine similarity between the second text vector and the third image vector is calculated using the text encoder of the initial text-graph model.
[0218] The text encoder of the initial text graph model is trained based on cosine similarity.
[0219] The second text vector, the third image vector and the second Gaussian noise vector are input into the diffusion model of the initial text graph model, and the diffusion model of the initial text graph model is trained based on the Markov chain process.
[0220] According to the trained text encoder and the trained diffusion model, a pre-trained text graph model is obtained.
[0221] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0222] like Figure 7 As shown, the embodiment of the present disclosure provides a device for changing an avatar, which is applied to an application program of a terminal, including:
[0223] The response module 710 is used to respond to the user's avatar change instruction and determine the target species that the user needs to convert and the face image uploaded by the user. And
[0224] The second generation module 720 is used to generate a target species avatar to be replaced by the user according to the face image and the target species, using the avatar generation method of any embodiment of the present disclosure, wherein the target species avatar to be replaced includes facial features corresponding to the face features of the human face.
[0225] In one implementation, the facial image uploaded by the user is obtained by photographing the user's face, or by cropping and preprocessing a historical image selected by the user from a local terminal.
[0226] In one embodiment, the apparatus for replacing the avatar further includes:
[0227] The replacement module is used to determine the current avatar of the user in the application and replace the current avatar with the target species avatar to be replaced.
[0228] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0229] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0230] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0231] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0232] like Figure 8As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0233] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0234] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the method of avatar generation and / or the method of avatar replacement. For example, in some embodiments, the method of avatar generation and / or the method of avatar replacement may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the method of avatar generation and / or the method of avatar replacement described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the avatar generation method and / or the avatar replacement method in any other appropriate manner (eg, by means of firmware).
[0235] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0236] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0237] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0238] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0239] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0240] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0241] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0242] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating an avatar, include: Determine first text description information according to the facial image of the target face; wherein the first text description information is used to characterize at least the facial features of the facial image; and the first text description information is determined according to feature information of the facial features and species category information of the target species; Determining a first image vector of the face image; and Using a pre-trained Vincent graph model corresponding to the target species, generating a target species avatar corresponding to the target human face according to the first image vector and the first text description information; wherein the target species avatar includes facial features corresponding to the facial features of the human face; Wherein, determining the first text description information according to the facial image of the target face includes: Determine facial features according to the facial image of the target face; Determining semantic information of the facial features; Determine the species category information of the target species; Determining first text description information according to the semantic information and the species category information; The method of using a pre-trained vincent graph model corresponding to the target species and generating a target species avatar corresponding to the target face according to the first image vector and the first text description information includes: Using a cross-modal model in a pre-trained text graph model corresponding to the target species, converting the first text description information into a first text vector; Using the diffusion model in the pre-trained Vincent graph model, and based on the first text vector and the first image vector, generating a head portrait of the target species corresponding to the target human face; The step of using the diffusion model in the pre-trained Vincent graph model to generate the target species avatar corresponding to the target human face according to the first text vector and the first image vector includes: Generate a second image vector according to the first text vector and the first image vector by using a diffusion model in the pre-trained text graph model; The second image vector is decoded by using a variational self-decoder to generate a head portrait of the target species corresponding to the target human face.
2. The method according to claim 1, in, According to the facial image of the target face, before determining the facial features, it also includes: Performing face recognition on the target image to determine the position information of the target face in the target image; The target image is cropped and preprocessed according to the position information to obtain a facial image corresponding to the target face.
3. The method according to claim 1, in, According to the facial image of the target face, the facial features are determined, including: The facial feature extraction model is used to extract features from the facial image of the target face to determine the facial features.
4. The method according to claim 1, in, Determining first text description information according to the semantic information and the species category information includes: Determine the avatar style information of the target species avatar to be generated; The first text description information is determined according to the semantic information, the species category information and the avatar style information.
5. The method according to claim 4, in, The avatar style information includes image clarity information and / or image style information.
6. The method according to claim 1, in, Determining a first image vector of the face image includes: The face image is encoded into a first image vector using a variational autoencoder.
7. The method according to claim 1, in, Using a cross-modal model in a pre-trained text graph model corresponding to the target species, converting the first text description information into a first text vector includes: The first text description information is encoded into a first text vector using a text encoder of a cross-modal model in a pre-trained text graph model corresponding to the target species.
8. The method according to claim 1, in, Using the diffusion model in the pre-trained text graph model, generating a second image vector according to the first text vector and the first image vector, comprising: Mixing the first image vector with a first Gaussian noise vector to obtain a mixed vector; A second image vector is generated according to the first text vector and the mixed vector by using a diffusion model in the pre-trained text graph model.
9. The method according to claim 1, in, The diffusion model is based on a convolutional neural network for two-dimensional image segmentation.
10. The method according to any one of claims 1 to 9, in, The facial features include at least one of facial accessory features, hair features, skin color features, eye features, expression features, gender features, age features and face shape features.
11. The method according to any one of claims 1 to 9, in, The target species include animals and / or plants.
12. The method according to any one of claims 1 to 9, in, The Wensheng graph model adopts any one of a cross-modal generation model, a stable diffusion model, a first-generation image generation model, and a second-generation image generation model.
13. The method according to any one of claims 1 to 9, in, The training process of the pre-trained text graph model includes: Determining second text description information according to the species sample image of the target species; wherein the second text description information is used to characterize facial features of the target species; determining a third image vector of the species sample image; The initial text graph model is trained according to the second text description information and the third image vector to obtain the pre-trained text graph model.
14. The method according to claim 13, in, Determining second text description information according to the species sample image of the target species includes: Determining facial features of the target species based on a species sample image of the target species; Determine second text description information according to the facial feature.
15. The method according to claim 14, in, The facial features include at least eye features of the target species or expression features of the target species.
16. The method according to claim 13, in, Training an initial text graph model according to the second text description information and the third image vector to obtain the pre-trained text graph model includes: Using a text encoder of the initial text graph model, encoding the second text description information into a second text vector; Calculating the cosine similarity between the second text vector and the third image vector using the text encoder of the initial text graph model; According to the cosine similarity, training the text encoder of the initial text graph model; Inputting the second text vector, the third image vector and the second Gaussian noise vector into the diffusion model of the initial text graph model, and training the diffusion model of the initial text graph model based on a Markov chain process; The pre-trained text graph model is obtained according to the trained text encoder and the trained diffusion model.
17. A method for replacing an avatar, applied to an application program of a terminal, include: In response to a user's avatar replacement instruction, determining a target species that the user needs to convert and a face image uploaded by the user; as well as According to the human face image and the target species, the avatar generation method according to any one of claims 1 to 16 is used to generate the target species avatar to be replaced by the user; wherein the target species avatar to be replaced includes facial features corresponding to the human face features.
18. The method according to claim 17, in, The facial image uploaded by the user is obtained by photographing the user's face, or by cropping and preprocessing a historical image selected by the user from a local terminal.
19. The method according to claim 17 or 18, further comprising: include: determining a current avatar of the user in the application; The current avatar is replaced with the avatar of the target species to be replaced.
20. A device for generating an avatar, include: A first determination module is used to determine first text description information according to a facial image of a target face; wherein the first text description information is at least used to characterize facial features of the facial image; and the first text description information is determined according to feature information of the facial features and species category information of the target species; A second determining module, configured to determine a first image vector of the face image; and A first generating module is used to generate a target species avatar corresponding to the target human face by using a pre-trained Vincent graph model corresponding to the target species according to the first image vector and the first text description information; wherein the target species avatar includes facial features corresponding to the facial features of the human face; Wherein, the first determining module includes: The first determination submodule is used to determine facial features based on the facial image of the target face; A second determination submodule, configured to determine first text description information according to the facial features; Wherein, the second determining submodule is used for: Determining semantic information of the facial features; Determine the species category information of the target species; Determining first text description information according to the semantic information and the species category information; Wherein, the first generation module includes: A conversion submodule, configured to convert the first text description information into a first text vector by using a cross-modal model in a pre-trained vincent graph model corresponding to a target species; A generation submodule, configured to generate a target species avatar corresponding to the target human face according to the first text vector and the first image vector by using a diffusion model in the pre-trained vincent graph model; Wherein, the generating submodule is used for: Generate a second image vector according to the first text vector and the first image vector by using a diffusion model in the pre-trained text graph model; The second image vector is decoded by using a variational self-decoder to generate a head portrait of the target species corresponding to the target human face.
21. The device according to claim 20, further comprising: include: A third determination submodule is used to perform face recognition on the target image and determine the position information of the target face in the target image; The preprocessing submodule is used to perform cropping preprocessing on the target image according to the position information to obtain a facial image corresponding to the target face.
22. The device according to claim 20, in, The first determining submodule is used for: The facial feature extraction model is used to extract features from the facial image of the target face to determine the facial features.
23. The device according to claim 20, in, Determining first text description information according to the semantic information and the species category information includes: Determine the avatar style information of the target species avatar to be generated; The first text description information is determined according to the semantic information, the species category information and the avatar style information.
24. The device according to claim 23, in, The avatar style information includes image clarity information and / or image style information.
25. The device according to claim 20, in, The second determining module is used for: The face image is encoded into a first image vector using a variational autoencoder.
26. The device according to claim 20, in, The conversion submodule is used for: The first text description information is encoded into a first text vector using a text encoder of a cross-modal model in a pre-trained text graph model corresponding to the target species.
27. The device according to claim 20, in, Using the diffusion model in the pre-trained text graph model, generating a second image vector according to the first text vector and the first image vector, comprising: Mixing the first image vector with a first Gaussian noise vector to obtain a mixed vector; A second image vector is generated according to the first text vector and the mixed vector by using a diffusion model in the pre-trained text graph model.
28. The device according to claim 20, in, The diffusion model is based on a convolutional neural network for two-dimensional image segmentation.
29. The device according to any one of claims 20 to 28, in, The facial features include at least one of facial accessory features, hair features, skin color features, eye features, expression features, gender features, age features and face shape features.
30. The device according to any one of claims 20 to 28, in, The target species include animals and / or plants.
31. The device according to any one of claims 20 to 28, in, The Wensheng graph model adopts any one of a cross-modal generation model, a stable diffusion model, a first-generation image generation model, and a second-generation image generation model.
32. The apparatus according to any one of claims 20 to 28, further comprising a training module for: A fourth determination submodule is used to determine second text description information according to the species sample image of the target species; in, The second text description information is used to characterize the facial features of the target species; a fifth determination submodule, used to determine a third image vector of the species sample image; The training submodule is used to train the initial text graph model according to the second text description information and the third image vector to obtain the pre-trained text graph model.
33. The device according to claim 32, in, The fourth determining submodule is used for: Determining facial features of the target species based on a species sample image of the target species; Determine second text description information according to the facial feature.
34. The device according to claim 33, in, The facial features include at least eye features of the target species or expression features of the target species.
35. The device according to claim 32, in, The training submodule is used for: Using a text encoder of the initial text graph model, encoding the second text description information into a second text vector; Calculating the cosine similarity between the second text vector and the third image vector using the text encoder of the initial text graph model; According to the cosine similarity, training the text encoder of the initial text graph model; Inputting the second text vector, the third image vector and the second Gaussian noise vector into the diffusion model of the initial text graph model, and training the diffusion model of the initial text graph model based on a Markov chain process; The pre-trained text graph model is obtained according to the trained text encoder and the trained diffusion model.
36. A device for changing an avatar, applied to an application program of a terminal, include: A response module, for responding to a user's avatar change instruction, and determining a target species that the user needs to convert and a face image uploaded by the user; as well as The second generation module is used to generate the target species avatar to be replaced by the user according to the human face image and the target species, using the avatar generation method described in any one of claims 1 to 16; wherein the target species avatar to be replaced contains facial features corresponding to the human face features.
37. The device according to claim 36, in, The facial image uploaded by the user is obtained by photographing the user's face, or by cropping and preprocessing a historical image selected by the user from a local terminal.
38. The device according to claim 36 or 37, further comprising: include: A replacement module, used to determine the current avatar of the user in the application; And replace the current avatar with the avatar of the target species to be replaced.
39. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 19.
40. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 19.
41. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 19.
