Image Segmentation
Transformers
Safetensors
English
layer decomposition
image segmentation
image matting
design
custom_code
Instructions to use cyberagent/layerd-birefnet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cyberagent/layerd-birefnet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="cyberagent/layerd-birefnet", trust_remote_code=True)# Load model directly from transformers import AutoModelForImageSegmentation model = AutoModelForImageSegmentation.from_pretrained("cyberagent/layerd-birefnet", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Adapt for layerd: Change hardcoded size from 1024 to 512 (line 56) and add trained weights
Browse files- birefnet.py +1 -1
- model.safetensors +3 -0
birefnet.py
CHANGED
|
@@ -53,7 +53,7 @@ class Config(PretrainedConfig):
|
|
| 53 |
}[self.task]
|
| 54 |
][1] # choose 0 to skip
|
| 55 |
self.lr = (1e-4 if 'DIS5K' in self.task else 1e-5) * math.sqrt(self.batch_size / 4) # DIS needs high lr to converge faster. Adapt the lr linearly
|
| 56 |
-
self.size =
|
| 57 |
self.num_workers = max(4, self.batch_size) # will be decrease to min(it, batch_size) at the initialization of the data_loader
|
| 58 |
|
| 59 |
# Backbone settings
|
|
|
|
| 53 |
}[self.task]
|
| 54 |
][1] # choose 0 to skip
|
| 55 |
self.lr = (1e-4 if 'DIS5K' in self.task else 1e-5) * math.sqrt(self.batch_size / 4) # DIS needs high lr to converge faster. Adapt the lr linearly
|
| 56 |
+
self.size = 512
|
| 57 |
self.num_workers = max(4, self.batch_size) # will be decrease to min(it, batch_size) at the initialization of the data_loader
|
| 58 |
|
| 59 |
# Backbone settings
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:28416acdaedc3fbee0f80f888893a2fdca60ae81b1b27a41433a4e791598e330
|
| 3 |
+
size 884878824
|