Image Segmentation
BEN2
ONNX
Safetensors
PyTorch
BEN2
background-remove
mask-generation
Dichotomous image segmentation
background remove
foreground
background
remove background
model_hub_mixin
pytorch_model_hub_mixin
background removal
background-removal
Instructions to use PramaLLC/BEN2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BEN2
How to use PramaLLC/BEN2 with BEN2:
import requests from PIL import Image from ben2 import AutoModel url = "https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg" image = Image.open(requests.get(url, stream=True).raw) model = AutoModel.from_pretrained("PramaLLC/BEN2") model.to("cuda").eval() foreground = model.inference(image) - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -51,7 +51,7 @@ file = "./image.png" # input image
|
|
| 51 |
|
| 52 |
model = model.BEN_Base().to(device).eval() #init pipeline
|
| 53 |
|
| 54 |
-
model.loadcheckpoints("./
|
| 55 |
image = Image.open(file)
|
| 56 |
foreground = model.inference(image, refine_foreground=False,) #Refine foreground is an extract postprocessing step that increases inference time but can improve matting edges. The default value is False.
|
| 57 |
|
|
@@ -74,7 +74,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
| 74 |
|
| 75 |
model = model.BEN_Base().to(device).eval() #init pipeline
|
| 76 |
|
| 77 |
-
model.loadcheckpoints("./
|
| 78 |
|
| 79 |
file1 = "./image1.png" # input image1
|
| 80 |
file2 = "./image2.png" # input image2
|
|
@@ -113,7 +113,7 @@ file = "./image.png" # input image
|
|
| 113 |
|
| 114 |
model = model.BEN_Base().to(device).eval() #init pipeline
|
| 115 |
|
| 116 |
-
model.loadcheckpoints("./
|
| 117 |
|
| 118 |
|
| 119 |
|
|
|
|
| 51 |
|
| 52 |
model = model.BEN_Base().to(device).eval() #init pipeline
|
| 53 |
|
| 54 |
+
model.loadcheckpoints("./BEN2_Base.pth")
|
| 55 |
image = Image.open(file)
|
| 56 |
foreground = model.inference(image, refine_foreground=False,) #Refine foreground is an extract postprocessing step that increases inference time but can improve matting edges. The default value is False.
|
| 57 |
|
|
|
|
| 74 |
|
| 75 |
model = model.BEN_Base().to(device).eval() #init pipeline
|
| 76 |
|
| 77 |
+
model.loadcheckpoints("./BEN2_Base.pth")
|
| 78 |
|
| 79 |
file1 = "./image1.png" # input image1
|
| 80 |
file2 = "./image2.png" # input image2
|
|
|
|
| 113 |
|
| 114 |
model = model.BEN_Base().to(device).eval() #init pipeline
|
| 115 |
|
| 116 |
+
model.loadcheckpoints("./BEN2_Base.pth")
|
| 117 |
|
| 118 |
|
| 119 |
|