Max Meyer commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,65 +2,54 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
|
| 5 |
-
|
| 6 |
# BEN - Background Erase Network
|
| 7 |
|
| 8 |
BEN is a deep learning model designed to automatically remove backgrounds from images, producing both a mask and a foreground image.
|
| 9 |
|
| 10 |
-
|
| 11 |
# BEN SOA Benchmarks on Disk 5k Eval
|
| 12 |
|
| 13 |
-
BEN_Base + BEN_Refiner (
|
| 14 |
-
MAE
|
| 15 |
-
DICE
|
| 16 |
-
IOU
|
| 17 |
-
BER
|
| 18 |
-
ACC
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
ACC-0.9660 \n
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
## Features
|
| 40 |
-
|
| 41 |
- Background removal from images
|
| 42 |
- Generates both binary mask and foreground image
|
| 43 |
- CUDA support for GPU acceleration
|
| 44 |
- Simple API for easy integration
|
| 45 |
|
| 46 |
## Installation
|
| 47 |
-
|
| 48 |
-
|
| 49 |
|
| 50 |
## Quick Start Code
|
|
|
|
| 51 |
from BEN import BEN_Base
|
| 52 |
from PIL import Image
|
| 53 |
import torch
|
| 54 |
|
| 55 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 56 |
-
|
| 57 |
-
|
| 58 |
model = BEN_Base().to(device).eval()
|
| 59 |
model.loadcheckpoints("./BEN/BEN_Base.pth")
|
| 60 |
|
| 61 |
image = Image.open("./image2.jpg")
|
| 62 |
mask, foreground = model.inference(image)
|
| 63 |
-
|
| 64 |
mask.save("./mask.png")
|
| 65 |
-
foreground.save("./foreground.png")
|
| 66 |
-
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
|
|
|
|
| 5 |
# BEN - Background Erase Network
|
| 6 |
|
| 7 |
BEN is a deep learning model designed to automatically remove backgrounds from images, producing both a mask and a foreground image.
|
| 8 |
|
|
|
|
| 9 |
# BEN SOA Benchmarks on Disk 5k Eval
|
| 10 |
|
| 11 |
+
### BEN_Base + BEN_Refiner (commercial model please contact us for more information):
|
| 12 |
+
- MAE: 0.0283
|
| 13 |
+
- DICE: 0.8976
|
| 14 |
+
- IOU: 0.8430
|
| 15 |
+
- BER: 0.0542
|
| 16 |
+
- ACC: 0.9725
|
| 17 |
+
|
| 18 |
+
### BEN_Base:
|
| 19 |
+
- MAE: 0.0331
|
| 20 |
+
- DICE: 0.8743
|
| 21 |
+
- IOU: 0.8301
|
| 22 |
+
- BER: 0.0560
|
| 23 |
+
- ACC: 0.9700
|
| 24 |
+
|
| 25 |
+
### MVANet (old SOA):
|
| 26 |
+
- MAE: 0.0353
|
| 27 |
+
- DICE: 0.8676
|
| 28 |
+
- IOU: 0.8104
|
| 29 |
+
- BER: 0.0639
|
| 30 |
+
- ACC: 0.9660
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
## Features
|
|
|
|
| 33 |
- Background removal from images
|
| 34 |
- Generates both binary mask and foreground image
|
| 35 |
- CUDA support for GPU acceleration
|
| 36 |
- Simple API for easy integration
|
| 37 |
|
| 38 |
## Installation
|
| 39 |
+
1. Clone Repo
|
| 40 |
+
2. Install requirements.txt
|
| 41 |
|
| 42 |
## Quick Start Code
|
| 43 |
+
```python
|
| 44 |
from BEN import BEN_Base
|
| 45 |
from PIL import Image
|
| 46 |
import torch
|
| 47 |
|
| 48 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
|
|
|
|
| 49 |
model = BEN_Base().to(device).eval()
|
| 50 |
model.loadcheckpoints("./BEN/BEN_Base.pth")
|
| 51 |
|
| 52 |
image = Image.open("./image2.jpg")
|
| 53 |
mask, foreground = model.inference(image)
|
|
|
|
| 54 |
mask.save("./mask.png")
|
| 55 |
+
foreground.save("./foreground.png")
|
|
|