|
Download README.md from PramaLLC/BEN3: direct link, hf CLI and curl.
- Browser
- Download file 9.31 kB
-
https://huggingface.co/PramaLLC/BEN3/resolve/main/README.md
- Command line
-
hf download hf://PramaLLC/BEN3/README.md
-
curl -L -o README.md https://huggingface.co/PramaLLC/BEN3/resolve/main/README.md
9.31 kB
| 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/) |