Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- stable-diffusion
|
| 5 |
+
- sdxl
|
| 6 |
+
- lora
|
| 7 |
+
- age-transformation
|
| 8 |
+
- dreambooth
|
| 9 |
+
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# AgeBooth LoRA Models
|
| 13 |
+
|
| 14 |
+
Two LoRA adapters for age transformation with Stable Diffusion XL.
|
| 15 |
+
|
| 16 |
+
## Files
|
| 17 |
+
|
| 18 |
+
- `young_lora.safetensors`: Young age group (10-20 years)
|
| 19 |
+
- `old_lora.safetensors`: Old age group (70-80 years)
|
| 20 |
+
|
| 21 |
+
## Training Details
|
| 22 |
+
|
| 23 |
+
- **Base Model:** SDXL 1.0
|
| 24 |
+
- **Method:** DreamBooth LoRA
|
| 25 |
+
- **LoRA Rank:** 4
|
| 26 |
+
- **Resolution:** 512x512
|
| 27 |
+
- **Steps:** 200 per LoRA
|
| 28 |
+
- **Precision:** FP16 mixed precision
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from diffusers import StableDiffusionXLImg2ImgPipeline
|
| 34 |
+
import torch
|
| 35 |
+
|
| 36 |
+
# Load base model
|
| 37 |
+
pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
|
| 38 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 39 |
+
torch_dtype=torch.float16
|
| 40 |
+
).to("cuda")
|
| 41 |
+
|
| 42 |
+
# Load young LoRA
|
| 43 |
+
pipe.load_lora_weights("ShubhamBaghel307/agebooth-loras", weight_name="young_lora.safetensors")
|
| 44 |
+
young_image = pipe(prompt="young person", image=input_face).images[0]
|
| 45 |
+
|
| 46 |
+
# Load old LoRA
|
| 47 |
+
pipe.load_lora_weights("ShubhamBaghel307/agebooth-loras", weight_name="old_lora.safetensors")
|
| 48 |
+
old_image = pipe(prompt="elderly person", image=input_face).images[0]
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Linear Interpolation
|
| 52 |
+
|
| 53 |
+
For intermediate ages, blend the LoRAs:
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
# Load both LoRAs
|
| 57 |
+
young_state = torch.load("young_lora.safetensors")
|
| 58 |
+
old_state = torch.load("old_lora.safetensors")
|
| 59 |
+
|
| 60 |
+
# Interpolate (alpha=0.5 for middle age)
|
| 61 |
+
alpha = 0.5
|
| 62 |
+
mixed_state = {
|
| 63 |
+
k: alpha * young_state[k] + (1 - alpha) * old_state[k]
|
| 64 |
+
for k in young_state.keys()
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Dataset
|
| 69 |
+
|
| 70 |
+
Trained on age-filtered subsets of IMDB-Wiki dataset:
|
| 71 |
+
- Young: 25 images (ages 10-20)
|
| 72 |
+
- Old: 25 images (ages 70-80)
|
| 73 |
+
|
| 74 |
+
## Performance
|
| 75 |
+
|
| 76 |
+
- **Inference Time:** ~4-5 sec/step on RTX 4050
|
| 77 |
+
- **VRAM Usage:** ~5.5GB
|
| 78 |
+
- **Quality:** Best with 50+ inference steps
|
| 79 |
+
|
| 80 |
+
## Citation
|
| 81 |
+
|
| 82 |
+
```bibtex
|
| 83 |
+
@misc{agebooth2025,
|
| 84 |
+
title={AgeBooth: Identity-Preserved Age Transformation},
|
| 85 |
+
author={Baghel, Shubham},
|
| 86 |
+
year={2025}
|
| 87 |
+
}
|
| 88 |
+
```
|