Update README.md
Browse files
README.md
CHANGED
|
@@ -124,6 +124,10 @@ pillow_image = pipe(image_path) # applies mask on input and returns a pillow ima
|
|
| 124 |
|
| 125 |
Or load the model
|
| 126 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
from transformers import AutoModelForImageSegmentation
|
| 128 |
from torchvision.transforms.functional import normalize
|
| 129 |
model = AutoModelForImageSegmentation.from_pretrained("briaai/RMBG-1.4",trust_remote_code=True)
|
|
@@ -153,6 +157,7 @@ model.to(device)
|
|
| 153 |
image_path = "https://farm5.staticflickr.com/4007/4322154488_997e69e4cf_z.jpg"
|
| 154 |
orig_im = io.imread(image_path)
|
| 155 |
orig_im_size = orig_im.shape[0:2]
|
|
|
|
| 156 |
image = preprocess_image(orig_im, model_input_size).to(device)
|
| 157 |
|
| 158 |
# inference
|
|
|
|
| 124 |
|
| 125 |
Or load the model
|
| 126 |
```python
|
| 127 |
+
from PIL import Image
|
| 128 |
+
from skimage import io
|
| 129 |
+
import torch
|
| 130 |
+
import torch.nn.functional as F
|
| 131 |
from transformers import AutoModelForImageSegmentation
|
| 132 |
from torchvision.transforms.functional import normalize
|
| 133 |
model = AutoModelForImageSegmentation.from_pretrained("briaai/RMBG-1.4",trust_remote_code=True)
|
|
|
|
| 157 |
image_path = "https://farm5.staticflickr.com/4007/4322154488_997e69e4cf_z.jpg"
|
| 158 |
orig_im = io.imread(image_path)
|
| 159 |
orig_im_size = orig_im.shape[0:2]
|
| 160 |
+
model_input_size = [1024, 1024]
|
| 161 |
image = preprocess_image(orig_im, model_input_size).to(device)
|
| 162 |
|
| 163 |
# inference
|