A diffusion model cross-age face generation method based on text guidance and attention mechanism

By using a diffusion model with text guidance and attention mechanisms, the problems of age editing accuracy and identity feature preservation in cross-age face generation are solved, achieving fine-grained, high-fidelity face generation that can adapt to image generation for different age groups and genders.

CN122156361APending Publication Date: 2026-06-05NORTHWEST UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHWEST UNIV
Filing Date
2026-01-30
Publication Date
2026-06-05

Smart Images

  • Figure CN122156361A_ABST
    Figure CN122156361A_ABST
Patent Text Reader

Abstract

The application discloses a diffusion model cross-age face generation method based on text guidance and attention mechanism, comprising the following steps: collecting face images covering the whole age span, taking the processed images as label images, and matching the label images with corresponding age labels to form standardized cross-age training data pairs; based on the cross-age training data pairs, a pre-trained diffusion model is iteratively trained; using the iteratively trained diffusion model, an image, an age text corresponding to the image and a target age text are inputted to obtain an initial latent vector, an age text embedding vector corresponding to the image and a target age text embedding vector; an exchange cross-attention graph of text-image correlation is established, a precise semantic mapping is constructed by bidirectional interaction of the age text embedding vector corresponding to the image and the initial latent vector; the target age text embedding vector is called to replace the age text embedding vector corresponding to the image, and an inversion algorithm is adopted to gradually denoise the initial latent vector, and a cross-age face image is outputted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of face image generation, specifically involving a cross-age face generation method based on a diffusion model using text guidance and attention mechanisms. Background Technology

[0002] As one of the most recognizable biological features of the human body, the face contains unique and relatively stable information such as facial features and contour structure. However, facial features are significantly age-dependent; over time, facial bone contours, skin texture, and muscle morphology undergo irreversible natural changes. Cross-age face generation technology aims to generate facial images of individuals at different ages while preserving their identity characteristics. It has significant application value in scenarios such as generating clues for family reunification, film and television special effects production, aging simulation of virtual avatars, and cross-age portrait reconstruction of criminal suspects. It can supplement image information for criminal investigations, expand the scope of investigations, and help investigators accurately grasp the physical characteristics of target individuals.

[0003] The core challenge of cross-age face generation is to ensure the accurate and natural expression of age features while preserving the stability of identity features to the greatest extent possible, which places extremely high demands on the model's feature modeling and control capabilities.

[0004] Early traditional methods used linear models to fit the facial aging process, which consumed few computational resources but produced blurry details and insufficient age characteristics. With the rapid development of neural networks, deep learning methods have shown outstanding capabilities in image generation. Many researchers have proposed facial aging methods based on generative adversarial networks, which improve the realism of generated images through adversarial training and enhance the preservation of identity features to some extent. However, they are subject to the risk of pattern collapse and lack generalization ability for complex scenes such as pose changes and occlusion interference. The generation effect is poor in extreme age groups such as infants and the elderly.

[0005] The face aging method based on generative adversarial networks (GANs) introduces various adversarial losses to ensure that the asymptotic mappings between different age domains are fully correlated, thereby simulating the complex correlations between ages and improving the aging effect. However, GANs are generated by random noise and lack semantic information. They also sometimes suffer from training instability, vanishing gradients, and pattern collapse. They heavily rely on large-scale, high-quality face age datasets, failing to fully capture data distributions, and perform poorly in generating cross-age faces at extreme ages and in rare poses. Furthermore, they suffer from insufficient age editing precision, failing to accurately capture fine-grained age features, especially at extreme ages such as infants and the elderly, easily leading to artifacts, unreasonable facial structures, and an inability to recreate facial features consistent with physiological patterns. Identity feature preservation is also poor, easily resulting in changes to age-independent attributes, such as adding irrelevant attributes like glasses during generation, affecting the generation effect. Finally, the coordination between semantic guidance and spatial control is poor, limiting the processing to discrete, finite age categories (such as age ranges) and failing to respond to continuous, arbitrary specific age numerical inputs. Summary of the Invention

[0006] To overcome the shortcomings of the prior art, the present invention aims to provide a cross-age face generation method based on a diffusion model using text guidance and attention mechanism. This method solves the problems of insufficient age editing accuracy of adversarial networks, imbalance between identity and age features, and poor coordination between semantic guidance and spatial control. It achieves fine-grained, high-fidelity, and identity-consistent cross-age face generation, effectively balancing age editing accuracy and identity feature retention, and optimizing the generation effect in extreme age scenarios.

[0007] This invention is achieved through the following technical solution: A cross-age face generation method based on a diffusion model using text guidance and attention mechanisms includes the following steps: S1. Collect face images covering the entire age range, simultaneously collect the age label corresponding to each face image, construct a cross-age face dataset, and perform cropping and alignment processing on the collected face images in sequence. Use the processed face images as label images and match them with the corresponding age labels to form standardized cross-age training data pairs. S2. Based on the cross-age training data pairs constructed in step S1, the pre-trained diffusion model is iteratively trained. During the training process, a composite loss function consisting of target loss, regularization loss, and smoothing loss is introduced, and the model parameters are fine-tuned through backpropagation of the loss values. S3. Using the diffusion model trained iteratively in step S2, input the image, the age text corresponding to the image, and the target age text. Perform hierarchical text description on the input target age text and the age text corresponding to the image, and then convert them into text embedding vectors through CLIP text encoder to obtain the age text embedding vector corresponding to the image and the target age text embedding vector, which are used as text condition inputs for the generation process. At the same time, map the image to the latent space of the diffusion model through VAE encoder to obtain the corresponding initial latent vector. S4. Establish a text-image association relationship and exchange cross-attention map. By bidirectionally interacting the age text embedding vector and the initial latent vector corresponding to the image output in step S3, a precise semantic mapping is constructed to obtain the correspondence between age semantics and facial regions. S5. After the initial latent vector is processed by the latent space smoothing module, the target age text embedding vector generated in step S3 is called. Based on the text-image association relationship constructed in step S4, the cross attention map is exchanged to replace the age text embedding vector corresponding to the image. Then, the inversion algorithm is used to gradually remove noise from the initial latent vector and output the cross-age face image.

[0008] Furthermore, in step S1, the selection of cross-age face datasets controls the proportions of males and females, races, and poses to improve the balance and generalization ability of model training.

[0009] Furthermore, in step S2, the pre-trained diffusion model is the Stable Diffusion v1.5 model, which incorporates low-rank adaptation weights for smooth diffusion. During training, the model fine-tuning parameters are set as follows: batch size is 2, training steps are 150, the AdamW optimizer is used, and the learning rate is set to 1.0 × 10⁻⁶. -6 .

[0010] Furthermore, in step S2, the construction of the composite loss function includes the following steps: S2.1 Set the regularization prompt "photo of a person" to retain the model's prior knowledge of general facial features; set the target prompt "photo of a [X] person", where [X] represents a specific age value to guide the model to accurately learn age-specific features, in order to achieve collaborative learning of general facial features and age-specific features; S2.2 The composite loss function is composed of a weighted average of smoothing loss, target loss, and regularization loss. The definitions of each loss term and the calculation of the total loss are as follows: Target loss: Where t is the time step of the diffusion process, and x t For noisy latent variables, This is the original, real noise. (θ) represents the model prediction noise residual, and P(obj) represents the target cue word "photo of a [X] person", which is used to drive the model to focus on learning age-specific features; Regularization loss: Where, x t ’ P(reg) is a noisy latent variable based on regularized cue words, which is used to ensure that the model retains common facial features while learning age features, thus avoiding feature distortion. Smoothing loss: in, The initial latent vector corresponding to the input image The incremental change For diffusion process The cumulative decay coefficient at time step, For noise Regarding the initial potential vector The transpose of the Jacobian matrix, For preset smoothing constraints; Total loss: .

[0011] Furthermore, in step S3, the hierarchical text description adopts a precise age value plus lifecycle label structure. The age corresponding to the image is obtained by inputting the image through a pre-trained age estimator to obtain the precise age value and lifecycle label structure.

[0012] Furthermore, the age estimator is a DEX classifier or the Face++ API.

[0013] Furthermore, the life cycle labels are: 0-2 years old as baby, 3-19 years old as girl / boy, 20-39 years old as woman / man, and 40 years and above as elderly woman / elderly man.

[0014] Furthermore, in step S5, the cross-attention map is exchanged by replacing the text-image association relationship between the precise age value and the life cycle label, thereby achieving semantic replacement between the age corresponding to the image and the target age.

[0015] Furthermore, the Null text inversion image inversion algorithm is used in step S5.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: The diffusion model of this invention, with its iterative denoising generation mechanism, effectively overcomes the inherent defects of generative adversarial networks, generating images with rich details and high diversity, making it a superior technical solution for cross-age generation tasks. Through hierarchical text guidance, the model can accurately understand and generate continuous age features from infancy to old age, achieving a mean absolute error (MAE) of 8.73 on the FFHQ-AGING dataset, demonstrating high age editing accuracy and supporting fine-grained control. Image inversion is used to determine the generation starting point, combined with targeted replacement of cross-attention maps, ensuring that editing only affects age-related features, achieving an identity similarity (ID) of 84.82, effectively avoiding irrelevant attribute changes and demonstrating excellent identity feature preservation. Simultaneously, the smoothing loss function and iterative training parameter fine-tuning reduce artifacts, resulting in generated images with reasonable facial structures and realistic textures even in extreme age scenarios such as infants aged 0-2 years and elderly people over 70 years old.

[0017] This invention uses hierarchical text guidance to anchor fine-grained age features, and combines text-image association exchange with cross-attention maps to achieve editing of age-sensitive regions and preservation of identity features. The method is robust, has good generalization ability, is fine-tuned based on a pre-trained diffusion model, requires little training data (only 150 images), and performs stably on multiple datasets such as FFHQ-Aging and CelebA-HQ, adapting to face images of different genders and ethnicities. Attached Figure Description

[0018] Figure 1 This is a flowchart of the method of the present invention.

[0019] Figure 2 This is a schematic diagram of the iterative training of the pre-trained diffusion model of the present invention.

[0020] Figure 3 This is a comparison image of the cross-age face generation results of the present invention.

[0021] Figure 4 This is a schematic diagram of the extreme age conversion of the present invention.

[0022] Figure 5 This is a comparison chart showing the age conversion process of this invention. Detailed Implementation

[0023] The present invention will be further described in detail below with reference to specific embodiments. These descriptions are for explanation purposes only and are not intended to limit the scope of the invention.

[0024] A diffusion model based on text guidance and attention mechanism is proposed to generate cross-age faces. This method anchors fine-grained age features through hierarchical text guidance and combines cross-attention mechanism to edit age-sensitive regions and preserve identity features, ultimately achieving cross-age face generation with stable identity and accurate age.

[0025] The core idea of ​​this invention is as follows: First, a small training data pair of cross-age face images and age labels is constructed, and a diffusion model is trained based on this dataset; after the age is determined for the input image, the input age text and the corresponding age in the image are hierarchically encoded; the input image is mapped to the latent space through diffusion inversion to determine the generation starting point, and the association between the text encoding and the latent vector of the image is constructed by means of a cross-attention mechanism and attention map exchange is completed to achieve targeted age editing; finally, after sampling denoising and decoding, cross-age face images with stable identity and accurate age are output.

[0026] like Figure 1 As shown, a diffusion model-based cross-age face generation method using text guidance and attention mechanisms includes the following steps: S1. Cross-Age Training Data Collection and Preprocessing: 150 face images covering the entire age range (0-2 years, 3-6 years, 7-9 years, 10-14 years, 15-19 years, 20-29 years, 30-39 years, 40-49 years, 50-69 years, and 70 years and above) were collected from the FFHQ dataset. Age labels for each image were simultaneously acquired to construct a cross-age face dataset, providing data support for the pre-training of the diffusion model. The collected face images were sequentially cropped and aligned. The preprocessed face images were used as label images and integrated with the corresponding age labels to form standardized cross-age training data pairs, ensuring the stability of model training and subsequent processes.

[0027] S2. Model Training: Based on the cross-age training data pairs constructed in step S1, the pre-trained diffusion model is iteratively trained. Combining dual text embedding vectors, noise is gradually reduced through a multi-step inverse diffusion process, enabling the model to learn the age features of faces from different age groups. A pre-trained Stable Diffusion v1.5 model is used, integrating low-rank adaptation weights from smooth diffusion. During training, the batch size is set to 2, the training steps are 150, the AdamW optimizer is used, and the learning rate is set to 1.0 × 10⁻⁶. -6 This ensures that the model converges efficiently and learns stable features.

[0028] like Figure 2 As shown, a composite loss function consisting of target loss, regularization loss, and smoothing loss is introduced during training, supplemented by a parameter fine-tuning strategy. The specific design is as follows: 1. Dual-cue word guided training: Set the regularized cue word "photo of a person" to retain the model's prior knowledge of general facial features; set the target cue word "photo of a [X]person" ("photo of a [X]-year-old person"), where [X] represents a specific age value (e.g., 12-year-old), to guide the model to accurately learn age-specific features and achieve collaborative learning of general facial features and age-specific features.

[0029] 2. Loss Function Design: The total loss function is a weighted average of the smoothing loss, the target loss, and the regularization loss. The definitions of each loss term and the calculation of the total loss are as follows: Target loss: Where t is the time step of the diffusion process, and x t For noisy latent variables, This is the original, real noise. (θ) represents the model prediction noise residual, and P(obj) represents the target cue word "photo of a [X] person", which is used to drive the model to focus on learning age-specific features; Regularization loss: Where, x t ’ P(reg) is a noisy latent variable based on regularized cue words, which is used to ensure that the model retains common facial features while learning age features, thus avoiding feature distortion. To further improve the feature continuity and visual smoothness of cross-age generated images, a smoothing loss is introduced to constrain the smoothness of potential spatial vector changes and reduce artifacts and local abrupt changes that occur during age editing. The formula is as follows: Smoothing loss: in, The initial latent vector corresponding to the input image The incremental change For diffusion process The cumulative decay coefficient at time step, For noise Regarding the initial potential vector The transpose of the Jacobian matrix, For preset smoothing constraints; Total loss: ; Where, λ reg =1, λ smooth=1. By combining the weights, we can balance age-specific learning, general facial knowledge preservation, and feature smoothness constraints, which can ensure the accuracy of age editing and the stability of identity, improve the visual naturalness of the generated image, and avoid artifacts.

[0030] S3. Hierarchical Text Description Information Encoding: Based on the cross-age face dataset constructed in step S1, the diffusion model is pre-trained and fine-tuned to provide a model foundation for subsequent encoding and generation processes. In the encoding stage, hierarchical descriptions are first performed on the input target age text and the age text corresponding to the input image, respectively. Both are converted into high-dimensional embedding vectors using the CLIP text encoder, serving as the text conditional input for the generation process. Diffusion inversion is performed on the input image, mapping the real input image to the latent space of the diffusion model to obtain the corresponding initial latent vector, thus determining the starting point for diffusion generation.

[0031] The hierarchical text description uniformly adopts a "fine-grained age item + lifecycle label" structure, specifically expressed as "photo of [X] [L]": [X] is the precise age value (e.g., the age corresponding to the input image is 8 years old as determined by the age judgment module, i.e., "8-year-old", and the target age text specifies 60 years old, i.e., "60-year-old"); [L] is the matched lifecycle label (0-2 years old is baby, 3-19 years old is girl / boy, 20-39 years old is woman / man, 40 years old and above is elderly woman / elderly man, or 20-39 years old is adult, 40-69 years old is middle-aged, and 70 years old and above is elderly), ensuring that the encoded result accurately carries the age semantics. The age judgment module is implemented using a pre-trained age estimator DEX classifier, which automatically estimates the age of the input image, automatically matches the corresponding [X] and [L], and generates personalized target prompt words to achieve accurate guidance based on age features.

[0032] S4. Construction and Association of Cross-Attention Mechanism: A text-image bidirectional cross-attention module is constructed as the core association unit between age semantics and facial features. This module receives the output text embedding vector and simultaneously connects to the latent image vector after diffusion inversion. Through bidirectional interaction, a precise semantic mapping between the two is constructed, establishing a one-to-one correspondence between age semantics and facial regions.

[0033] S5. After the initial latent space is smoothed by the latent space module, the text encoding generated in step S3 is called through the cross-attention module. Based on the constructed text-image association relationship, the cross-attention map is exchanged to achieve the fusion and editing of the target age and the original identity features. Subsequently, an inversion algorithm is used to gradually predict and remove noise to complete the inversion process; noise is gradually removed from the latent variables to output a cross-age face image that retains the original identity features and age features accurately.

[0034] By swapping the cross-attention maps corresponding to the age item [X] and life cycle label [L] in the target prompt, semantic replacement of the age corresponding to the input image and the target input age is achieved, thus completing targeted age editing. Only age-related pixels are adjusted in a targeted manner, thereby avoiding the problem of identity feature distortion from a mechanism perspective. At the same time, the consistency constraints between text conditions and image features are strengthened, resulting in the latent vector of the image after editing.

[0035] The selection of the dataset in step S1 can control the proportions of males and females, races, poses, etc., to improve the balance and generalization ability of model training. In addition to the FFHQ dataset, other face datasets can also be used.

[0036] The text prompts in step S3 can be further refined, and the way lifecycle tags are divided can be adjusted according to the actual application scenario. For example, sub-tags such as "teenager" and "middle-aged" can be added, as long as semantic anchoring at the group level can be achieved. Large language models can also be introduced to assist in generating accurate prompts and enhance the accuracy of age semantic expression.

[0037] The age estimator in step S3 can be replaced with other pre-trained models with comparable performance (such as the age estimation function in the Face++ API), while still meeting the accuracy requirements for age estimation.

[0038] The null text inversion image inversion algorithm used in step S4 can be replaced with other inversion algorithms.

[0039] Figure 3 The results of a comparative study on the CelebA-HQ dataset are presented. It can be observed that, compared with other methods, the method proposed in this invention generates clearer images: not only are aging features such as wrinkles added, but the generated images also present a natural state of facial muscle relaxation; compared with the CUSP method, this invention does not introduce additional accessories such as glasses, and has higher visual fidelity to the input image.

[0040] like Figure 4 Under the transformation of the middle extreme age, the left image is the input image, the middle image is the result of the FADING method, and the right image is the method proposed in this paper. It can be seen that the method proposed in this paper not only changes the facial texture of the face, but also achieves changes in the contour and facial muscles.

[0041] like Figure 5As shown, on the FFHQ-Aging data, the input image is converted to all age groups consistent with the CUSP scheme, covering continuous changes throughout the life cycle. The method of this invention generates significantly fewer artifacts, more natural facial contours and structures, more realistic textures, more realistic semantic modifications, and a higher degree of fit with real-world age features. As shown in columns 1-2, when generating faces of people with a target age of 0-2 years, our method can adjust facial contours according to the facial aging life cycle pattern; when the person in the original image is wearing facial accessories, the CUSP method loses the accessories (first row), and the FADING method distorts the eye area inside the glasses (fifth row); in contrast, the method of this invention is more robust to images containing facial accessories.

[0042] Example Experimental environment: The experiment uses a single server, configured as follows: CPU: Intel(R) Core(TM) i7-14700K, GPU: NVIDIA GeForce RTX 4090, 1TB SSD, 64GB DDR4 memory, ensuring efficient and stable operation of model training and inference processes.

[0043] Software environment: Operating system is Ubuntu 20.04.5 LTS, Python 3.9, deep learning framework is PyTorch 1.12.1, CUDA 11.3, OpenCV 4.4.0, and diffuses 0.10.0. Test set: The first 2000 images of the FFHQ-AGING dataset The Mean Absolute Error of Age (MAE) is the absolute value of the age of the generated image compared to the age of the real target. The age prediction value of the original image is calculated by the DEX classifier, and the age prediction value of the generated image is calculated using a third-party tool, Megvii Technology's Face++ AI development platform (Face++ Application Programming Interface, Face++ API). A smaller MAE value indicates higher age editing accuracy.

[0044] Gender retention level: Using a third-party tool, Megvii Technology's Face++ AI development platform (Face++ Application Programming Interface, Face++ API), the confidence threshold was set to 76.5%. The higher the confidence value, the more accurate the retention of attributes between the two samples.

[0045] Kernel Inception Distance (KID): Used to measure the distributional similarity between generated and real images. It is calculated by determining the maximum mean difference (MMD) of the kernel matrix after feature extraction using the Inception v3 model. The formula is as follows: in To generate the feature distribution of the image, The KID value represents the feature distribution of a real image. The smaller the KID value, the higher the quality of the generated image and the closer the visual effect is to the real image.

[0046] Identity Similarity (ID-Score): The ArcFace face recognition model is used to calculate the similarity of identity features between the input image and the generated image. The higher the score, the better the identity features are preserved.

[0047] Table 1 Comparative tests on the FFHQ-AGING test set. As can be seen from the data in Table 1: The age MAE of this invention is as low as 8.73, indicating that this invention effectively improves the accuracy of age editing by anchoring fine-grained age features through hierarchical text guidance, enabling fine-grained age control for any age. Regarding gender preservation, the method of this invention achieves superior gender preservation results in most age groups, with a near-perfect gender preservation rate in the 20-69 age group. The gender preservation rate is lower in the 0-9 age group because children's facial gender features are not obvious. A lower preservation rate means that the model's generated results are closer to the real facial state of children, avoiding unnatural biases caused by forcibly preserving gender features, and better reflecting the natural appearance of children aged 0-9. In terms of generation quality, the KID value of this invention is lower than that of the comparison method in almost all age groups, and the generated effect is closer to the real image. Regarding identity feature preservation, the identity similarity of this invention reaches 84.82, significantly higher than the comparison method. This is due to the text-image cross-attention map replacement mechanism, which ensures that editing only affects age-related features (such as wrinkles, skin texture, facial contours, etc.) without changing core identity features.

Claims

1. A cross-age face generation method based on a diffusion model using text guidance and attention mechanisms, characterized in that, Includes the following steps: S1. Collect face images covering the entire age range, simultaneously collect the age label corresponding to each face image, construct a cross-age face dataset, and perform cropping and alignment processing on the collected face images in sequence. Use the processed face images as label images and match them with the corresponding age labels to form standardized cross-age training data pairs. S2. Based on the cross-age training data pairs constructed in step S1, the pre-trained diffusion model is iteratively trained. During the training process, a composite loss function consisting of target loss, regularization loss, and smoothing loss is introduced, and the model parameters are fine-tuned through backpropagation of the loss values. S3. Using the diffusion model trained iteratively in step S2, input the image, the age text corresponding to the image, and the target age text. Perform hierarchical text description on the input target age text and the age text corresponding to the image, and then convert them into text embedding vectors through CLIP text encoder to obtain the age text embedding vector corresponding to the image and the target age text embedding vector, which are used as text condition inputs for the generation process. At the same time, map the image to the latent space of the diffusion model through VAE encoder to obtain the corresponding initial latent vector. S4. Establish a text-image association relationship and exchange cross-attention map. By bidirectionally interacting the age text embedding vector and the initial latent vector corresponding to the image output in step S3, a precise semantic mapping is constructed to obtain the correspondence between age semantics and facial regions. S5. After the initial latent vector is processed by the latent space smoothing module, the target age text embedding vector generated in step S3 is called. Based on the text-image association relationship constructed in step S4, the cross attention map is exchanged to replace the age text embedding vector corresponding to the image. Then, the inversion algorithm is used to gradually remove noise from the initial latent vector and output the cross-age face image.

2. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 1, characterized in that, In step S1, the selection of cross-age face datasets controls the proportions of males and females, races, and poses to improve the balance and generalization ability of model training.

3. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 1, characterized in that, In step S2, the pre-trained diffusion model is the Stable Diffusion v1.5 model, which incorporates low-rank adaptive weights for smooth diffusion. During training, the model fine-tuning parameters are set as follows: batch size of 2, training steps of 150, AdamW optimizer, and learning rate of 1.0 × 10⁻⁶. -6 .

4. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 3, characterized in that, In step S2, the construction of the composite loss function includes the following steps: S2.1 Set the regularization prompt "photo of a person" to retain the model's prior knowledge of general facial features; set the target prompt "photo of a [X] person", where [X] represents a specific age value to guide the model to accurately learn age-specific features, in order to achieve collaborative learning of general facial features and age-specific features; S2.2 The composite loss function is composed of a weighted average of smoothing loss, target loss, and regularization loss. The definitions of each loss term and the calculation of the total loss are as follows: Target loss: Where t is the time step of the diffusion process, and x t For noisy latent variables, This is the original, real noise. (θ) represents the model prediction noise residual, and P(obj) represents the target cue word "photo of a [X] person", which is used to drive the model to focus on learning age-specific features; Regularization loss: Where, x t ’ P(reg) is a noisy latent variable based on regularized cue words, which is used to ensure that the model retains common facial features while learning age features, thus avoiding feature distortion. Smoothing loss: in, The initial latent vector corresponding to the input image The incremental change For the diffusion process The cumulative decay coefficient at time step, For noise Regarding the initial potential vector The transpose of the Jacobian matrix, For preset smoothing constraints; Total loss: .

5. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 1, characterized in that, In step S3, the hierarchical text description adopts a precise age value plus life cycle label structure. The age corresponding to the image is obtained by inputting the image through a pre-trained age estimator to obtain the precise age value and life cycle label structure.

6. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 5, characterized in that, The age estimator is either a DEX classifier or the Face++ API.

7. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 5, characterized in that, The life cycle labels are: 0-2 years old as baby, 3-19 years old as girl / boy, 20-39 years old as woman / man, and 40 years old and above as elderly woman / elderly man.

8. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 5, characterized in that, In step S5, the cross-attention map is exchanged by replacing the text-image association relationship between the precise age value and the life cycle label, thereby achieving semantic replacement between the age corresponding to the image and the target age.

9. The cross-age face generation method based on text guidance and attention mechanism using a diffusion model according to claim 1, characterized in that, The Null text inversion image inversion algorithm is used in step S5.