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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForImageSegmentation model = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Request for license clarification
Hello,
We are considering ZhengPeng7/BiRefNet for use in a commercial service. The model would run only on our server, and users would receive only the output images.
The model card indicates MIT, and we found an MIT license in the linked GitHub repository. Could you please clarify whether the Hugging Face model weights are also covered by the MIT License?
If so, could you please share the required copyright notice and consider adding a LICENSE or NOTICE file to this repository that explicitly covers the model weights?
Thank you for your help.
You can find the license I set in the model card of each HF model.
Hi , and thanks for BiRefNet!, I wanted to follow up on this thread because my use is commercial and it is regarding the model weights. I checked the model card as mentioned above and need some clarifications regarding license.
The model card says MIT. Can you confirm that covers the released weights of this checkpoint,The card says it's trained on DIS-TR. The DIS5K terms restrict commercial use of the dataset itself. Is the model fine to use commercial purpose.
Thank you so much..
Yeah, quite a lot of people asked me about it. Let me just paste one of my email responses here for your reference:
You can refer to the related issues in the BiRefNet GitHub repo. I also discussed with claude for quite a lot on this question.
In 3 short sentences: using backbones pretrained on ImageNet is not even 100% fine, since it claims not to be used for commercial use. There are also legal cases that said only the models can recover the original images would conflict with the claim of the dataset authors. Almost all existing open-source models might conflict with this rule in the worst-case scenario.
From my perspective, you can surely use it anyway under the MIT license.
But if you want to be 100% sure, you can also ask about the datasets used for training there, as I listed in the model zoo section in the README.