Delete README.md
Browse files
README.md
DELETED
|
@@ -1,218 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: other
|
| 3 |
-
license_name: bria-rmbg-2.0
|
| 4 |
-
license_link: https://creativecommons.org/licenses/by-nc/4.0/deed.en
|
| 5 |
-
pipeline_tag: image-segmentation
|
| 6 |
-
tags:
|
| 7 |
-
- remove background
|
| 8 |
-
- background
|
| 9 |
-
- background-removal
|
| 10 |
-
- Pytorch
|
| 11 |
-
- vision
|
| 12 |
-
- legal liability
|
| 13 |
-
- transformers
|
| 14 |
-
- transformers.js
|
| 15 |
-
extra_gated_description: >-
|
| 16 |
-
Bria AI Model weights are open source for non commercial use only, per the
|
| 17 |
-
provided [license](https://creativecommons.org/licenses/by-nc/4.0/deed.en).
|
| 18 |
-
extra_gated_heading: Fill in this form to immediatly access the model for non commercial use
|
| 19 |
-
extra_gated_fields:
|
| 20 |
-
Name: text
|
| 21 |
-
Email: text
|
| 22 |
-
Company/Org name: text
|
| 23 |
-
Company Website URL: text
|
| 24 |
-
Discord user: text
|
| 25 |
-
I agree to BRIA’s Privacy policy, Terms & conditions, and acknowledge Non commercial use to be Personal use / Academy / Non profit (direct or indirect): checkbox
|
| 26 |
-
---
|
| 27 |
-
|
| 28 |
-
# BRIA Background Removal v2.0 Model Card
|
| 29 |
-
<p align="center"><img src="https://platform.bria.ai/assets/Bria-logo-5e0c53b1.svg" alt="BRIA Logo" width="200" /></p>
|
| 30 |
-
|
| 31 |
-
<!-- RMBG Card wrapper -->
|
| 32 |
-
<div class="rmbg-card" style="position: relative; border-radius: 12px; overflow: hidden;">
|
| 33 |
-
|
| 34 |
-
<!-- FIBO Promo Banner (Top) -->
|
| 35 |
-
<a
|
| 36 |
-
href="https://huggingface.co/briaai/FIBO"
|
| 37 |
-
target="_blank"
|
| 38 |
-
rel="noopener"
|
| 39 |
-
aria-label="Explore FIBO on Hugging Face"
|
| 40 |
-
style="
|
| 41 |
-
position: absolute;
|
| 42 |
-
top: 0;
|
| 43 |
-
left: 0;
|
| 44 |
-
width: 100%;
|
| 45 |
-
display: flex;
|
| 46 |
-
align-items: center;
|
| 47 |
-
justify-content: center;
|
| 48 |
-
gap: 10px;
|
| 49 |
-
background: linear-gradient(90deg, #fff6b7 0%, #fde047 100%);
|
| 50 |
-
color: #1f2937;
|
| 51 |
-
text-decoration: none;
|
| 52 |
-
font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
|
| 53 |
-
font-weight: 600;
|
| 54 |
-
font-size: 13px;
|
| 55 |
-
padding: 10px 0;
|
| 56 |
-
border-bottom: 1px solid rgba(0,0,0,0.08);
|
| 57 |
-
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
| 58 |
-
z-index: 10;
|
| 59 |
-
">
|
| 60 |
-
<img
|
| 61 |
-
src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg"
|
| 62 |
-
alt="Hugging Face"
|
| 63 |
-
width="18"
|
| 64 |
-
height="18"
|
| 65 |
-
style="display:block"
|
| 66 |
-
/>
|
| 67 |
-
<span>✨ Discover <strong>FIBO</strong> on Hugging Face</span>
|
| 68 |
-
</a>
|
| 69 |
-
|
| 70 |
-
<!-- ... your RMBG content below ... -->
|
| 71 |
-
<p align="center">
|
| 72 |
-
💜 <a href="https://go.bria.ai/46gzn20"><b>Bria AI</b></a>   |   🤗 <a href="https://huggingface.co/briaai/">Hugging Face</a>    |    📑 <a href="https://blog.bria.ai/">Blog</a>   
|
| 73 |
-
<br>
|
| 74 |
-
🖥️ <a href="https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0">Demo</a>  |    <a href="https://github.com/Bria-AI/RMBG-2.0">Github</a>  
|
| 75 |
-
</p>
|
| 76 |
-
|
| 77 |
-
RMBG v2.0 is our new state-of-the-art background removal model significantly improves RMBG v1.4. The model is designed to effectively separate foreground from background in a range of
|
| 78 |
-
categories and image types. This model has been trained on a carefully selected dataset, which includes:
|
| 79 |
-
general stock images, e-commerce, gaming, and advertising content, making it suitable for commercial use cases powering enterprise content creation at scale.
|
| 80 |
-
The accuracy, efficiency, and versatility currently rival leading source-available models.
|
| 81 |
-
It is ideal where content safety, legally licensed datasets, and bias mitigation are paramount.
|
| 82 |
-
|
| 83 |
-
Developed by BRIA AI, RMBG v2.0 is available as a source-available model for non-commercial use.
|
| 84 |
-
|
| 85 |
-
### Get Access
|
| 86 |
-
|
| 87 |
-
Bria RMBG2.0 is availabe everywhere you build, either as source-code and weights, ComfyUI nodes or API endpoints.
|
| 88 |
-
|
| 89 |
-
- **Purchase:** To purchase a commercial license for RMBG V2.0 **or** an API package [Click Here](https://share-eu1.hsforms.com/2sj9FVZTGSFmFRibDLhr_ZAf4e04).
|
| 90 |
-
- **API Endpoint**: [Bria.ai](https://docs.bria.ai/image-editing/v2-endpoints/background-remove), [fal.ai](https://fal.ai/models/fal-ai/bria/background/remove), [Replicate](https://replicate.com/bria/remove-background)
|
| 91 |
-
- **ComfyUI**: [Use it in workflows](https://github.com/Bria-AI/ComfyUI-BRIA-API)
|
| 92 |
-
- **GitHub**: [github.com/Bria-AI/RMBG-2.0](https://github.com/Bria-AI/RMBG-2.0)
|
| 93 |
-
|
| 94 |
-
For more information, please visit our [website](https://bria.ai/).
|
| 95 |
-
|
| 96 |
-
Join our [Discord community](https://discord.gg/Nxe9YW9zHS) for more information, tutorials, tools, and to connect with other users!
|
| 97 |
-
|
| 98 |
-
[CLICK HERE FOR A DEMO](https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0)
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-

|
| 103 |
-
|
| 104 |
-
## Model Details
|
| 105 |
-
#####
|
| 106 |
-
### Model Description
|
| 107 |
-
|
| 108 |
-
- **Developed by:** [BRIA AI](https://bria.ai/)
|
| 109 |
-
- **Model type:** Background Removal
|
| 110 |
-
- **License:** [Creative Commons Attribution–Non-Commercial (CC BY-NC 4.0)](https://creativecommons.org/licenses/by-nc/4.0/deed.en)
|
| 111 |
-
- The model is released under a CC BY-NC 4.0 license for non-commercial use.
|
| 112 |
-
- Commercial use is subject to a commercial agreement with BRIA. Available [here](https://share-eu1.hsforms.com/2sj9FVZTGSFmFRibDLhr_ZAf4e04)
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
- **Model Description:** BRIA RMBG-2.0 is a dichotomous image segmentation model trained exclusively on a professional-grade dataset. The model output includes a single-channel 8-bit grayscale alpha matte, where each pixel value indicates the opacity level of the corresponding pixel in the original image. This non-binary output approach offers developers the flexibility to define custom thresholds for foreground-background separation, catering to varied use cases requirements and enhancing integration into complex pipelines.
|
| 116 |
-
- **BRIA:** Resources for more information: [BRIA AI](https://bria.ai/)
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
## Training data
|
| 121 |
-
Bria-RMBG model was trained with over 15,000 high-quality, high-resolution, manually labeled (pixel-wise accuracy), fully licensed images.
|
| 122 |
-
Our benchmark included balanced gender, balanced ethnicity, and people with different types of disabilities.
|
| 123 |
-
For clarity, we provide our data distribution according to different categories, demonstrating our model’s versatility.
|
| 124 |
-
|
| 125 |
-
### Distribution of images:
|
| 126 |
-
|
| 127 |
-
| Category | Distribution |
|
| 128 |
-
| -----------------------------------| -----------------------------------:|
|
| 129 |
-
| Objects only | 45.11% |
|
| 130 |
-
| People with objects/animals | 25.24% |
|
| 131 |
-
| People only | 17.35% |
|
| 132 |
-
| people/objects/animals with text | 8.52% |
|
| 133 |
-
| Text only | 2.52% |
|
| 134 |
-
| Animals only | 1.89% |
|
| 135 |
-
|
| 136 |
-
| Category | Distribution |
|
| 137 |
-
| -----------------------------------| -----------------------------------------:|
|
| 138 |
-
| Photorealistic | 87.70% |
|
| 139 |
-
| Non-Photorealistic | 12.30% |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
| Category | Distribution |
|
| 143 |
-
| -----------------------------------| -----------------------------------:|
|
| 144 |
-
| Non Solid Background | 52.05% |
|
| 145 |
-
| Solid Background | 47.95%
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
| Category | Distribution |
|
| 149 |
-
| -----------------------------------| -----------------------------------:|
|
| 150 |
-
| Single main foreground object | 51.42% |
|
| 151 |
-
| Multiple objects in the foreground | 48.58% |
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
## Qualitative Evaluation
|
| 155 |
-
Open source models comparison
|
| 156 |
-

|
| 157 |
-

|
| 158 |
-
|
| 159 |
-
### Architecture
|
| 160 |
-
RMBG-2.0 is developed on the [BiRefNet](https://github.com/ZhengPeng7/BiRefNet) architecture enhanced with our proprietary dataset and training scheme. This training data significantly improves the model’s accuracy and effectiveness for background-removal task.<br>
|
| 161 |
-
If you use this model in your research, please cite:
|
| 162 |
-
|
| 163 |
-
```
|
| 164 |
-
@article{BiRefNet,
|
| 165 |
-
title={Bilateral Reference for High-Resolution Dichotomous Image Segmentation},
|
| 166 |
-
author={Zheng, Peng and Gao, Dehong and Fan, Deng-Ping and Liu, Li and Laaksonen, Jorma and Ouyang, Wanli and Sebe, Nicu},
|
| 167 |
-
journal={CAAI Artificial Intelligence Research},
|
| 168 |
-
year={2024}
|
| 169 |
-
}
|
| 170 |
-
```
|
| 171 |
-
|
| 172 |
-
#### Requirements
|
| 173 |
-
```bash
|
| 174 |
-
torch
|
| 175 |
-
torchvision
|
| 176 |
-
pillow
|
| 177 |
-
kornia
|
| 178 |
-
transformers
|
| 179 |
-
```
|
| 180 |
-
|
| 181 |
-
### Usage
|
| 182 |
-
|
| 183 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
```python
|
| 187 |
-
from PIL import Image
|
| 188 |
-
import torch
|
| 189 |
-
from torchvision import transforms
|
| 190 |
-
from transformers import AutoModelForImageSegmentation
|
| 191 |
-
|
| 192 |
-
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 193 |
-
model = AutoModelForImageSegmentation.from_pretrained('briaai/RMBG-2.0', trust_remote_code=True).eval().to(device)
|
| 194 |
-
|
| 195 |
-
# Data settings
|
| 196 |
-
image_size = (1024, 1024)
|
| 197 |
-
transform_image = transforms.Compose([
|
| 198 |
-
transforms.Resize(image_size),
|
| 199 |
-
transforms.ToTensor(),
|
| 200 |
-
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
|
| 201 |
-
])
|
| 202 |
-
|
| 203 |
-
image = Image.open(input_image_path)
|
| 204 |
-
input_images = transform_image(image).unsqueeze(0).to(device)
|
| 205 |
-
|
| 206 |
-
# Prediction
|
| 207 |
-
with torch.no_grad():
|
| 208 |
-
preds = model(input_images)[-1].sigmoid().cpu()
|
| 209 |
-
pred = preds[0].squeeze()
|
| 210 |
-
pred_pil = transforms.ToPILImage()(pred)
|
| 211 |
-
mask = pred_pil.resize(image.size)
|
| 212 |
-
image.putalpha(mask)
|
| 213 |
-
|
| 214 |
-
image.save("no_bg_image.png")
|
| 215 |
-
```
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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