File size: 2,647 Bytes
8ab230d
 
4ed47f2
891e9de
 
8ab230d
c951530
4ed47f2
8ab230d
f069dfc
891e9de
059df5c
f069dfc
 
 
 
 
 
20a1910
 
8ab230d
 
891e9de
 
 
 
20a1910
 
 
 
 
 
 
 
891e9de
f069dfc
891e9de
f069dfc
 
 
 
 
 
 
 
 
 
 
 
20a1910
f069dfc
20a1910
f069dfc
 
 
059df5c
 
20a1910
 
 
 
 
 
 
f069dfc
 
 
 
 
 
 
20a1910
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: LandmarkDiff
emoji: "\U0001F52C"
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.50.0
python_version: "3.11"
app_file: app.py
pinned: true
license: mit
short_description: Facial surgery prediction -- 2D foundation toward 3D
tags:
  - medical-imaging
  - face
  - landmarks
  - thin-plate-spline
  - surgery-simulation
  - facial-analysis
  - symmetry
---

# LandmarkDiff

Anatomically-conditioned facial surgery outcome prediction from standard clinical photography.

Upload a face photo, select a surgical procedure, adjust intensity, and see the predicted outcome in real time using thin-plate spline warping on CPU.

## Features

- **Single Procedure**: Predict the outcome of one procedure at a chosen intensity
- **Compare All**: See all six procedures side by side at the same intensity
- **Intensity Sweep**: View a single procedure from 0% to 100% in six steps
- **Symmetry Analysis**: Measure bilateral facial symmetry across five regions, with pre/post comparison

## Supported Procedures

| Procedure | Description |
|-----------|-------------|
| **Rhinoplasty** | Nose reshaping (bridge, tip, alar width) |
| **Blepharoplasty** | Eyelid surgery (lid position, canthal tilt) |
| **Rhytidectomy** | Facelift (midface and jawline tightening) |
| **Orthognathic** | Jaw surgery (maxilla/mandible repositioning) |
| **Brow Lift** | Brow elevation and forehead ptosis reduction |
| **Mentoplasty** | Chin surgery (projection and vertical height) |

## How It Works

1. **MediaPipe landmarks** -- 478-point facial mesh extraction
2. **Anatomical displacement** -- procedure-specific landmark shifts scaled by intensity (0-100)
3. **TPS deformation** -- thin-plate spline warps the image smoothly
4. **Masked compositing** -- blends the surgical region back into the original photo

GPU modes (ControlNet, img2img) with photorealistic rendering are available in the full package.

**Roadmap:** This 2D TPS demo is the foundation. Next up -- 3D face reconstruction from phone video for interactive surgical preview.

## Photo Tips

- Use a front-facing, well-lit photo with a neutral expression
- Remove glasses, hats, or anything covering the face
- Make sure only one face is clearly visible
- At least 256x256 resolution recommended

## Links

- [GitHub](https://github.com/dreamlessx/LandmarkDiff-public)
- [Documentation](https://github.com/dreamlessx/LandmarkDiff-public/tree/main/docs)
- [Wiki](https://github.com/dreamlessx/LandmarkDiff-public/wiki)
- [Discussions](https://github.com/dreamlessx/LandmarkDiff-public/discussions)

**Version:** v0.2.2 | **License:** MIT | For research and educational purposes only