Image Segmentation
BiRefNet
Safetensors
background-removal
mask-generation
Dichotomous Image Segmentation
Camouflaged Object Detection
Salient Object Detection
pytorch_model_hub_mixin
model_hub_mixin
custom_code
Instructions to use ZhengPeng7/BiRefNet_512x512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BiRefNet
How to use ZhengPeng7/BiRefNet_512x512 with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet_512x512", trust_remote_code=True)# Option 2: use with BiRefNet # Install from https://github.com/ZhengPeng7/BiRefNet from models.birefnet import BiRefNet model = BiRefNet.from_pretrained("ZhengPeng7/BiRefNet_512x512") - Notebooks
- Google Colab
- Kaggle
Commit ·
2b23729
1
Parent(s): 0cc6614
Fix the bug by latest transformers and update req.txt.
Browse files- birefnet.py +2 -1
- requirements.txt +1 -1
birefnet.py
CHANGED
|
@@ -2,9 +2,10 @@
|
|
| 2 |
|
| 3 |
import os
|
| 4 |
import math
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
-
class Config():
|
| 8 |
def __init__(self) -> None:
|
| 9 |
# PATH settings
|
| 10 |
self.sys_home_dir = os.path.expanduser('~') # Make up your file system as: SYS_HOME_DIR/codes/dis/BiRefNet, SYS_HOME_DIR/datasets/dis/xx, SYS_HOME_DIR/weights/xx
|
|
|
|
| 2 |
|
| 3 |
import os
|
| 4 |
import math
|
| 5 |
+
from transformers import PretrainedConfig
|
| 6 |
|
| 7 |
|
| 8 |
+
class Config(PretrainedConfig):
|
| 9 |
def __init__(self) -> None:
|
| 10 |
# PATH settings
|
| 11 |
self.sys_home_dir = os.path.expanduser('~') # Make up your file system as: SYS_HOME_DIR/codes/dis/BiRefNet, SYS_HOME_DIR/datasets/dis/xx, SYS_HOME_DIR/weights/xx
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
torch==2.5.1
|
| 2 |
-
torchvision
|
| 3 |
numpy<2
|
| 4 |
opencv-python
|
| 5 |
timm
|
|
|
|
| 1 |
torch==2.5.1
|
| 2 |
+
torchvision
|
| 3 |
numpy<2
|
| 4 |
opencv-python
|
| 5 |
timm
|