Image Segmentation
BiRefNet
Safetensors
Transformers
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 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BiRefNet
How to use ZhengPeng7/BiRefNet with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet", 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") - Transformers
How to use ZhengPeng7/BiRefNet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="ZhengPeng7/BiRefNet", trust_remote_code=True)# Load model directly from transformers import AutoModelForImageSegmentation model = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
请问是否可以指定对象抠图?
#16
by jab0688 - opened
BiRefNet是目前我见过最好的抠图模型,效果非常棒!只是有个问题想请教:如果图中有多个对象、人物,是否可以通过提示词指定对象进行抠图?
目前是没有像SAM那种有learning方式感知prompt的.
但是可以用一些比较简陋的方式勉强能做, 就是把那个目标区域crop出来, 这样只有一个显著主体.
这个之前有讨论过, 可以参考issue: https://github.com/ZhengPeng7/BiRefNet/issues/152.
非常感谢您的回复!我按您给的参考研究下,不过我是个技术小白,估计很难实现。
可能可以加个目标监测,自动画框之后你选一下要哪个主体再传给这个去背景模型。说起来简单,但实现还是有点复杂的,不过和AI说一下就好了
我有一个疑惑:当我在使用BiRefNet的时候,后面连接Redux模型应用(高级版),就会报错:Sizes of tensors must match except in dimension 1. Expected size 2048 but got size 4096 for tensor number 1 in the list.这让我很困扰
这个不太清楚, 可能是redux插件那里可能应用的代码里有问题? 如果有相关代码链接, 可以放在这里, 我有时间可以看看