File size: 3,111 Bytes
f4ec5b0
 
eae2cda
 
 
 
 
 
 
 
 
9a20c93
 
f4ec5b0
 
9a20c93
f4ec5b0
9a20c93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e918d2d
1b7a018
 
e918d2d
7d1b6e1
c67afbd
a9521f8
7d1b6e1
a9521f8
7d1b6e1
 
 
dc4f604
7d1b6e1
 
bbb0aa9
dc4f604
a9521f8
dc4f604
a9521f8
dc4f604
4198990
dc4f604
7d1b6e1
 
3388311
a9521f8
 
f4ec5b0
610f43c
 
 
6b1c941
1c08bbb
 
 
 
 
6b1c941
29c887d
1c08bbb
 
 
 
 
6b1c941
066b9a1
6b1c941
 
 
 
 
f4ec5b0
b6aa22e
 
 
 
 
 
 
 
 
 
f4ec5b0
 
 
 
 
 
 
6b1c941
a9521f8
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
---
license: apache-2.0
pipeline_tag: image-segmentation
tags:
- BEN
- background-remove
- mask-generation
- Dichotomous image segmentation
- background remove
- foreground
- background
- remove background
- pytorch
---

# BEN: Background Erase Network

[![arXiv](https://img.shields.io/badge/arXiv-2501.06230-b31b1b.svg)](https://arxiv.org/abs/2501.06230)
[![GitHub](https://img.shields.io/badge/GitHub-BEN-black.svg)](https://github.com/PramaLLC/BEN/)
[![Website](https://img.shields.io/badge/Website-backgrounderase.net-104233)](https://backgrounderase.net)

## Overview
BEN (Background Erase Network) introduces a novel approach to foreground segmentation through its innovative Confidence Guided Matting (CGM) pipeline. The architecture employs a refiner network that targets and processes pixels where the base model exhibits lower confidence levels, resulting in more precise and reliable matting results.

This repository provides the official code for our model, as detailed in our research paper: [BEN: Background Erase Network](https://arxiv.org/abs/2501.06230).



## BEN2 Access
BEN2 is now publicly available, trained on DIS5k and our 22K proprietary segmentation dataset. Our enhanced model delivers superior performance in hair matting, 4K processing, object segmentation, and edge refinement. Access the base model on Huggingface, try the full model through our free web demo or integrate BEN2 into your project with our API:
- 🤗 [PramaLLC/BEN2](https://huggingface.co/PramaLLC/BEN2)
- 🌐 [backgrounderase.net](https://backgrounderase.net)

## Model Access
The base model is publicly available and free to use for commercial use on HuggingFace:
- 🤗 [PramaLLC/BEN](https://huggingface.co/PramaLLC/BEN)


## Contact US
- For access to our commercial model email us at [email protected]
- Our website: https://pramadevelopment.com/
- Follow us on X: https://x.com/PramaResearch/


## Quick Start Code (Inside Cloned Repo)

```python
import model
from PIL import Image
import torch


device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

file = "./image.png" # input image

model = model.BEN_Base().to(device).eval() #init pipeline

model.loadcheckpoints("./BEN_Base.pth")
image = Image.open(file)
mask, foreground = model.inference(image)

mask.save("./mask.png")
foreground.save("./foreground.png")
```

# BEN SOA Benchmarks on Disk 5k Eval

![Demo Results](demo.jpg)


### BEN_Base + BEN_Refiner (commercial model please contact us for more information):
- MAE: 0.0270
- DICE: 0.8989
- IOU: 0.8506
- BER: 0.0496
- ACC: 0.9740

### BEN_Base (94 million parameters):
- MAE: 0.0309
- DICE: 0.8806
- IOU: 0.8371
- BER: 0.0516
- ACC: 0.9718

### MVANet (old SOTA):
- MAE: 0.0353
- DICE: 0.8676
- IOU: 0.8104
- BER: 0.0639
- ACC: 0.9660


### BiRefNet(not tested in house):
- MAE: 0.038


### InSPyReNet (not tested in house):
- MAE: 0.042



## Features
- Background removal from images
- Generates both binary mask and foreground image
- CUDA support for GPU acceleration
- Simple API for easy integration

## Installation
1. Clone Repo
2. Install requirements.txt