A model training method, device, equipment and readable storage medium
By combining the image features of the first user and associated users, an image processing model is trained, which solves the problem of unrealistic generation in existing technologies and improves the realism and accuracy of image generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SASI DIGITAL TECHNOLOGY (BEIJING) CO LTD
- Filing Date
- 2022-09-07
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies produce unrealistic results when generating facial images of users at different ages, failing to effectively integrate the influence of user characteristics and genetic factors.
By acquiring image data of a third party related to the genetic relationship between a first user and its associated users, and by training a model, combining the genetic relationship of the first user with the genetic image data, genetic features are extracted and fused to generate a target face image.
It improves the realism and accuracy of generated facial images, especially the image generation accuracy when the user's age varies greatly.
Smart Images

Figure CN116403249B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to a model training method, apparatus, device, and readable storage medium. Background Technology
[0002] With increasing public concern about data privacy, image processing models related to facial image processing have also received widespread attention. Among them, age editing of facial images is an important branch of facial image processing in the field of computer vision. It involves extracting facial features from a user's facial image, editing the age of those features, and then generating a facial image of the user at a desired age.
[0003] However, for the same user, the images of that user at different ages are affected not only by their own facial features but also by other factors, making the images generated by the above method unrealistic. Summary of the Invention
[0004] This specification provides a model training method, apparatus, device, and readable storage medium to partially solve the aforementioned problems existing in the prior art.
[0005] The following technical solution is adopted in this specification:
[0006] This manual provides a model training method, including:
[0007] Acquire first and second face images of a first user at different ages, and acquire third face images of users associated with the first user; the associated users have a genetic relationship with the first user.
[0008] Based on the age at which the second face image was captured, the first face image, and the third face image, training samples are determined, and the second face image is used as the label of the training samples.
[0009] The training samples are input into the image processing model to be trained, and the encoder in the image processing model is used to obtain the image features of the first face image.
[0010] Genetic features are extracted from the third face image through the genetic feature extraction layer in the image processing model. The genetic features include at least one of the facial features, skin color features, and body shape features of the associated user.
[0011] For each image feature, feature fusion is performed based on the genetic characteristics, the age at which the second face image was acquired, and the image feature itself to obtain the target feature;
[0012] Each target feature is input into the generator of the image processing model to generate a target face image;
[0013] The image processing model is trained with the objective of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples;
[0014] When a prediction request is received, the original face image of the second user, the face image of the associated user of the second user, and the target age carried in the prediction request are input into the trained image processing model to obtain the face image of the second user at the target age predicted by the image processing model.
[0015] Optionally, before obtaining the image features of the first face image through the encoder in the image processing model, the method further includes:
[0016] Facial landmark detection is performed on the first face image and the third face image respectively to obtain the facial landmarks of the first user and the facial landmarks of the associated user.
[0017] Using the positional relationships of facial key points in a standard facial image as constraints, the first facial image is adjusted based on the facial key points of the first user, and the third facial image is adjusted based on the facial key points of the associated user.
[0018] Optionally, the encoder of the image processing model obtains several image features of the first face image, specifically including:
[0019] Based on the first face image, construct an image feature pyramid;
[0020] For each feature map in the image feature pyramid, the feature map is upsampled, and the upsampled feature map is aligned and fused with the next layer feature map; wherein the resolution of the next layer feature map is the same as the resolution of the upsampled feature map.
[0021] The feature maps at each resolution in the image feature pyramid are traversed to obtain the fused feature maps at each resolution, and a specified number of image features are extracted from the fused feature maps at each resolution.
[0022] Optionally, based on the first face image, an image feature pyramid is constructed, specifically including:
[0023] The first face image is input into the feature map extraction layer of the encoder to obtain the original feature map;
[0024] The original feature map is downsampled to obtain the target feature map;
[0025] Determine whether the resolution of the target feature map meets preset conditions; the preset conditions are determined based on the resolution of the second face image;
[0026] If not, continue downsampling the target feature map until the downsampled target feature map meets the preset conditions;
[0027] If so, the original feature map and the target feature maps of different resolutions are arranged sequentially according to the resolution of the feature maps to construct the feature pyramid of the first face image.
[0028] Optionally, for each image feature, feature fusion is performed based on the genetic features, the age at which the second face image was acquired, and the image feature itself to obtain target features, specifically including:
[0029] Determine the first weight corresponding to the genetic trait, and weight the genetic trait according to the first weight;
[0030] Determine a second weight corresponding to the age at which the second face image was captured, and weight the age at which the second face image was captured based on the second weight;
[0031] For each image feature, feature fusion is performed based on the weighted genetic features, the age of the second face image acquired by the weighted feature, and the image feature itself to obtain the target feature corresponding to that image feature.
[0032] Optionally, the target features are input into the generator of the image processing model to be trained to generate the target face image, specifically including:
[0033] For each target feature, in the generator, the image generation layer corresponding to the target feature is determined, and the output image of the image generation layer above the image generation layer corresponding to the target feature is obtained as the upper layer image corresponding to the target feature.
[0034] The target feature and the upper-layer image corresponding to the upsampled target feature are input into the image generation layer corresponding to the target feature to obtain the image output by the image generation layer corresponding to the target feature.
[0035] Determine whether the resolution of the image output by the image generation layer corresponding to the target feature meets the preset conditions; the preset conditions are determined based on the resolution of the second face image;
[0036] If not, the image output by the image generation layer corresponding to the target feature is input into the next image generation layer corresponding to the target feature, until the resolution of the image output by the image generation layer meets the preset condition;
[0037] If so, the image output by the image generation layer corresponding to the target feature is used as the target face image.
[0038] Optionally, in the generator, determining the image generation layer corresponding to the target feature specifically includes:
[0039] The generator contains several image generation layers, which are classified according to resolution to obtain image generation layers of each resolution.
[0040] Based on the image features corresponding to the target feature, the resolution corresponding to the target feature is determined; the image features are extracted from the feature maps of each resolution contained in the image feature pyramid of the encoder;
[0041] Based on the resolution corresponding to the target feature and the image generation layer for each resolution, the image generation layer corresponding to the target feature is determined.
[0042] Optionally, the image processing model is trained with the objective of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples, specifically including:
[0043] Extract the first age feature and the first identity feature from the target face image;
[0044] Extract the second age feature and the second identity feature from the second facial image;
[0045] The first loss is determined based on the difference between the first age feature and the second age feature, and the difference between the first identity feature and the second identity feature;
[0046] The second loss is determined based on the image difference between the target face image and the second face image;
[0047] Determine the weights corresponding to the first loss and the second loss respectively, and then weight the first loss and the second loss according to the determined weights;
[0048] The total loss is determined based on the weighted first loss and the weighted second loss;
[0049] The image processing model is trained with the goal of minimizing the total loss.
[0050] This specification provides a model training device, the device comprising:
[0051] The acquisition module is used to acquire a first face image and a second face image collected at different ages of the first user, and to acquire a third face image of an associated user of the first user; the associated user has a genetic relationship with the first user;
[0052] The training sample determination module is used to determine training samples based on the acquisition age of the second face image, the first face image, and the third face image, and to use the second face image as the label of the training sample.
[0053] The image feature determination module is used to input the training samples into the image processing model to be trained, and obtain the image features of the first face image through the encoder in the image processing model;
[0054] The genetic feature determination module is used to extract genetic features from the third face image through the genetic feature extraction layer in the image processing model;
[0055] The target feature determination module is used to perform feature fusion for each image feature based on the genetic features, the age at which the second face image was acquired, and the image feature itself, to obtain the target feature;
[0056] The generation module is used to input each target feature into the generator of the image processing model to generate the target face image;
[0057] The training module is used to train the image processing model with the goal of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples;
[0058] The prediction module is used to input the original face image of the second user, the face image of the associated user of the second user, and the target age carried in the prediction request into the trained image processing model when a prediction request is received, so as to obtain the face image of the second user at the target age predicted by the image processing model.
[0059] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described model training method.
[0060] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the model training method described above.
[0061] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:
[0062] In the model training method provided in this specification, based on the acquisition age of the first face image, the second face image, and the third face image, genetic features are extracted from the third face image through the genetic feature extraction layer in the image processing model. Based on the genetic features and the acquisition age of the second face image, feature fusion is performed on the image features obtained by the encoder. The resulting target features are then used by the generator to obtain the target face image. It can be seen that by introducing the genetic features extracted from the third face image of the first user's associated users during the training process of the image processing model, the image generated by the image processing model not only includes the features of the user's first face image but also the face features of the first user's associated users. When responding to the prediction request of the second user, even if the age of the second user varies greatly, the accuracy of the face image of the second user at the target age output by the model can be improved. Attached Figure Description
[0063] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:
[0064] Figure 1 This is a flowchart illustrating one model training method described in this specification.
[0065] Figure 2 This is a schematic diagram of an image processing model described in this specification;
[0066] Figure 3 This is a flowchart illustrating one model training method described in this specification.
[0067] Figure 4 This is a schematic diagram of an image processing model described in this specification;
[0068] Figure 5 This is a flowchart illustrating one model training method described in this specification.
[0069] Figure 6 This is a schematic diagram of a model training device provided in this specification;
[0070] Figure 7 The corresponding information provided in this specification Figure 1 A schematic diagram of an electronic device. Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0072] Additionally, it should be noted that all actions involving the acquisition of signals, information, or data in this invention are carried out in compliance with the relevant data protection laws and regulations of the country where the invention is located, and with authorization from the owner of the corresponding device.
[0073] Facial age editing solutions have wide applications in various fields. For example, in the case of missing persons, if the disappearance has been long, it is difficult for family members to find them using photos taken before the disappearance. To address this scenario, the age of the missing person's facial image at the time of disappearance can be edited to obtain the current facial image, improving the efficiency of the search.
[0074] Age editing of a face can generate a face image of the user at the desired age based on a given face image, while keeping the face identity information unchanged. For example, given a face image of the user when they are young, it can generate a face image of the user when they are old, or given a face image of the user when they are an adult, it can generate a face image of the user when they are a child.
[0075] However, the aforementioned facial age editing schemes typically only extract image features from the user-provided facial image and then edit these features to reflect age, such as aging facial features. However, long-term age changes often lead to more complex variations in a user's facial image. For example, a user might have a chubby face in childhood, but if their parents had relatively thin faces, the user's adult face might also be relatively thin. Therefore, for the same user, images at different ages are influenced not only by their own facial features but also by other factors, such as genetic factors inherited from their parents. If only the extracted facial features are age-edited, the generated facial images may be unrealistic or even distorted.
[0076] Based on this, this specification provides a training method for an image processing model. The model is trained by combining the facial images of a third-party user associated with the first user. This ensures that the training process incorporates not only features extracted from the first user's facial image but also genetic features extracted from the third-party facial image. By introducing genetic features, the trained image processing model generates facial images of the first user at the target age, incorporating the genetic features of the first user's associated users, thus improving the realism of the generated facial images.
[0077] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0078] Figure 1 This is a flowchart illustrating a model training method provided in this specification.
[0079] S100: Acquire a first face image and a second face image collected at different ages of the first user, and acquire a third face image of an associated user of the first user; the associated user has a genetic relationship with the first user.
[0080] This specification provides a method for training an image processing model, which can be executed by an electronic device such as a server used for training the model.
[0081] Here, the first user refers to the user in the first face image in the training samples used to train the image processing model.
[0082] In the embodiments of this specification, the image processing model can generate a face image of the first user at an older age based on a face image of the first user at a younger age, and vice versa. During the training of the image processing model, the age information corresponding to the first face image used for training differs from the age information of the second face image. Typically, to train an image processing model that can generate a face image of the first user at an older age based on a face image of the first user at a younger age, the age information corresponding to the first face image can be less than the age information of the second face image. Similarly, to train an image processing model that can generate a face image of the first user at a younger age based on a face image of the first user at an older age, the age information corresponding to the first face image can be greater than the age information of the second face image. The first face image and the second face image can be collected at different ages of the first user. The difference between the age information corresponding to the first face image and the age information corresponding to the second face image can be determined according to the specific application scenario, and this specification does not limit this.
[0083] The source of the third-party facial image can be a related user of the first user. A related user can be at least one relative of the first user who has a genetic relationship, such as the first user's immediate family members: the first user's father, mother, grandparents, and maternal grandparents. Alternatively, collateral relatives of the first user can be included, such as the first user's siblings.
[0084] S102: Based on the age of the second face image, the first face image, and the third face image, determine the training sample, and use the second face image as the label of the training sample.
[0085] During model training, the first face image of the first user, the age of the second face image, and the third face image of at least one associated user of the first user can be combined as training samples, and the second face image of the first user can be used as the label of the training samples. This enables the image processing model to generate a face image with the age information corresponding to the second image based on the face features of the first user, the age of the second face image image, and the face features of the associated users of the first user.
[0086] S104: Input the training samples into the image processing model to be trained, and obtain several image features of the first face image through the encoder in the image processing model.
[0087] Specifically, the image processing model to be trained includes an encoder, which can extract the facial features of the first user from the first face image as image features, such as... Figure 2 As shown, due to the numerous facial features and the complex relationships between them, a hierarchical feature extraction method can be used to obtain facial features at several different levels. For example, global facial features can be extracted from low-resolution facial images, while local facial features can be extracted from higher-resolution facial images. This hierarchical feature extraction method allows for the extraction of both overall global features of the first user in the first facial image and refined local features, improving the comprehensiveness of feature extraction.
[0088] S106: Extract genetic features from the third face image through the genetic feature extraction layer in the image processing model.
[0089] The genetic feature extraction layer in the image processing model to be trained can extract at least one of the following features associated with the user: facial features, skin color features, and body shape features, from a third-party face image: Figure 2 As shown. Taking the first user's parents as an example, according to the principles of genetics, the first user's parents' facial features, skin color and body shape may be inherited by the user. That is, some facial features of the first user may be similar to some facial features of the first user's parents.
[0090] Optionally, if several initial genetic features are extracted from a third-party face image, the weight of each initial genetic feature can be determined, and the initial genetic features can be weighted and fused to obtain the genetic features. Here, the initial genetic features refer to the facial features, skin color features, and body shape features of the associated user that can be extracted from the third-party face image.
[0091] S108: For each image feature, feature fusion is performed based on the genetic features, the age at which the second face image was acquired, and the image feature to obtain the target feature.
[0092] In the embodiments of this specification, in order to incorporate the facial features of the first user's associated users during the model training process, the genetic features extracted from the third facial image and the acquisition age of the second facial image are fused into the image features, such as... Figure 2 As shown, this allows the generator to generate a target face image of the first user based on the target features that integrate genetic features, image features, and the age of the second face image.
[0093] S110: Input each target feature into the generator of the image processing model to be trained to generate the target face image.
[0094] In the embodiments of this specification, an image generator containing a style module can be used to control the target features as style, so that the target features, including genetic features, image features, and the age of the second face image acquisition, participate in the process of image generation.
[0095] In the embodiments described in this specification, the generator can transform an image from an initial resolution to a target resolution image; typically, the initial resolution is lower than the target resolution. Several generation stages of the generator can be determined based on the initial and target resolutions. In each generation stage, target features can exert a style influence on image generation so as to finally generate a target face image with age information corresponding to the second image.
[0096] S112: Train the image processing model with the goal of minimizing the difference between the target face image and the label corresponding to the second face image of the training sample.
[0097] In practical applications, the training objective of the image processing model is to make the output target face image as close as possible to the second face image of the first user (the training sample) while keeping the face identity information unchanged. Therefore, in the embodiments of this specification, the total loss can be determined based on the difference between the target face image and the second face image, and the parameters of the image processing model can be adjusted with the loss minimization as the training objective. The difference between the target face image and the second face image can be a difference between images, or features can be extracted from the target face image and the second face image respectively, and the loss can be determined based on the difference between the features. The features extracted from the target face image and the second face image respectively can be identity features and / or age features.
[0098] S114: When a prediction request is received, the original face image of the second user, the face image of the associated user of the second user, and the target age carried in the prediction request are input into the trained image processing model to obtain the face image of the second user at the target age predicted by the image processing model.
[0099] After the image processing model has been trained, when it receives a prediction request carrying the original face image, the specified face image, and the target age, it can obtain the predicted face image of the second user at the target age based on the original face image, the specified face image, and the target age input by the second user. Usually, the target age input by the second user is different from the age of the second user corresponding to the original face image.
[0100] The model training method described in this specification introduces genetic features extracted from the third face image of a first user's associated users during the image processing model training process. These features are combined with image features extracted from the first user's face image and the age of the first user's second face image. This ensures that the image generated by the image processing model not only contains features from the first user's first face image but also facial features from the first user's associated users. When responding to a prediction request from a second user, even if the second user's age varies significantly, the genetic features can influence the realism of the generated image, thereby improving the accuracy of the model's output face image.
[0101] In one or more embodiments of this specification, such as Figure 1 Before obtaining several image features of the first face image through the encoder in the image processing model as shown in step S102, it is necessary to adjust the first face image and the third face image to facilitate the training of the image processing model. This is specifically achieved in the following way.
[0102] First, facial landmark detection is performed on the first face image and the third face image respectively to obtain the facial landmarks of the first user and the facial landmarks of the associated user.
[0103] Specifically, using any existing facial landmark recognition scheme, the facial landmarks of the first user are identified from the first face image, and the facial landmarks of related users of the first user are identified from the third face image. The facial landmarks identified from the images include the category and coordinate information of the facial landmarks. The category of the facial landmarks can be used to determine the category of the facial features corresponding to the facial landmarks, and the coordinate information of the facial landmarks can be used to determine the position and size of the facial features.
[0104] Then, using the positional relationships of each facial key point in the standard facial image as constraints, the first facial image is adjusted according to the facial key points of the first user, and the third facial image is adjusted according to the facial key points of the associated user.
[0105] Typically, the shapes and angles of faces in the facial images used to train image processing models are not entirely uniform, and some facial images may even exhibit distortion. This significantly hinders feature extraction during model training. To standardize facial images, geometric correction can be performed on the positions of facial key points, that is, the face can be resized, rotated, stretched, or transformed to a standard size and position. This makes the facial region to be recognized more regular, facilitating subsequent training of the image processing model.
[0106] Specifically, standard facial key points can be extracted from standard face images. These standard facial key points can be extracted from the frontal view image of a standard face. Using the positional relationships of the facial key points in the standard face image as constraints, the first and third face images are aligned and adjusted so that the angles and shapes of the faces in the first and third face images conform to the standard frontal view image. For example, the pose of the first user in the first face image can be adjusted from a side profile to a frontal view.
[0107] In the embodiments described in this specification, in such Figure 1 Step S102 shows that by using the encoder of the image processing model, several image features of the first face image are obtained. This can be achieved in the following ways, such as... Figure 3 As shown:
[0108] S200: Input the first face image into the feature map extraction layer of the image processing model to be trained to obtain the original feature map.
[0109] Specifically, the image processing model provided in this specification needs to extract different levels of image features of the first user from the first face image in order to perform age editing based on different levels of image features, thereby improving the realism of the generated image. To extract different levels of image features from the first face image, in one or more embodiments of this specification, a Feature Pyramid Network (FPN) approach is used to fuse multiple layers of feature maps and extract image features from the feature maps.
[0110] FPN takes a single-scale first-face image of arbitrary size as input and outputs multi-level feature maps proportionally using fully convolutional methods. FPN includes a bottom-up feature map construction path, a top-down feature map fusion path, and lateral connections. It fuses low-resolution, semantically rich feature maps with high-resolution, semantically weak but spatially rich feature maps with relatively little increase in computation. This results in FPN's feature maps containing both large-scale global features from the upper layers and small-scale detailed features from the lower layers.
[0111] By integrating high-level features into low-level features through bottom-up forward pathways and top-down pathways, the expressive power of low-level features can be enhanced, and the high resolution advantage can be used to extract fine image features.
[0112] S202: Downsample the original feature map to obtain the target feature map.
[0113] For the bottom-up feature map construction path, by downsampling the original feature map, a target feature map with a lower resolution can be obtained. Since the target feature map has a lower resolution, compared with the original feature map with a higher resolution, more global image features can be extracted from the target feature map.
[0114] S204: Determine whether the resolution of the target feature map meets the preset conditions. If yes, proceed to step S206; otherwise, return to step S202.
[0115] Furthermore, the resolution of the first face image may be relatively high, resulting in a relatively high resolution for the original feature map extracted from it. To obtain more global image features, it can be determined whether further downsampling is needed to obtain a lower-resolution target feature map, based on the resolution of the downsampled target feature map. The number of feature map layers in the FPN can be determined based on the specific application scenario, and this specification does not impose any limitations on this.
[0116] For example, such as Figure 4As shown, A1 is the first face image. A1's original feature map B1 is obtained through a feature map extraction layer. B1 undergoes downsampling to obtain the target feature map B2. If the resolution of B2 does not meet a preset condition, further downsampling is performed on B2 to obtain the target feature map B3. If the resolution of B3 meets the preset condition, a bottom-up forward path of the FPN can be constructed based on B1, B2, and B3.
[0117] S206: Arrange the original feature map and the target feature maps of different resolutions in sequence according to the resolution of the feature maps to construct the feature pyramid of the first face image.
[0118] S208: For each feature map in the image feature pyramid, perform upsampling processing on the feature map, align and fuse the upsampled feature map with the next layer feature map; wherein the resolution of the next layer feature map is the same as the resolution of the upsampled feature map.
[0119] When fusing high- and low-level feature maps, the resolution of the upper-level feature map is lower than that of the lower-level feature map. Therefore, the upper-level feature map can be upsampled to obtain the same resolution as the lower-level feature map. Then, the upsampled upper-level feature map is added and fused with the aligned lower-level feature map. The upsampling method, feature map alignment, and fusion method can be any existing method, and this specification does not limit them.
[0120] For example, such as Figure 4 The image feature pyramid shown has B3 as the highest-level feature map in the forward path. Therefore, B3 can be used as the highest-level feature map C3 in the top-down path of the FPN. After upsampling C3, the resolution of the processed C3 can be the same as that of B2. Aligning and fusing the processed C3 with B2 yields C2.
[0121] S210: Traverse the feature maps of each resolution in the image feature pyramid to obtain the fused feature maps of each resolution, and extract a specified number of image features from the fused feature maps of each resolution respectively.
[0122] Furthermore, since each image generation layer in the generator used in the embodiments of this specification can influence the facial features in the generated image by inputting at least one image feature, image features at different levels can be obtained by extracting at least one image feature from each fused feature map. For example, more global features such as facial pose, shape, or hairstyle can be extracted from the lower-resolution feature map, while finer features such as eye opening / closing, skin texture, and facial color features can be extracted from the higher-resolution feature map.
[0123] In one or more embodiments of this specification, such as Figure 1 Step S108: Based on the genetic characteristics and the age at which the second face image was acquired, feature fusion is performed on each image feature to obtain each target feature, which is determined in the following manner.
[0124] First, a first weight corresponding to the genetic feature is determined, and the genetic feature is weighted according to the first weight. Second, a second weight corresponding to the acquisition age of the second face image is determined, and the acquisition age of the second face image is weighted according to the second weight.
[0125] Specifically, in the embodiments of this specification, the image processing model not only predicts the face image of the first user at the age of the second face image based on the image features extracted from the first face image of the first user, but also introduces the genetic features extracted from the third face image of the first user's related users. It not only focuses on the age editing of the image features, but also adds the influence of genetic features on the changes in the first user's face as the first user's age changes.
[0126] Then, for each image feature, based on the weighted genetic characteristics and the age of the second face image after weighting, feature fusion is performed on the image feature to obtain the target feature corresponding to the image feature.
[0127] Specifically, the target features include a fusion of weighted genetic features, the weighted age of the second face image, and image features. This ensures that when the target features are input into the generator, the target face image generated by the generator is determined based on the image features extracted from the first face image, the age of the second face image, and the genetic features in the third face image. Furthermore, the feature fusion method can be any existing feature fusion method, and this specification does not limit it.
[0128] In the embodiments described in this specification, in such Figure 5 Step S110, which involves inputting each target feature into the generator of the image processing model to be trained to generate the target face image, can be achieved in the following ways: Figure 3 As shown:
[0129] S300: For each target feature, in the generator, the image generation layer corresponding to the target feature is determined, and the output image of the image generation layer above the image generation layer corresponding to the target feature is obtained as the upper layer image corresponding to the target feature.
[0130] In practical applications, depending on the resolution of the generated image, the generator of the image processing model can contain multiple image generation layers.
[0131] In the embodiments of this specification, the generator is composed of image generation layers with progressively increasing resolution. For the first image generation layer, since there is no previous image generation layer, and the image features in the face images generated by each image generation layer are controlled by the target features and the adaptive example normalization module, the initial input of the generator can optionally be ignored and replaced with a constant value. This can reduce the probability of generating a normal photo due to improper initial input values. On the other hand, constant input helps to reduce feature entanglement.
[0132] S302: Upsample the upper-layer image corresponding to the target feature.
[0133] Since the generator is composed of image generation layers with progressively increasing resolution, and each image generation layer generates images with different resolutions, when inputting the image output from the previous image generation layer into the next layer, the generated image can be upsampled so that it can be input into the next image generation layer.
[0134] S304: Input the target feature and the upper-layer image corresponding to the upsampled target feature into the image generation layer corresponding to the target feature to obtain the image output by the image generation layer corresponding to the target feature.
[0135] Specifically, in the embodiments of this specification, the generator may adopt the structure of the generative network in a Style Generative Adversarial Network (style GAN), and in each image generation layer, the features of the image generated by each image generation layer are controlled by inputting the target features into an adaptive example normalization module.
[0136] Optionally, before the target features are input into the image generation layer, feature decoupling can be performed on the target features. Specifically, for each target feature, feature decoupling is performed to obtain the decoupled target features. Typically, the target features obtained through encoder encoding and weighted fusion of the age and genetic features of the second face image may be entangled. That is, changes to the target features input into the lower-resolution image generation layer may affect the target features input into the higher-resolution image generation layer. For example, changes to the target features used to control face shape in an 8×8 resolution image generation layer may affect the target features used to control skin color in a 32×32 resolution image generation layer. To avoid feature entanglement, feature structures need to be constructed for each target feature so that each target feature input into the image generation layer can control different image features.
[0137] Optionally, random noise can be introduced to enrich the details of the generated image, such as the position of hair strands, the size and distribution of freckles, or wrinkles, so that the image has more realistic image features and increases the variety of variations in the output image.
[0138] S306: Determine whether the resolution of the image output by the image generation layer corresponding to the target feature meets the preset conditions; the preset conditions are determined based on the resolution of the second face image. If yes, proceed to step S308; otherwise, return to step S302.
[0139] S308: Use the image output by the image generation layer corresponding to the target feature as the target face image.
[0140] In one optional embodiment of this specification, such as Figure 5 As shown in step S300, when determining the image generation layer corresponding to each target feature in the generator, the determination can be related to the resolution of the image feature corresponding to the target feature, or it can be unrelated. Specifically, it can be divided into the following two cases:
[0141] The first scenario: The image features corresponding to the target features have a resolution attribute.
[0142] Specifically, in the image processing model provided in the embodiments of this specification, the encoder can adopt a feature pyramid structure to extract features hierarchically, obtaining image features at different levels, and thus target features at different levels. By inputting target features at different levels during the generation process of images at different resolutions, age editing is performed on facial features at different levels in the face image. For example, during the generation process of lower-resolution images, age editing is performed on global features such as the shape of the face or hairstyle, while during the generation process of higher-resolution images, age editing is performed on fine features such as the shape of facial features, skin texture, or color.
[0143] The second scenario: The image features corresponding to the target features do not have a resolution attribute.
[0144] Specifically, in the image processing model provided in the embodiments of this specification, the encoder can perform feature extraction once, that is, extract features from the original feature map to obtain a single image feature, and then obtain a single target feature. Before being input into the generator, in order to adapt to the structure of the several image generation layers contained in the generator, the single target feature obtained by the above scheme can be copied multiple times to obtain several target features. Then, during the generation process of images at different resolutions, each target feature is input separately to edit the age of facial features in face images at different resolutions.
[0145] In one or more embodiments of this specification, such as Figure 1 Step S112 trains the image processing model based on the target face image and the second face image, which can be determined in the following way:
[0146] Step 1: Extract a first age feature and a first identity feature from the target face image, and extract a second age feature and a second identity feature from the second face image.
[0147] In practical applications, one of the training objectives of image processing models is to predict the face image of the first user at the age captured in the second face image. Therefore, it is necessary to edit the age of the face while ensuring that the identity of the face remains unchanged in the generated image. For the target face image output by the model, features need to be extracted from the target face image and the second face image. These features can be at least one of identity features and age features.
[0148] Step 2: Determine the first loss based on the difference between the first age feature and the second age feature, and the difference between the first identity feature and the second identity feature.
[0149] The difference between the first age feature and the second age feature indicates the gap between the age represented by the face in the target face image and the age at which the second face image was captured. Similarly, the difference between the first identity feature and the second identity feature indicates the difference between the identity represented by the face in the target face image and the identity of the first user. Adjusting the parameters of the image processing model based on the first loss allows the age of the target face image output by the image processing model to be closer to the age at which the face was captured in the second face image, while maintaining the face identity.
[0150] Step 3: Determine the second loss based on the image difference between the target face image and the second face image.
[0151] Specifically, in one or more embodiments of this specification, one of the training objectives of the image processing model is to improve the image similarity between the target face image output by the model and the second face image.
[0152] Step 4: Determine the weights corresponding to the first loss and the second loss respectively, and weight the first loss and the second loss according to the determined weights. Then, determine the total loss based on the weighted first loss and the weighted second loss.
[0153] The first loss can be considered as the similarity in features between the target face image output by the image processing model and the labeled second face image used as training samples. The features mentioned here can be at least one of age features and identity features. The second loss can be considered as the image-level similarity between the target face image output by the image processing model and the labeled second face image used as training samples.
[0154] Optionally, a third loss can be determined based on the target face image output by the image processing model and the third face image of the associated user of the first user. Specifically, a third identity feature is extracted from the target face image, a fourth identity feature is extracted from the third face image, and a third loss is determined based on the third and fourth identity features. The third loss can characterize the difference in identity features between the target face image output by the model and the third face image. The training objective of the model can be to maximize the third loss, that is, the greater the difference between the identity of the face represented by the target face image output by the model and the identity of the face represented by the third face image, the better.
[0155] Step 5: Train the image processing model with the goal of minimizing the total loss.
[0156] In an optional embodiment of this specification, in such a way... Figure 1 After obtaining the face image of the second user at the target age predicted by the image processing model in step S114, the face image output by the model can be subjected to super-resolution processing to improve the resolution of the face image and thus improve the clarity of the face image.
[0157] In an optional embodiment of this specification, in such a way... Figure 1 After obtaining the face image of the second user at the target age predicted by the image processing model in step S114, facial attribute editing can be performed on the face image output by the model. In response to a facial attribute editing request input by the second user, facial attribute editing is performed on the face image of the second user at the target age predicted by the trained image processing model according to the editing information carried in the facial attribute editing request. The editing information includes at least one of skin color information, body posture information, facial features information, and facial accessory information.
[0158] Figure 6 A schematic diagram of a model training device provided in this specification specifically includes:
[0159] The acquisition module 400 is used to acquire a first face image and a second face image collected at different ages of the first user, and to acquire a third face image of an associated user of the first user; the associated user has a genetic relationship with the first user;
[0160] The training sample determination module 402 is used to determine training samples based on the acquisition age of the second face image, the first face image, and the third face image, and to use the second face image as the label of the training sample.
[0161] The image feature determination module 404 is used to input the training samples into the image processing model to be trained, and obtain the image features of the first face image through the encoder in the image processing model;
[0162] The genetic feature determination module 406 is used to extract genetic features from the third face image through the genetic feature extraction layer in the image processing model;
[0163] The target feature determination module 408 is used to perform feature fusion for each image feature based on the genetic features, the acquisition age of the second face image, and the image feature to obtain the target feature;
[0164] The generation module 410 is used to input each target feature into the generator of the image processing model to generate a target face image;
[0165] Training module 412 is used to train the image processing model with the goal of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples;
[0166] The prediction module 414 is used to input the original face image of the second user, the face image of the associated user of the second user, and the target age carried in the prediction request into the trained image processing model when a prediction request is received, so as to obtain the face image of the second user at the target age predicted by the image processing model.
[0167] Optionally, the device further includes:
[0168] The adjustment module 416 is specifically used to perform facial key point detection on the first face image and the third face image respectively to obtain the facial key points of the first user and the facial key points of the associated user; using the positional relationship of the facial key points in the standard face image as a constraint, the first face image is adjusted according to the facial key points of the first user, and the third face image is adjusted according to the facial key points of the associated user.
[0169] Optionally, the image feature determination module 404 is specifically configured to construct an image feature pyramid based on the first face image; for each feature map in the image feature pyramid, perform upsampling processing on the feature map, align and fuse the upsampled feature map with the next layer feature map; wherein the resolution of the next layer feature map is the same as the resolution of the upsampled feature map; traverse the feature maps of each resolution in the image feature pyramid to obtain the fused feature maps of each resolution, and extract a specified number of image features from the fused feature maps of each resolution respectively.
[0170] Optionally, the image feature determination module 404 is specifically configured to input the first face image into the feature map extraction layer of the encoder to obtain an original feature map; downsample the original feature map to obtain a target feature map; determine whether the resolution of the target feature map meets a preset condition; the preset condition is determined based on the resolution of the second face image; if not, continue downsampling the target feature map until the downsampled target feature map meets the preset condition; if yes, arrange the original feature map and each target feature map at different resolutions in sequence according to the resolution of the feature map to construct a feature pyramid of the first face image.
[0171] Optionally, the target feature determination module 408 is specifically used to determine the first weight corresponding to the genetic feature, and weight the genetic feature according to the first weight; determine the second weight corresponding to the acquisition age of the second face image, and weight the acquisition age of the second face image according to the second weight; for each image feature, perform feature fusion according to the weighted genetic feature, the weighted acquisition age of the second face image, and the image feature to obtain the target feature corresponding to the image feature.
[0172] Optionally, the generation module 410 is specifically configured to, for each target feature, determine the image generation layer corresponding to the target feature in the generator, and obtain the output image of the image generation layer above the image generation layer corresponding to the target feature as the upper layer image corresponding to the target feature; input the target feature and the upsampled upper layer image corresponding to the target feature into the image generation layer corresponding to the target feature to obtain the image output by the image generation layer corresponding to the target feature; determine whether the resolution of the image output by the image generation layer corresponding to the target feature meets a preset condition; the preset condition is determined based on the resolution of the second face image; if not, input the image output by the image generation layer corresponding to the target feature into the next image generation layer corresponding to the target feature until the resolution of the image output by the image generation layer meets the preset condition; if yes, use the image output by the image generation layer corresponding to the target feature as the target face image.
[0173] Optionally, the generation module 410 is specifically used to classify the several image generation layers included in the generator according to resolution to obtain image generation layers of each resolution; determine the resolution corresponding to the target feature based on the image features corresponding to the target feature; extract the image features from the feature maps of each resolution included in the image feature pyramid of the encoder; and determine the image generation layer corresponding to the target feature based on the resolution corresponding to the target feature and the image generation layers of each resolution.
[0174] Optionally, the training module 412 is specifically configured to extract a first age feature and a first identity feature from the target face image; extract a second age feature and a second identity feature from the second face image; determine a first loss based on the difference between the first age feature and the second age feature, and the difference between the first identity feature and the second identity feature; determine a second loss based on the image difference between the target face image and the second face image; determine the weights corresponding to the first loss and the second loss respectively, and weight the first loss and the second loss according to the determined weights; determine the total loss based on the weighted first loss and the weighted second loss; and train the image processing model with minimizing the total loss as the training objective.
[0175] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 The model training method shown.
[0176] This instruction manual also provides Figure 7 The diagram shows a schematic structural representation of the electronic device. Figure 7At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for the business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to achieve the above-mentioned functions. Figure 1 The model training method is shown. Of course, in addition to the software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.
[0177] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0178] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0179] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0180] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0181] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0182] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0183] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0184] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0185] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0186] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0187] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0188] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0189] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0190] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0191] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0192] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. A model training method, the method comprising: Acquire first and second face images of the first user at different ages, and acquire third face images of users associated with the first user; The associated user has a genetic relationship with the first user; Based on the age at which the second face image was captured, the first face image, and the third face image, training samples are determined, and the second face image is used as the label of the training samples. The training samples are input into the image processing model to be trained, and the encoder in the image processing model is used to obtain the image features of the first face image. Genetic features are extracted from the third face image through the genetic feature extraction layer in the image processing model. For each image feature, feature fusion is performed based on the genetic feature, the acquisition age of the second face image, and the image feature itself to obtain a target feature. Specifically, a first weight corresponding to the genetic feature is determined, and the genetic feature is weighted according to the first weight. Similarly, a second weight corresponding to the acquisition age of the second face image is determined, and the acquisition age of the second face image is weighted according to the second weight. For each image feature, feature fusion is performed based on the weighted genetic feature, the weighted acquisition age of the second face image, and the image feature itself to obtain the target feature corresponding to that image feature. Each target feature is input into the generator of the image processing model to generate a target face image; The image processing model is trained with the objective of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples; When a prediction request is received, the original face image of the second user, the face image of the associated user of the second user, and the target age carried in the prediction request are input into the trained image processing model to obtain the face image of the second user at the target age predicted by the image processing model.
2. The method as described in claim 1, before obtaining the image features of the first face image through the encoder in the image processing model, the method further includes: Facial landmark detection is performed on the first face image and the third face image respectively to obtain the facial landmarks of the first user and the facial landmarks of the associated user. Using the positional relationships of facial key points in a standard facial image as constraints, the first facial image is adjusted based on the facial key points of the first user, and the third facial image is adjusted based on the facial key points of the associated user.
3. The method as described in claim 1, wherein the encoder of the image processing model obtains several image features of the first face image, specifically including: Based on the first face image, construct an image feature pyramid; For each feature map in the image feature pyramid, the feature map is upsampled, and the upsampled feature map is aligned and fused with the next layer feature map; wherein the resolution of the next layer feature map is the same as the resolution of the upsampled feature map. The feature maps at each resolution in the image feature pyramid are traversed to obtain the fused feature maps at each resolution, and a specified number of image features are extracted from the fused feature maps at each resolution.
4. The method as described in claim 3, wherein constructing an image feature pyramid based on the first face image specifically includes: The first face image is input into the feature map extraction layer of the encoder to obtain the original feature map; The original feature map is downsampled to obtain the target feature map; Determine whether the resolution of the target feature map meets preset conditions; the preset conditions are determined based on the resolution of the second face image; If not, continue downsampling the target feature map until the downsampled target feature map meets the preset conditions; If so, the original feature map and the target feature maps of different resolutions are arranged sequentially according to the resolution of the feature maps to construct the feature pyramid of the first face image.
5. The method as described in claim 1, wherein each target feature is input into the generator of the image processing model to be trained to generate a target face image, specifically including: For each target feature, in the generator, the image generation layer corresponding to the target feature is determined, and the output image of the image generation layer above the image generation layer corresponding to the target feature is obtained as the upper layer image corresponding to the target feature. The target feature and the upper-layer image corresponding to the upsampled target feature are input into the image generation layer corresponding to the target feature to obtain the image output by the image generation layer corresponding to the target feature. Determine whether the resolution of the image output by the image generation layer corresponding to the target feature meets the preset conditions; the preset conditions are determined based on the resolution of the second face image; If not, the image output by the image generation layer corresponding to the target feature is input into the next image generation layer corresponding to the target feature, until the resolution of the image output by the image generation layer meets the preset condition; If so, the image output by the image generation layer corresponding to the target feature is used as the target face image.
6. The method of claim 5, wherein determining the image generation layer corresponding to the target feature in the generator specifically includes: The generator contains several image generation layers, which are classified according to resolution to obtain image generation layers of each resolution. Based on the image features corresponding to the target feature, the resolution corresponding to the target feature is determined; the image features are extracted from the feature maps of each resolution contained in the image feature pyramid of the encoder; Based on the resolution corresponding to the target feature and the image generation layer for each resolution, the image generation layer corresponding to the target feature is determined.
7. The method as described in claim 1, wherein training the image processing model with the objective of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples, specifically includes: Extract the first age feature and the first identity feature from the target face image; Extract the second age feature and the second identity feature from the second facial image; The first loss is determined based on the difference between the first age feature and the second age feature, and the difference between the first identity feature and the second identity feature; The second loss is determined based on the image difference between the target face image and the second face image; Determine the weights corresponding to the first loss and the second loss respectively, and then weight the first loss and the second loss according to the determined weights; The total loss is determined based on the weighted first loss and the weighted second loss; The image processing model is trained with the goal of minimizing the total loss.
8. A model training apparatus, the apparatus comprising: The acquisition module is used to acquire a first face image and a second face image collected at different ages of the first user, and to acquire a third face image of an associated user of the first user; the associated user has a genetic relationship with the first user; The training sample determination module is used to determine training samples based on the acquisition age of the second face image, the first face image, and the third face image, and to use the second face image as the label of the training sample. The image feature determination module is used to input the training samples into the image processing model to be trained, and obtain the image features of the first face image through the encoder in the image processing model; The genetic feature determination module is used to extract genetic features from the third face image through the genetic feature extraction layer in the image processing model; A target feature determination module is used to perform feature fusion for each image feature based on the genetic features, the acquisition age of the second face image, and the image feature itself to obtain target features; wherein, a first weight corresponding to the genetic features is determined, and the genetic features are weighted according to the first weight; and a second weight corresponding to the acquisition age of the second face image is determined, and the acquisition age of the second face image is weighted according to the second weight; for each image feature, feature fusion is performed based on the weighted genetic features, the weighted acquisition age of the second face image, and the image feature itself to obtain the target feature corresponding to that image feature; a generation module is used to input each target feature into the generator of the image processing model to generate a target face image; The training module is used to train the image processing model with the goal of minimizing the difference between the target face image and the label corresponding to the second face image of the training samples; The prediction module is used to input the original face image of the second user, the face image of the associated user of the second user, and the target age carried in the prediction request into the trained image processing model when a prediction request is received, so as to obtain the face image of the second user at the target age predicted by the image processing model.
9. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of claims 1 to 7.