File size: 9,310 Bytes
5a8def1 8fcb663 5a8def1 8fcb663 7b3e49e 8fcb663 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | ---
license: mit
pipeline_tag: image-segmentation
library_name: pytorch
tags:
- ben3
- background-removal
- video-background-removal
- image-segmentation
- dichotomous-image-segmentation
- foreground-segmentation
- mask-generation
- multi-hypothesis
- dinov3
- pytorch
- pytorch_model_hub_mixin
---
# BEN3: Background Erase Network
[](https://arxiv.org/abs/2611.38399)
[](https://github.com/PramaLLC/BEN3/)
[](https://backgrounderase.com/)
[](https://backgrounderase.com/docs)
[](https://huggingface.co/spaces/PramaLLC/BEN3)
BEN3 (Background Erase Network) is our next-generation image and video background removal model, developed by BackgroundErase / Prama LLC.
Built on multi-hypothesis segmentation and a DINOv3 visual encoder, BEN3 is designed for high-quality foreground segmentation, fine-detail preservation, and efficient image and video processing. It supports single-image inference, batched image processing, transparent video generation, and background replacement.
## Image Background Removal Demo
<p align="center">
<img src="assets/BEN3-sheet-2.jpeg" width="50%" alt="BEN3 Image Background Removal Results">
</p>
Try the full BEN3 model directly at [backgrounderase.com](https://backgrounderase.com/).
## Video Background Removal Demo
BEN3 supports transparent video output and background replacement.
<p align="center">
<a href="https://www.youtube.com/watch?v=zXS0MacHUfs">
<img src="https://img.youtube.com/vi/zXS0MacHUfs/maxresdefault.jpg" width="65%" alt="BEN3 Video Background Removal Demo">
</a>
</p>
*Click the image above to watch BEN3 in action.*
## Model Access
BEN3 is available in two versions:
### BEN3 β Open Model
This repository contains the BEN3 multi-hypothesis generator, including the model weights, inference code, and support for image and video background removal.
### BEN3 β Full Commercial Model
Our full commercial model incorporates the proprietary multi-hypothesis fusion network, delivering enhanced segmentation quality, boundary refinement, and fine-detail preservation.
The full model is available through:
- **Web Demo:** Try BEN3 directly at [backgrounderase.com](https://backgrounderase.com/).
- **API:** Integrate the full BEN3 model into your applications and production workflows. See the [API documentation](https://backgrounderase.com/docs).
- **On-Device Licensing:** Deploy the full model within your own infrastructure or applications.
- **Enterprise API Access:** Custom pricing, high-volume processing, and enterprise-level integration.
For on-device licensing, self-hosted deployments, or enterprise API access, contact [sales@backgrounderase.com](mailto:sales@backgrounderase.com).
The fusion network is not included in the public release.
## Quick Start
### From the GitHub Python package
```bash
pip install git+https://github.com/PramaLLC/BEN3.git
```
Then load the model directly from this Hugging Face repository:
```python
from PIL import Image
from ben3 import BEN3
model = BEN3.from_pretrained(
"PramaLLC/BEN3",
device="cuda",
)
foreground, mask = model.inference(Image.open("input.jpg"))
foreground.save("foreground.png")
mask.save("mask.png")
```
### Directly from this repository
Clone/download the model repository, install `requirements.txt`, then:
```python
from PIL import Image
from ben3 import BEN3
model = BEN3("ben3.pth", device="cuda")
foreground, mask = model.inference(Image.open("input.jpg"))
foreground.save("foreground.png")
```
## Batched Image Inference
```python
images = [Image.open("a.jpg"), Image.open("b.jpg")]
foregrounds, masks = model.inference(images)
```
## Video Inference
### Transparent VP9 WebM
```python
model.segment_video(
"input.mp4",
output_path="foreground.webm",
batch=8,
webm=True,
add_audio=True,
)
```
### Solid-background MP4
```python
model.segment_video(
"input.mp4",
output_path="foreground.mp4",
batch=8,
rgb_value=(255, 255, 255),
)
```
`ffmpeg` and `ffprobe` must be installed for transparent WebM output and audio muxing.
## Research Benchmarks β MHFNet
Our multi-hypothesis fusion architecture, MHFNet, achieves leading performance on the DIS5K benchmark for dichotomous image segmentation.
On the 2,000-image DIS-TE benchmark, our multi-hypothesis fusion framework improves weighted F-measure from 0.8915 to 0.9054 and reduces mean absolute error from 0.0277 to 0.0255 compared to single-hypothesis selection from the same retrained generator.
**These results correspond to the MHFNet research framework, not the standalone BEN3 generator released in this repository.**
### DIS-TE1β4 (2,000 Test Images)
| Method | Weighted F β | Max F β | MAE β | S-measure β | Mean E-measure β |
|:-------|:------------:|:-------:|:-----:|:-----------:|:----------------:|
| IS-Net | 0.725 | 0.799 | 0.070 | 0.819 | 0.858 |
| InSPyReNet | 0.838 | 0.891 | 0.039 | 0.900 | 0.922 |
| BiRefNet | 0.858 | 0.900 | 0.035 | 0.901 | 0.934 |
| GenPercept | 0.856 | 0.875 | 0.036 | 0.885 | 0.939 |
| MVANet | 0.861 | 0.908 | 0.035 | 0.904 | 0.938 |
| DiffDIS | 0.892 | 0.911 | 0.027 | 0.905 | 0.951 |
| PDFNet-L | 0.876 | 0.915 | 0.030 | 0.916 | 0.944 |
| S3OD (Original) | 0.890 | 0.919 | 0.029 | 0.912 | 0.949 |
| S3OD (Retrained) | 0.892 | 0.920 | 0.028 | 0.919 | 0.948 |
| **MHFNet (Ours)** | **0.905** | **0.922** | **0.026** | **0.923** | **0.952** |
See the [MHFNet paper](https://arxiv.org/abs/2611.38399) for the complete evaluation.
## Architecture & Model Details
BEN3 is built on our research into multi-hypothesis segmentation, introduced in [MHFNet: Multi-Hypothesis Fusion Network for Dichotomous Image Segmentation](https://arxiv.org/abs/2611.38399) by Maxwell Meyer and Jack Spruyt β Prama LLC.
Unlike conventional segmentation models that produce a single foreground mask, BEN3 generates multiple candidate masks using a DINOv3 ViT-B/16 encoder and a DPT-style decoder. An auxiliary quality prediction head evaluates the candidate masks and selects the most promising prediction.
The full BEN3 pipeline introduces a second-stage fusion network that jointly processes the input image and multiple segmentation hypotheses to refine foreground boundaries and recover fine structures.
### Open Model Specifications
- **Task:** foreground/background segmentation and alpha-mask generation
- **Input:** RGB image(s)
- **Output:** foreground RGBA image(s) and 8-bit alpha mask(s)
- **Default inference size:** 1024Γ1024
- **Encoder:** DINOv3 ViT-B/16 architecture
- **Decoder:** DPT-style multi-scale feature fusion
- **Candidate masks:** 3
- **Mask selection:** learned auxiliary score head
- **Image inference:** single or batched
- **Video inference:** batched frame inference with transparent WebM or composited MP4 output
The full DINOv3 encoder state is expected inside `ben3.pth`. The included code instantiates the encoder architecture from configuration and does not separately download Meta's backbone weights.
## Training Data
BEN3 was trained on our proprietary dataset of approximately 38,000 images for high-quality foreground segmentation and background removal.
The training dataset is proprietary to Prama LLC and is not included in this release.
## Intended Use
BEN3 is designed for high-quality image and video background removal, foreground extraction, compositing, e-commerce imagery, creative applications, and related computer vision workflows.
## Acknowledgements
BEN3 builds upon the multi-hypothesis segmentation architecture introduced in [S3OD: Towards Generalizable Salient Object Detection with Synthetic Data](https://arxiv.org/abs/2510.21605).
We thank Orest Kupyn, Hirokatsu Kataoka, and Christian Rupprecht for their contributions to salient object detection and for making their research and implementation publicly available.
We also acknowledge the Meta AI research team for their work on [DINOv3](https://github.com/facebookresearch/dinov3), which serves as the visual encoder architecture for BEN3.
## Citation
If you find BEN3 or our multi-hypothesis fusion framework useful in your research or applications, please consider citing our work:
```bibtex
@misc{meyer2026mhfnetmultihypothesisfusionnetwork,
title={MHFNet: Multi-Hypothesis Fusion Network for Dichotomous Image Segmentation},
author={Maxwell Meyer and Jack Spruyt},
year={2026},
eprint={2611.38399},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2611.38399}
}
```
## License
The BEN3 implementation and publicly released hypothesis generator are released under the MIT License, subject to applicable third-party licensing terms.
## Contact
- **Website:** [backgrounderase.com](https://backgrounderase.com/)
- **Enterprise & Licensing:** [sales@backgrounderase.com](mailto:sales@backgrounderase.com)
- **GitHub:** [PramaLLC/BEN3](https://github.com/PramaLLC/BEN3/)
- **X:** [@PramaResearch](https://x.com/PramaResearch/) |