Update README.md
Browse files
README.md
CHANGED
|
@@ -2,4 +2,64 @@
|
|
| 2 |
license: mit
|
| 3 |
datasets:
|
| 4 |
- SoroushMehraban/3D-Pain
|
| 5 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
datasets:
|
| 4 |
- SoroushMehraban/3D-Pain
|
| 5 |
+
---
|
| 6 |
+
# ViTPain: Pretrained Vision Transformer for Pain Assessment
|
| 7 |
+
|
| 8 |
+
Pretrained checkpoint for **ViTPain**, a reference-guided Vision Transformer for automated pain intensity assessment. Trained on the [3D-Pain synthetic dataset](https://huggingface.co/datasets/SoroushMehraban/3D-Pain). Use this checkpoint to fine-tune on real pain datasets (e.g. UNBC-McMaster).
|
| 9 |
+
|
| 10 |
+
## Model Details
|
| 11 |
+
|
| 12 |
+
- **Architecture**: DinoV3-large backbone + LoRA (rank=8, alpha=16)
|
| 13 |
+
- **Task**: PSPI regression (0–16) and Action Unit prediction
|
| 14 |
+
- **Training**: 3D-Pain synthetic faces, 150 epochs
|
| 15 |
+
- **Best checkpoint**: epoch 141, validation MAE 1.859
|
| 16 |
+
- **Input**: 224×224 RGB face image + optional neutral reference image
|
| 17 |
+
|
| 18 |
+
## Download
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
pip install huggingface-hub
|
| 22 |
+
huggingface-cli download xinlei55555/ViTPain vitpain-epoch=141-val_regression_mae=1.859.ckpt --local-dir ./
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Or in Python:
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
from huggingface_hub import hf_hub_download
|
| 29 |
+
|
| 30 |
+
checkpoint = hf_hub_download(
|
| 31 |
+
repo_id="xinlei55555/ViTPain",
|
| 32 |
+
filename="vitpain-epoch=141-val_regression_mae=1.859.ckpt"
|
| 33 |
+
)
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Load and Use
|
| 37 |
+
|
| 38 |
+
Clone the [PainGeneration](https://github.com/TaatiTeam/Pain-in-3D) repo, then:
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from lib.models.vitpain import ViTPain
|
| 42 |
+
|
| 43 |
+
model = ViTPain.load_from_checkpoint(checkpoint)
|
| 44 |
+
model.eval()
|
| 45 |
+
# Input: pain image + neutral reference; output: pspi_pred (0–1, scale to 0–16), aus_pred
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## Fine-tuning on UNBC-McMaster
|
| 49 |
+
|
| 50 |
+
Use `--au_loss_weight 0.1` when fine-tuning on UNBC (vs 1.0 for synthetic). See the main repo for full training scripts.
|
| 51 |
+
|
| 52 |
+
## Citation
|
| 53 |
+
|
| 54 |
+
```bibtex
|
| 55 |
+
@article{lin2025pain,
|
| 56 |
+
title={Pain in 3D: Generating Controllable Synthetic Faces for Automated Pain Assessment},
|
| 57 |
+
author={Lin, Xin Lei and Mehraban, Soroush and Moturu, Abhishek and Taati, Babak},
|
| 58 |
+
journal={arXiv preprint arXiv:2509.16727},
|
| 59 |
+
year={2025}
|
| 60 |
+
}
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## License
|
| 64 |
+
|
| 65 |
+
MIT
|