English / 简体中文
TimeMachine combines description text, numerical age text, identity embeddings, and an age codebook through separate cross-attention branches. ACG is used during training only.
conda env create -f environment.yml
conda activate timemachineEnvironment: Python 3.9, PyTorch 2.1.0 / CUDA 12.1, Diffusers 0.31.0, and Transformers 4.46.0.
Download the models from Google Drive, then place ckpt/ and external_models/ in the repository root:
TimeMachine/
├── ckpt/
│ ├── Time Machine.bin
│ └── age_codebook.pt
└── external_models/
├── stable-diffusion-v1-5/
├── sd-vae-ft-mse/
├── insightface/
└── parsing_bisenet.pth
Run an example image with its JSON configuration:
python infer.py \
--input examples/man1/input.png \
--output outputs/man1 \
--config examples/man1/config.jsonReplace man1 in all three paths with woman1, man2, or woman2 to run another example.
Run your own image:
python infer.py \
--input path/to/portrait.jpg \
--output outputs/custom \
--prompt "A portrait of a person"New portraits are cropped automatically, with identity features and masks extracted using local models. The default target ages are 10, 20, 30, 40, 50, 60, and 70. One image per age is saved directly to the specified output directory.
Use --ages, --strength, --seed, and other options to adjust the results. Command-line arguments override the JSON configuration. See python infer.py --help for all options.
@misc{mi2025timemachine,
title={TimeMachine: Fine-Grained Facial Age Editing with Identity Preservation},
author={Yilin Mi and Qixin Yan and Zheng-Peng Duan and Chunle Guo and Hubery Yin and Hao Liu and Chen Li and Jing Lyu and Chongyi Li},
year={2025},
eprint={2508.11284},
archivePrefix={arXiv},
primaryClass={cs.CV},
doi={10.48550/arXiv.2508.11284},
url={https://arxiv.org/abs/2508.11284}
}
