Update README.md
Browse files
README.md
CHANGED
|
@@ -40,7 +40,7 @@ BEN2 was trained on the DIS5k and our 22K proprietary segmentation dataset. Our
|
|
| 40 |
## Quick start code (inside cloned repo)
|
| 41 |
|
| 42 |
```python
|
| 43 |
-
import
|
| 44 |
from PIL import Image
|
| 45 |
import torch
|
| 46 |
|
|
@@ -49,7 +49,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
| 49 |
|
| 50 |
file = "./image.png" # input image
|
| 51 |
|
| 52 |
-
model =
|
| 53 |
|
| 54 |
model.loadcheckpoints("./BEN2_Base.pth")
|
| 55 |
image = Image.open(file)
|
|
@@ -63,7 +63,7 @@ foreground.save("./foreground.png")
|
|
| 63 |
## Batch image processing
|
| 64 |
|
| 65 |
```python
|
| 66 |
-
import
|
| 67 |
from PIL import Image
|
| 68 |
import torch
|
| 69 |
|
|
@@ -72,7 +72,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
-
model =
|
| 76 |
|
| 77 |
model.loadcheckpoints("./BEN2_Base.pth")
|
| 78 |
|
|
@@ -102,7 +102,7 @@ sudo apt install ffmpeg
|
|
| 102 |
```
|
| 103 |
|
| 104 |
```python
|
| 105 |
-
import
|
| 106 |
from PIL import Image
|
| 107 |
import torch
|
| 108 |
|
|
@@ -111,7 +111,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
| 111 |
|
| 112 |
file = "./image.png" # input image
|
| 113 |
|
| 114 |
-
model =
|
| 115 |
|
| 116 |
model.loadcheckpoints("./BEN2_Base.pth")
|
| 117 |
|
|
|
|
| 40 |
## Quick start code (inside cloned repo)
|
| 41 |
|
| 42 |
```python
|
| 43 |
+
import BEN2
|
| 44 |
from PIL import Image
|
| 45 |
import torch
|
| 46 |
|
|
|
|
| 49 |
|
| 50 |
file = "./image.png" # input image
|
| 51 |
|
| 52 |
+
model = BEN2.BEN_Base().to(device).eval() #init pipeline
|
| 53 |
|
| 54 |
model.loadcheckpoints("./BEN2_Base.pth")
|
| 55 |
image = Image.open(file)
|
|
|
|
| 63 |
## Batch image processing
|
| 64 |
|
| 65 |
```python
|
| 66 |
+
import BEN2
|
| 67 |
from PIL import Image
|
| 68 |
import torch
|
| 69 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
+
model = BEN2.BEN_Base().to(device).eval() #init pipeline
|
| 76 |
|
| 77 |
model.loadcheckpoints("./BEN2_Base.pth")
|
| 78 |
|
|
|
|
| 102 |
```
|
| 103 |
|
| 104 |
```python
|
| 105 |
+
import BEN2
|
| 106 |
from PIL import Image
|
| 107 |
import torch
|
| 108 |
|
|
|
|
| 111 |
|
| 112 |
file = "./image.png" # input image
|
| 113 |
|
| 114 |
+
model = BEN2.BEN_Base().to(device).eval() #init pipeline
|
| 115 |
|
| 116 |
model.loadcheckpoints("./BEN2_Base.pth")
|
| 117 |
|