Wolo
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,48 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-4.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
---
|
4 |
+
|
5 |
+
# FSFM-3C Models (Pre-trained Vision Transformers)
|
6 |
+
|
7 |
+
A self-supervised pre-training framework to learn a transferable facial representation that boosts various face security tasks.
|
8 |
+
- **Paper:** [FSFM: A Generalizable Face Security Foundation Model via Self-Supervised Facial Representation Learning](https://arxiv.org/abs/2412.12032)
|
9 |
+
- **Repository:** [github](TODO)
|
10 |
+
- **Projeact:** [this https URL](https://fsfm-3c.github.io/)
|
11 |
+
|
12 |
+
## Environment
|
13 |
+
Git clone our repository, creating a python environment and activate it via the following command:
|
14 |
+
```bash
|
15 |
+
conda create -n fsfm3c python=3.9
|
16 |
+
conda activate fsfm3c
|
17 |
+
pip install -r requirements.txt
|
18 |
+
|
19 |
+
## Model Loading
|
20 |
+
```python
|
21 |
+
import models_vit
|
22 |
+
from huggingface_hub import hf_hub_download
|
23 |
+
CKPT_SAVE_PATH = [your checkpoint storage path]
|
24 |
+
CKPT_NAME = [checkpoint name]
|
25 |
+
hf_hub_download(local_dir=CKPT_SAVE_PATH,
|
26 |
+
repo_id='FSFM-3C/model_v1',
|
27 |
+
filename=CKPT_NAME)
|
28 |
+
model = models_vit.__dict__['vit_base_patch16'](
|
29 |
+
num_classes=2,
|
30 |
+
drop_path_rate=0.1,
|
31 |
+
global_pool=True,
|
32 |
+
)
|
33 |
+
checkpoint = torch.load(os.path.join(CKPT_SAVE_PATH, CKPT_NAME), map_location='cpu')
|
34 |
+
model.load_state_dict(checkpoint['model'])
|
35 |
+
```
|
36 |
+
|
37 |
+
## Downstream Use
|
38 |
+
Face security tasks such as deepfake detection, face anti-spoofing, and diffusion facial forgery detection.
|
39 |
+
|
40 |
+
## BibTeX entry and citation info
|
41 |
+
|
42 |
+
```bibtex
|
43 |
+
@article{wang2024fsfm,
|
44 |
+
title={FSFM: A Generalizable Face Security Foundation Model via Self-Supervised Facial Representation Learning},
|
45 |
+
author={Wang, Gaojian and Lin, Feng and Wu, Tong and Liu, Zhenguang and Ba, Zhongjie and Ren, Kui},
|
46 |
+
journal={arXiv preprint arXiv:2412.12032},
|
47 |
+
year={2024}
|
48 |
+
}
|