A face age simulation method
By combining semantic segmentation and generative adversarial networks, the problem of insufficient decoupling of identity information and age information in existing technologies is solved. The generated age-appropriate face images are clearer, have shorter training time, better identity consistency, and are closer to the real face appearance of the target age group.
Patent Information
- Application Number
- CN202310689267.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-06-12
AI Technical Summary
Existing methods for facial aging are unable to fully decouple identity information from age information, making it difficult to identify the generated age-rated image and the input face as the same person, especially when the age range is large, resulting in poor identity consistency performance.
A semantic segmentation model is used for image preprocessing, a generative adversarial network is constructed, and the source-target age difference encoding is designed. The network parameters are updated through backpropagation to generate clear age-appropriate face images and maintain identity consistency.
The generated age-appropriate facial images are clearer, require less training time, have better identity consistency, and closely resemble the real facial appearance of people in the target age group.
Smart Images

Figure CN116758611B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a method for simulating facial aging. Background Technology
[0002] Generative adversarial networks (GANs) are currently the main method for simulating facial aging. They typically decouple the identity information and age information of the input face and then fuse the identity information with the age information of the target age group to generate an aged facial image. However, to date, the widely used facial aging methods are still relatively weak in maintaining identity consistency.
[0003] Existing technologies often aim to improve the decoupling of facial identity information from age information, but they struggle to fully decouple these two aspects. This weakens a person's identity features, making it difficult to identify the generated age-corrected image as the same person as the input image. In other words, existing facial age correction methods have poor consistency in maintaining identity. Moreover, the greater the gap between the input age and the target age range, the more pronounced this phenomenon becomes, ultimately causing the age correction result to change from one person to another.
[0004] Therefore, to address the aforementioned technical issues, a method for simulating facial aging is needed. Summary of the Invention
[0005] The purpose of this invention is to provide a facial aging simulation method to solve the problem that existing facial aging methods use a scheme that decouples identity information from age information. Due to the difficulty in achieving sufficient decoupling, the characteristics of a person's identity are weakened, resulting in poor performance in maintaining identity consistency. Ultimately, this leads to the technical problem of the aging result changing from one person to another. Moreover, the larger the gap between the age of the input face and the target age range, the more obvious this phenomenon becomes.
[0006] This invention provides a method for simulating facial aging, which is performed according to the following steps:
[0007] S1: Use a semantic segmentation model to preprocess the face age dataset to remove the background and retain the face region to obtain the face image to be simulated for ageing.
[0008] S2: Design the original-target age difference code required when aging from the original age group to the target age group, and the target-original age difference code when aging from the target age group to the original age group;
[0009] S3: Construct a generative adversarial network, which includes a generator, a discriminator, an age difference encoder, and a mapping network. The original-target age difference encoder, the target-original age difference encoder that is aged from the target age group to the original age group, and the face image to be aged are fed into the generator and the discriminator to construct age difference information.
[0010] S4: Calculate the loss functions of the generator and discriminator, the age loss function, the identity consistency loss function, and the loss function of the generative adversarial network. The loss function of the discriminator includes the loss function of the generative adversarial network. Update the network parameters through backpropagation to complete the training of the generative adversarial network.
[0011] S5: Use the face image to be aged as input to the generator to obtain the face age-aged image.
[0012] Optionally, in step S1, the specific steps include:
[0013] S11: Collect a face age dataset, which includes face images of different age groups and their corresponding age labels;
[0014] S12: A pre-trained semantic segmentation network is used. This network can distinguish semantic information in the input image. Each image in the dataset is used as the input of this network, and the output is the semantic map of each image.
[0015] S13: Based on the semantic map of each face image, retain only the semantic parts related to the face, facial features, hair and neck, and randomly rotate the face images after the operation to complete the construction of the dataset.
[0016] Optionally, in step S11, the different age groups include 0-2 years old, 3-6 years old, 7-9 years old, 15-19 years old, 30-39 years old, and 50-69 years old.
[0017] Optionally, in step S2, assuming there are n age groups, the age difference code I has 50×2n bits, where every 50 bits is used to represent the age difference information when transitioning from one age group to an adjacent age group;
[0018] First, add the age difference code I to a noise vector of the same length that follows a Gaussian distribution. Then, using the 50×n bit as the reference bit, construct the age difference code from the original age group to the target age group j. Add 1 to the bits from the 50×n to the 50×(n+j)-1 bits, and leave the other bits unchanged.
[0019] To construct an age difference code from the target age group j to the original age group, we need to add 1 to the 50×n-1 to 50×(nj) bits, while keeping the other bits unchanged.
[0020] Optionally, in step S3, the specific steps include:
[0021] S31: Construct the encoder structure in the generator. The encoder part first uses a 7×7 convolutional layer with a stride of 1, followed by a ReLU activation function and a pixel normalization layer; then two 3×3 convolutional layers with a stride of 2, each followed by a ReLU activation function and a pixel normalization layer; then four residual blocks with a stride of 1, the first three residual blocks are followed by a ReLU activation function and a pixel normalization layer, and the last residual block is not followed by a pixel normalization layer, thus completing the construction of the encoder;
[0022] S32: Construct the decoder structure in the generator. The main body of the decoder is constructed using an age difference injection module. The age difference injection module is a residual structure consisting of a convolutional layer and a style convolutional layer from StyleGAN2. The decoder contains a total of 6 age difference injection modules and a convolutional layer with a 1×1 kernel. After the 5th and 6th age difference injection modules, an upsampling layer is added to restore the feature map to the size of the input image. The last layer is a convolutional layer with a 1×1 kernel to reduce the number of channels of the feature map to 3. Finally, a Tanh activation function is added to complete the construction of the decoder.
[0023] S33: Construct an age difference encoder, which is a convolutional neural network. Its first layer is a convolutional layer composed of 7×7 convolutional kernels with a stride of 1, followed by 5 convolutional layers composed of 3×3 convolutional kernels with a stride of 2, and finally a convolutional layer composed of 1×1 convolutional kernels with a stride of 1. The first 5 convolutional layers are followed by LReLU activation functions. The 6th convolutional layer is followed by a global average pooling layer, which is responsible for reducing the dimension of the feature map to a vector.
[0024] S34: Construct a mapping network consisting of 8 linear layers. The first 7 linear layers are followed by a ReLU activation function and a pixel normalization layer, while the last layer is followed by only a pixel normalization layer.
[0025] S35: Construct the decoder part, which adopts the decoder structure proposed in StyleGAN2;
[0026] S36: The original-target age difference code and the face image to be age-simulated are fed into the generator to generate the age-simulated face image of the target age group and the reconstructed face image of the original age group. The age-simulated face image of the target age group and the target-original age difference code are fed into the generator as input to generate the reconstructed image of the target age group and the age-simulated face image of the original age group. The age-simulated image and the real face are fed into the discriminator. The real face of the target age group, the age-simulated face image of the target age group, and the face image to be age-simulated are respectively used as input to the age difference encoder to construct age difference information.
[0027] Compared with existing technologies, this invention provides a method for simulating facial aging. It uses a facial age dataset and a semantic segmentation model for image preprocessing to obtain the facial image to be simulated for aging. It designs the original-to-target age difference encoding required when aging from the original age group to the target age group. It constructs a generative adversarial network (GAN) to generate age difference information. It updates the network parameters through backpropagation to complete the training of the GAN. The facial image to be aged is used as input to the generator to obtain the aged facial image. The advantages of this invention are: (1) shorter training time required to generate clear aged facial effects; (2) better consistency performance of the generated aged facial identity; and (3) the generated aged facial is closer to the real facial appearance of the input face at the target age group. Attached Figure Description
[0028] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent upon reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, with the same or corresponding reference numerals denoteing the same or corresponding parts, wherein:
[0029] Figure 1 This is a flowchart illustrating the facial aging simulation method of the present invention;
[0030] Figure 2 This is a schematic diagram of the age difference injection module of the present invention;
[0031] Figure 3 This is a structural diagram of the age difference encoder of the present invention;
[0032] Figure 4 This is a network structure diagram of the face aging method based on age differences of the present invention;
[0033] Figure 5 This is an illustration of the aging effect of the face aging method based on age differences of the present invention;
[0034] Figure 6These are facial aging effect images obtained from different time machine programs using existing technology. Detailed Implementation
[0035] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Unless otherwise specified, the techniques used in the embodiments are conventional means well known to those skilled in the art.
[0036] It should be noted that, unless otherwise stated, the technical or scientific terms used in this invention should be understood in their ordinary sense by those skilled in the art. In this document, relational terms such as “first” and “second” are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms “connected,” “linked,” etc., should be interpreted broadly, for example, referring to a fixed connection, a detachable connection, or an integral connection; a mechanical connection or an electrical connection; a direct connection or an indirect connection via an intermediate medium. The terms “comprising,” “including,” or any other variations thereof are intended to cover a 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 limitations, an element defined by the phrase “comprising…” does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0037] like Figure 1 As shown, this embodiment provides a method for simulating facial aging, which is performed according to the following steps:
[0038] S1: Use a semantic segmentation model to preprocess the face age dataset to remove the background and retain the face region to obtain the face image to be simulated for ageing.
[0039] In step S1, the specific steps include:
[0040] S11: Collect a face age dataset, which includes face images of different age groups and their corresponding age labels;
[0041] In step S11, the different age groups include 0-2 years old, 3-6 years old, 7-9 years old, 15-19 years old, 30-39 years old, and 50-69 years old.
[0042] S12: A pre-trained semantic segmentation network is used. This network can distinguish a total of 19 semantic information in the input image, including background, facial skin, facial features, clothing, and neck. Each image in the dataset is used as the input of this network, and the output is the semantic map of each image.
[0043] S13: Based on the semantic map of each face image, retain only the semantic parts related to the face, facial features, hair and neck, and randomly rotate the face images after the operation to complete the construction of the dataset.
[0044] S2: Design the original-target age difference code required when aging from the original age group to the target age group, and the target-original age difference code when aging from the target age group to the original age group;
[0045] In step S2, assuming there are n age groups, the age difference code I has 50×2n bits, where every 50 bits is used to represent the age difference information when transitioning from one age group to an adjacent age group;
[0046] First, add the age difference code I to a noise vector of the same length that follows a Gaussian distribution. Then, using the 50×n bit as the reference bit, construct the age difference code from the original age group to the target age group j. Add 1 to the bits from the 50×n to the 50×(n+j)-1 bits, and leave the other bits unchanged.
[0047] To construct an age difference code from the target age group j to the original age group, we need to add 1 to the 50×n-1 to 50×(nj) bits, while keeping the other bits unchanged.
[0048] S3: Construct a generative adversarial network (GAN), which includes a generator, a discriminator, an age difference encoder, and a mapping network. The original-target age difference encoder, the target-original age difference encoder (aged from the target age group to the original age group), and the face image to be age-simulated are fed into the generator and discriminator to construct age difference information, such as... Figure 2 and Figure 4 As shown;
[0049] In step S3, the specific steps include:
[0050] S31: Construct the encoder structure in the generator. The encoder part first uses a 7×7 convolutional layer with a stride of 1, followed by a ReLU activation function and a pixel normalization layer; then two 3×3 convolutional layers with a stride of 2, each followed by a ReLU activation function and a pixel normalization layer; then four residual blocks with a stride of 1, the first three residual blocks are followed by a ReLU activation function and a pixel normalization layer, and the last residual block is not followed by a pixel normalization layer, thus completing the construction of the encoder;
[0051] S32: Construct the decoder structure in the generator. The main body of the decoder is constructed using an age difference injection module. The age difference injection module is a residual structure consisting of a convolutional layer and a style convolutional layer from StyleGAN2. The decoder contains a total of 6 age difference injection modules and a convolutional layer with a 1×1 kernel. After the 5th and 6th age difference injection modules, an upsampling layer is added to restore the feature map to the size of the input image. The last layer is a convolutional layer with a 1×1 kernel to reduce the number of channels of the feature map to 3. Finally, a Tanh activation function is added to complete the construction of the decoder.
[0052] S33: Construct an age difference encoder, which is a convolutional neural network. Its first layer is a 7×7 convolutional layer with a stride of 1, followed by five 3×3 convolutional layers with a stride of 2, and finally a 1×1 convolutional layer with a stride of 1. The first five convolutional layers are followed by an LReLU activation function. The sixth convolutional layer is followed by a global average pooling layer responsible for reducing the dimensionality of the feature map to a vector. Figure 3 As shown;
[0053] S34: Construct a mapping network consisting of 8 linear layers. The first 7 linear layers are followed by a ReLU activation function and a pixel normalization layer, while the last layer is followed by only a pixel normalization layer.
[0054] S35: Construct the decoder part, which adopts the decoder structure proposed in StyleGAN2;
[0055] S36: The original-target age difference code and the face image to be age-simulated are fed into the generator to generate the age-simulated face image of the target age group and the reconstructed face image of the original age group. The age-simulated face image of the target age group and the target-original age difference code are fed into the generator as input to generate the reconstructed image of the target age group and the age-simulated face image of the original age group. The age-simulated image and the real face are fed into the discriminator. The real face of the target age group, the age-simulated face image of the target age group, and the face image to be age-simulated are respectively used as input to the age difference encoder to construct age difference information.
[0056] S4: Calculate the loss functions of the generator and discriminator, the age loss function, the identity consistency loss function, and the loss function of the generative adversarial network. The loss function of the discriminator includes the loss function of the generative adversarial network. Update the network parameters through backpropagation to complete the training of the generative adversarial network.
[0057] S5: Use the face image to be aged as input to the generator to obtain an aged face image, such as... Figure 5 As shown.
[0058] For example, in this embodiment, the face age dataset is divided into 6 groups: 0-2 (Group 1), 3-6 (Group 2), 7-9 (Group 3), 15-19 (Group 4), 30-39 (Group 5), and 50-69 (Group 6). The face dataset is preprocessed by using a pre-trained deeplabv3+ network to obtain the semantic map corresponding to each face image in the dataset. Based on the semantic map, only the semantic parts related to the face, facial features, hair, and neck of each image in the dataset are retained. Then, the dataset is randomly rotated to complete the preprocessing operation of the dataset.
[0059] An age difference code is constructed based on 6 groups, with a total length of 50 × (6 × 2) = 600 bits, and each bit is set to 0. This age difference code is added to a 600-bit vector that follows a Gaussian distribution with a mean of 0 and a variance of 0.04. Taking the 300th bit as the base bit, each positive 50 bits represents a set of age difference information adjacent to the age range of the input face, where the target age range is older than the age range of the input image. These 50 bits are incremented by 1. If the aging process spans two age ranges, the calculation starts from the base bit, and each positive 100 bits are incremented by 1. Each negative 50 bits represents a set of age difference information adjacent to the age range of the input face, where the target age range is younger than the age range of the input image.
[0060] The network is constructed below. Table 1 shows the encoder network structure.
[0061] Table 1 Encoder Network Structure
[0062]
[0063]
[0064] Table 2 shows the decoder network structure.
[0065] Table 2 Decoder Network Structure
[0066]
[0067] Table 3 shows the mapping network.
[0068] Table 3 Mapping network structure table
[0069]
[0070]
[0071] Table 4 shows the decoder network structure.
[0072] Table 4. Structure of Age Difference Encoder
[0073]
[0074] The following is the loss function part of the training process. First, regarding the constraint identity information, the network contains the input image x. orig The aged image y trans Reconstructing image x rec , and with y trans As input, the image x of the original age group x is generated again. cyc Using x orig and x rec A reconstruction loss is constructed, aiming to obtain a reconstructed face image that is sufficiently close to the original face image. x is used. orig and x cyc A cycle consistency loss is constructed to ensure that when the aged image is re-aged to the initial age group, the generated result is sufficiently close to the original face image. These two losses control the generator to enhance the consistency of identity information when generating age images. The two loss functions are shown in Equations (1) and (2):
[0075] L rec =||x orig -x rec ||1 (1)
[0076] L cyc =||x orig -x cyc ||1 (2)
[0077] The next step is to constrain the age information. First, constraints are applied using the values obtained from the age difference encoder. The age difference encoder is responsible for performing the difference learning. Its input is an image y showing the changes in age. trans An original facial image of a person in age group Y. orig An original face image of a person in age group x. orig Three face images are processed by an age difference encoder A to obtain the age information encoding A(y) contained in each image. trans ), A(y orig), A(x orig ). Among them, A(y trans As an encoding of age information in aged facial images, A(y) contains features extracted from non-real data. orig ) and A(x orig The data is extracted from real data. When using age group x as the original age group and aging it to age group y, A(x) is used. orig Based on A(y), trans ) and A(y orig Subtract A(x) from the minuend respectively. orig This yields two encoded DIFF files containing information about age differences. y_trans-x_orig With dif y_orig-x_orig Both age codes are used as control l age The value of l is used in the loss function calculation. age This allows for the acquisition of more reliable information representing age differences. The entire process can be represented by formula (3):
[0078]
[0079] The DIF obtained after calculation by the age difference encoder y_trans-x_orig With dif y_orig-x_orig As the truth value of the age constraint. dif y_orig-x_orig To obtain age information by subtracting two real data sets as input, the system itself can encode age I. age Provide truthful information so that I age The obtained implicit vector l age This yields a more accurate representation of the actual age. Simultaneously, dif... y_orig-x_orig As an age difference information obtained from a real data image and a generated data image, it does not completely contain the true age representation, but it does contain the age information of the age-rendered image. It can also be constrained to feed the age difference back to the age code I. age This is to improve the age authenticity of the aged images. The two loss functions are shown in formulas (4) and (5):
[0080] L dif_t =||I age -dif y_orig-x_orig ||1 (4)
[0081] L dif_f =||I age -dif y_trans-x_orig ||1 (5)
[0082] The final age difference loss function is the sum of the two loss functions mentioned above, as shown in formula (6):
[0083] L age =L dif_t +L dif_f (6)
[0084] Simultaneously, both the generated age-adjusted face image and the real face image are used as inputs to the discriminator, generating a vector that serves as the discriminator's prediction of the age group to which the provided image belongs. The age information of the generated image is also constrained, as shown in formula (7):
[0085] L adv (G,D)=E x,a (logD a (x))+E x,b (log(1-D b (y trans ))) (7)
[0086] Where 'a' represents the age range of the real image and 'b' represents the age range of the generated image. The discriminator output is a vector, where the number of bits represents the specific age range category, and each bit represents the probability that the input image belongs to that age range. However, when calculating the loss function, it is only responsible for providing the predicted value of the bit position of the correct age range. For example, if the input real image is of age range 'a', then when calculating the loss, it is only necessary to provide the predicted bit position of age range 'a', which is used as a constraint term of the loss function. When the input image is a generated image and its age range is 'b', it is only necessary to provide the predicted bit position of age range 'b', which is used as a constraint term of the loss function for calculation. Finally, the overall loss function of the network is shown in formula (8):
[0087] L = min maxL adv (G,D)+λ rec L rec (G)+λ cyc L cyc (G)+λ age L age (G) (8)
[0088] Where, λ rec λ represents the hyperparameter of the reconstruction loss function. cyc λ represents the hyperparameter of the cycle-consistent loss function. age The hyperparameters representing the age difference loss function are λ. The reconstruction loss, cycle consistency loss, and age difference loss are only constrained during generator training. This completes the definition of the loss function for the age difference-based face aging network, which allows us to simultaneously optimize both age and identity information of the face. In the hyperparameter part, λ... rec , λ cyc Set to 10, λ ageThe momentum was set to 0.5. The optimizer used was Adam, with its momentum set to 0.9 and the learning rate set to 0.001.
[0089] The training process is detailed below. Overall, during each forward propagation, the network includes at least two face images per epoch: one for age group x and one for age group y. This ensures that the network can simultaneously perform age-to-age conversion based on real samples during a single forward propagation. Consequently, the gradient calculated through the loss function during backpropagation incorporates the age-reduction process in both directions, improving the accuracy of bidirectional age-reduction. The overall training of the network is divided into generator training and discriminator training, which are described in detail below.
[0090] The generator training process primarily involves both the generator and the discriminator. In the generator part, during one forward propagation, one input image generates one reconstructed image and one age-added image. It's important to emphasize that these two images are not generated separately during a single forward propagation, but simultaneously. This is due to the age difference injection structure. Because each layer of the age difference injection structure injects age-related information into the feature map, and another feature map that skips the age-injection part after passing through convolutional layers, the final output after multiple layers of age difference injection structures is the reconstructed face and the age-added face.
[0091] After obtaining the reconstructed and aged faces, cycle-consistent training continues. The aged face is used as input to the generator, and the aging process is repeated to obtain a face image sufficiently close to the original face. The generator used here is the same one used previously to generate both the reconstructed and aged faces from the original face image. In other words, this network has only one generator responsible for simulating both aging and rejuvenation. The main control over the aging direction lies in the provided age information. The aged faces generated at this stage only participate in the calculation of the cycle-consistent loss function and do not participate in the discriminator training process.
[0092] In the discriminator section, the age-adjusted face is used as input to obtain a vector predicted by the discriminator. This vector contains the probability of the age group predicted by the discriminator for the input image. When calculating the loss function, only the value represented by the bit corresponding to the expected age group of the image is used, and the rest are discarded. The above describes the training process of the overall generator.
[0093] The discriminator training process requires generated images from the generator. These generated images do not store gradient information; they are only used for discriminator training and do not update the generator's weights. The age-rated face and the real face are used as inputs to obtain two vectors predicted by the discriminator. Similarly, when these two vectors are used in the loss calculation, only the values representing the expected age range of each image are selected for the loss function calculation, and the remaining bits are discarded. This completes the training of the discriminator.
[0094] Once the network is trained, the test face to be aged can be input into the network to complete the face ageing simulation, such as... Figure 5 As shown, in Figure 5 In the image, the left image is the input image, and the right image is the output image. However, in existing technologies, that is... Figure 6 In the middle, the leftmost image is the input image, and the rest are the output images.
[0095] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for simulating facial aging, characterized in that: This method is performed according to the following steps: S1: Use a semantic segmentation model to preprocess the face age dataset to remove the background and retain the face region to obtain the face image to be simulated for ageing. S2: Design the original-target age difference code required when aging from the original age group to the target age group, and the target-original age difference code when aging from the target age group to the original age group; The specific steps include: assuming there are n age groups, the age difference code I has 50×2n bits, where every 50 bits is used to represent the age difference information when transitioning from one age group to an adjacent age group; First, add the age difference code I to a noise vector of the same length that follows a Gaussian distribution. Then, using the 50×n bit as the reference bit, construct the age difference code from the original age group to the target age group j. Add 1 to the bits from the 50×n to the 50×(n+j)-1 bits, and leave the other bits unchanged. To construct the age difference code from the target age group j to the original age group, we need to add 1 to the 50×n-1 to 50×(nj) bits, while keeping the other bits unchanged; S3: Construct a generative adversarial network (GAN), which includes a generator, a discriminator, an age difference encoder, and a mapping network. Specifically, the GAN has only one generator responsible for bidirectional simulation of aging and rejuvenation, controlling the aging direction based on the provided age information. The generator's training process includes: in one forward propagation, the face image to be simulated for aging and the original-target age difference encoder are input into the generator to generate the aging face image of the target age group and the reconstructed face image of the original age group. After obtaining the aging face image of the target age group and the reconstructed face image of the original age group, cyclic consistent training continues, that is, the aging face image of the target age group and the target-original age difference encoder are used as input to the generator, and the aging operation is performed again to obtain the reconstructed image of the target age group and the aging face image of the original age group. The training process of the discriminator includes: taking real face images and age-modified face images of the target age group as input, obtaining a vector after prediction by the discriminator, the content of which contains the probability of age group predicted by the discriminator for the input image; and constructing age difference information. S4: Calculate the loss functions of the generator and discriminator, the age loss function, the identity consistency loss function, and the loss function of the generative adversarial network. The loss function of the discriminator includes the loss function of the generative adversarial network. Update the network parameters through backpropagation to complete the training of the generative adversarial network. S5: Use the face image to be aged as input to the generator to obtain the face age-aged image.
2. The facial aging simulation method according to claim 1, characterized in that: In step S1, the specific steps include: S11: Collect a face age dataset, which includes face images of different age groups and their corresponding age labels; S12: A pre-trained semantic segmentation network is used to distinguish semantic information in the input image. Each image in the dataset is used as the input of the network, and the output is the semantic map of each image. S13: Based on the semantic map of each face image, retain only the semantic parts related to the face, facial features, hair and neck, and randomly rotate the face images after the operation to complete the construction of the dataset.
3. The facial aging simulation method according to claim 2, characterized in that: In step S11, the different age groups include 0-2 years old, 3-6 years old, 7-9 years old, 15-19 years old, 30-39 years old, and 50-69 years old.
4. The facial aging simulation method according to claim 1, characterized in that: In step S3, the specific steps also include: S31: Construct the encoder structure in the generator. The encoder part first uses a 7×7 convolutional layer with a stride of 1, followed by a ReLU activation function and a pixel normalization layer; then two 3×3 convolutional layers with a stride of 2, each followed by a ReLU activation function and a pixel normalization layer; then four residual blocks with a stride of 1, the first three residual blocks are followed by a ReLU activation function and a pixel normalization layer, and the last residual block is not followed by a pixel normalization layer, thus completing the construction of the encoder; S32: Construct the decoder structure in the generator. The main body of the decoder is constructed using an age difference injection module. The age difference injection module is a residual structure consisting of a convolutional layer and a style convolutional layer from StyleGAN2. The decoder contains a total of 6 age difference injection modules and a convolutional layer with a 1×1 kernel. After the 5th and 6th age difference injection modules, an upsampling layer is added to restore the feature map to the size of the input image. The last layer is a convolutional layer with a 1×1 kernel to reduce the number of channels of the feature map to 3. Finally, a Tanh activation function is added to complete the construction of the decoder. S33: Construct an age difference encoder, which is a convolutional neural network. Its first layer is a convolutional layer composed of 7×7 convolutional kernels with a stride of 1, followed by 5 convolutional layers composed of 3×3 convolutional kernels with a stride of 2, and finally a convolutional layer composed of 1×1 convolutional kernels with a stride of 1. The first 5 convolutional layers are followed by LReLU activation functions. The 6th convolutional layer is followed by a global average pooling layer, which is responsible for reducing the dimension of the feature map to a vector. S34: Construct a mapping network consisting of 8 linear layers. The first 7 linear layers are followed by a ReLU activation function and a pixel normalization layer, while the last layer is followed by only a pixel normalization layer. S35: Construct the decoder part, which follows the decoder structure proposed in StyleGAN2.