Max Meyer
commited on
Commit
•
dc4f604
1
Parent(s):
3388311
Update README.md
Browse files
README.md
CHANGED
@@ -9,19 +9,26 @@ BEN is a deep learning model designed to automatically remove backgrounds from i
|
|
9 |
|
10 |
## Quick Start Code
|
11 |
```python
|
12 |
-
from BEN import
|
13 |
from PIL import Image
|
14 |
import torch
|
15 |
|
|
|
16 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
17 |
-
model = BEN_Base().to(device).eval()
|
18 |
-
model.loadcheckpoints("./BEN/BEN_Base.pth")
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
mask, foreground = model.inference(image)
|
|
|
22 |
mask.save("./mask.png")
|
23 |
foreground.save("./foreground.png")
|
24 |
|
|
|
|
|
25 |
```
|
26 |
# BEN SOA Benchmarks on Disk 5k Eval
|
27 |
|
|
|
9 |
|
10 |
## Quick Start Code
|
11 |
```python
|
12 |
+
from BEN import model
|
13 |
from PIL import Image
|
14 |
import torch
|
15 |
|
16 |
+
|
17 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
|
|
18 |
|
19 |
+
file = "./image2.jpg" # input image
|
20 |
+
|
21 |
+
model = model.BEN_Base().to(device).eval() #init pipeline
|
22 |
+
|
23 |
+
model.loadcheckpoints("./BEN/BEN_Base.pth")
|
24 |
+
image = Image.open(file)
|
25 |
mask, foreground = model.inference(image)
|
26 |
+
|
27 |
mask.save("./mask.png")
|
28 |
foreground.save("./foreground.png")
|
29 |
|
30 |
+
|
31 |
+
|
32 |
```
|
33 |
# BEN SOA Benchmarks on Disk 5k Eval
|
34 |
|