Instructions to use facebook/sapiens2-matting-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sapiens
How to use facebook/sapiens2-matting-1b with sapiens:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- sapiens2
How to use facebook/sapiens2-matting-1b with sapiens2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add Sapiens2-1B matting model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: sapiens2-license
|
| 4 |
+
license_link: https://github.com/facebookresearch/sapiens2/blob/main/LICENSE.md
|
| 5 |
+
pipeline_tag: image-segmentation
|
| 6 |
+
library_name: sapiens
|
| 7 |
+
base_model: facebook/sapiens2-pretrain-1b
|
| 8 |
+
tags:
|
| 9 |
+
- sapiens
|
| 10 |
+
- sapiens2
|
| 11 |
+
- human-centric
|
| 12 |
+
- matting
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Sapiens2-1B-Matting
|
| 16 |
+
|
| 17 |
+
Per-pixel human image matting with a soft alpha matte and pre-multiplied
|
| 18 |
+
foreground RGB output.
|
| 19 |
+
|
| 20 |
+
This repository contains the **1B Human Matting** checkpoint, finetuned from the
|
| 21 |
+
[Sapiens2-1B pretrained backbone](https://huggingface.co/facebook/sapiens2-pretrain-1b).
|
| 22 |
+
|
| 23 |
+
- 📄 **Paper:** [arXiv:2604.21681](https://arxiv.org/pdf/2604.21681)
|
| 24 |
+
- 🌐 **Project Page:** [rawalkhirodkar.github.io/sapiens2](https://rawalkhirodkar.github.io/sapiens2)
|
| 25 |
+
- 💻 **Code:** [github.com/facebookresearch/sapiens2](https://github.com/facebookresearch/sapiens2)
|
| 26 |
+
|
| 27 |
+
## Model Details
|
| 28 |
+
|
| 29 |
+
- **Developed by:** Meta
|
| 30 |
+
- **Model type:** Vision Transformer
|
| 31 |
+
- **License:** [Sapiens2 License](https://github.com/facebookresearch/sapiens2/blob/main/LICENSE.md)
|
| 32 |
+
- **Task:** Human image matting
|
| 33 |
+
- **Base model:** [facebook/sapiens2-pretrain-1b](https://huggingface.co/facebook/sapiens2-pretrain-1b)
|
| 34 |
+
- **Format:** safetensors
|
| 35 |
+
- **File:** `sapiens2_1b_matting.safetensors`
|
| 36 |
+
|
| 37 |
+
## Quick Start
|
| 38 |
+
|
| 39 |
+
Install the [Sapiens2 repo](https://github.com/facebookresearch/sapiens2) (`pip install -e .`), download the checkpoint, and run the demo:
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
# 1. Download the checkpoint to $SAPIENS_CHECKPOINT_ROOT/matting/
|
| 43 |
+
hf download facebook/sapiens2-matting-1b sapiens2_1b_matting.safetensors \
|
| 44 |
+
--local-dir ~/sapiens2_host/matting
|
| 45 |
+
|
| 46 |
+
# 2. Run the demo (edit INPUT, OUTPUT, and MODEL_NAME inside the script)
|
| 47 |
+
cd $SAPIENS_ROOT/sapiens/dense
|
| 48 |
+
./scripts/demo/matting.sh
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
See the [Human Matting guide](https://github.com/facebookresearch/sapiens2/blob/main/docs/MATTING.md) for details on inputs, outputs, and visualization options.
|
| 52 |
+
|
| 53 |
+
## Model Card
|
| 54 |
+
|
| 55 |
+
| Field | Value |
|
| 56 |
+
|-------|-------|
|
| 57 |
+
| Architecture | Sapiens2 ViT backbone + Human Matting head |
|
| 58 |
+
| Backbone parameters | 1.462 B |
|
| 59 |
+
| Backbone FLOPs | 4.715 T |
|
| 60 |
+
| Embedding dim | 1536 |
|
| 61 |
+
| Layers | 40 |
|
| 62 |
+
| Attention heads | 24 |
|
| 63 |
+
| Inference resolution | 1024 × 768 (H × W) |
|
| 64 |
+
| Patch size | 16 |
|
| 65 |
+
|
| 66 |
+
### Sapiens2-Matting Family
|
| 67 |
+
|
| 68 |
+
| Model | Params | FLOPs | Embed dim | Layers | Heads |
|
| 69 |
+
|-------|--------|-------|-----------|--------|-------|
|
| 70 |
+
| **Sapiens2-1B** *(this)* | 1.462 B | 4.715 T | 1536 | 40 | 24 |
|
| 71 |
+
|
| 72 |
+
See the [Sapiens2 Collection](https://huggingface.co/collections/facebook/sapiens2) for all variants and other downstream task checkpoints.
|
| 73 |
+
|
| 74 |
+
## Intended Use
|
| 75 |
+
|
| 76 |
+
- Human image matting on human-centric imagery
|
| 77 |
+
- Research on human-centric vision
|
| 78 |
+
|
| 79 |
+
## License
|
| 80 |
+
|
| 81 |
+
Released under the [Sapiens2 License](https://github.com/facebookresearch/sapiens2/blob/main/LICENSE.md).
|
| 82 |
+
|
| 83 |
+
## Citation
|
| 84 |
+
|
| 85 |
+
```bibtex
|
| 86 |
+
@article{khirodkarsapiens2,
|
| 87 |
+
title={Sapiens2},
|
| 88 |
+
author={Khirodkar, Rawal and Wen, He and Martinez, Julieta and Dong, Yuan and Su, Zhaoen and Saito, Shunsuke},
|
| 89 |
+
journal={arXiv preprint arXiv:2604.21681},
|
| 90 |
+
year={2026}
|
| 91 |
+
}
|
| 92 |
+
```
|