OriLib commited on
Commit
959dda5
1 Parent(s): 2fa7a34

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +258 -5
README.md CHANGED
@@ -1,5 +1,258 @@
1
- ---
2
- license: other
3
- license_name: bria-rmbg-1.4
4
- license_link: https://bria.ai/bria-huggingface-model-license-agreement/
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: bria-rmbg-1.4
4
+ license_link: https://bria.ai/bria-huggingface-model-license-agreement/
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
+ ---
15
+
16
+ # BRIA Background Removal v2.0 Model Card
17
+
18
+ RMBG v2.0 is our new state-of-the-art background removal model, designed to effectively separate foreground from background in a range of
19
+ categories and image types. This model has been trained on a carefully selected dataset, which includes:
20
+ general stock images, e-commerce, gaming, and advertising content, making it suitable for commercial use cases powering enterprise content creation at scale.
21
+ The accuracy, efficiency, and versatility currently rival leading source-available models.
22
+ It is ideal where content safety, legally licensed datasets, and bias mitigation are paramount.
23
+
24
+ Developed by BRIA AI, RMBG v2.0 is available as a source-available model for non-commercial use.
25
+
26
+ [CLICK HERE FOR A DEMO](https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0)
27
+ ![examples](t4.png)
28
+
29
+ ## Model Details
30
+
31
+ ### Model Description
32
+
33
+ <!-- Provide a longer summary of what this model is. -->
34
+
35
+
36
+
37
+ - **Developed by:** [BRIA AI](https://bria.ai/)
38
+ - **Funded by [optional]:** [More Information Needed]
39
+ - **Shared by [optional]:** [More Information Needed]
40
+ - **Model type:** Background Removal
41
+ - **Language(s) (NLP):** [More Information Needed]
42
+ - **License:** [More Information Needed]
43
+ - **Finetuned from model [optional]:** [More Information Needed]
44
+
45
+ ### Model Sources [optional]
46
+
47
+ <!-- Provide the basic links for the model. -->
48
+
49
+ - **Repository:** [More Information Needed]
50
+ - **Paper [optional]:** [More Information Needed]
51
+ - **Demo [optional]:** [More Information Needed]
52
+
53
+ ## Uses
54
+
55
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
56
+
57
+ ### Direct Use
58
+
59
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
60
+
61
+ ```python
62
+ # Imports
63
+ from PIL import Image
64
+ import matplotlib.pyplot as plt
65
+ import torch
66
+ from torchvision import transforms
67
+ from models.birefnet import BiRefNet
68
+
69
+ birefnet = BiRefNet.from_pretrained('ZhengPeng7/BiRefNet')
70
+ torch.set_float32_matmul_precision(['high', 'highest'][0])
71
+ birefnet.to('cuda')
72
+ birefnet.eval()
73
+
74
+ def extract_object(birefnet, imagepath):
75
+ # Data settings
76
+ image_size = (1024, 1024)
77
+ transform_image = transforms.Compose([
78
+ transforms.Resize(image_size),
79
+ transforms.ToTensor(),
80
+ transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
81
+ ])
82
+
83
+ image = Image.open(imagepath)
84
+ input_images = transform_image(image).unsqueeze(0).to('cuda')
85
+
86
+ # Prediction
87
+ with torch.no_grad():
88
+ preds = birefnet(input_images)[-1].sigmoid().cpu()
89
+ pred = preds[0].squeeze()
90
+ pred_pil = transforms.ToPILImage()(pred)
91
+ mask = pred_pil.resize(image.size)
92
+ image.putalpha(mask)
93
+ return image, mask
94
+
95
+ # Visualization
96
+ plt.axis("off")
97
+ plt.imshow(extract_object(birefnet, imagepath='PATH-TO-YOUR_IMAGE.jpg')[0])
98
+ plt.show()
99
+
100
+ ```
101
+
102
+
103
+ [More Information Needed]
104
+
105
+ ### Downstream Use [optional]
106
+
107
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
108
+
109
+ [More Information Needed]
110
+
111
+ ### Out-of-Scope Use
112
+
113
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
114
+
115
+ [More Information Needed]
116
+
117
+ ## Bias, Risks, and Limitations
118
+
119
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
120
+
121
+ [More Information Needed]
122
+
123
+ ### Recommendations
124
+
125
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
126
+
127
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
128
+
129
+ ## How to Get Started with the Model
130
+
131
+ Use the code below to get started with the model.
132
+
133
+ [More Information Needed]
134
+
135
+ ## Training Details
136
+
137
+ ### Training Data
138
+
139
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
140
+
141
+ [More Information Needed]
142
+
143
+ ### Training Procedure
144
+
145
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
146
+
147
+ #### Preprocessing [optional]
148
+
149
+ [More Information Needed]
150
+
151
+
152
+ #### Training Hyperparameters
153
+
154
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
155
+
156
+ #### Speeds, Sizes, Times [optional]
157
+
158
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
159
+
160
+ [More Information Needed]
161
+
162
+ ## Evaluation
163
+
164
+ <!-- This section describes the evaluation protocols and provides the results. -->
165
+
166
+ ### Testing Data, Factors & Metrics
167
+
168
+ #### Testing Data
169
+
170
+ <!-- This should link to a Dataset Card if possible. -->
171
+
172
+ [More Information Needed]
173
+
174
+ #### Factors
175
+
176
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
177
+
178
+ [More Information Needed]
179
+
180
+ #### Metrics
181
+
182
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
183
+
184
+ [More Information Needed]
185
+
186
+ ### Results
187
+
188
+ [More Information Needed]
189
+
190
+ #### Summary
191
+
192
+
193
+
194
+ ## Model Examination [optional]
195
+
196
+ <!-- Relevant interpretability work for the model goes here -->
197
+
198
+ [More Information Needed]
199
+
200
+ ## Environmental Impact
201
+
202
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
203
+
204
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
205
+
206
+ - **Hardware Type:** [More Information Needed]
207
+ - **Hours used:** [More Information Needed]
208
+ - **Cloud Provider:** [More Information Needed]
209
+ - **Compute Region:** [More Information Needed]
210
+ - **Carbon Emitted:** [More Information Needed]
211
+
212
+ ## Technical Specifications [optional]
213
+
214
+ ### Model Architecture and Objective
215
+
216
+ [More Information Needed]
217
+
218
+ ### Compute Infrastructure
219
+
220
+ [More Information Needed]
221
+
222
+ #### Hardware
223
+
224
+ [More Information Needed]
225
+
226
+ #### Software
227
+
228
+ [More Information Needed]
229
+
230
+ ## Citation [optional]
231
+
232
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
233
+
234
+ **BibTeX:**
235
+
236
+ [More Information Needed]
237
+
238
+ **APA:**
239
+
240
+ [More Information Needed]
241
+
242
+ ## Glossary [optional]
243
+
244
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
245
+
246
+ [More Information Needed]
247
+
248
+ ## More Information [optional]
249
+
250
+ [More Information Needed]
251
+
252
+ ## Model Card Authors [optional]
253
+
254
+ [More Information Needed]
255
+
256
+ ## Model Card Contact
257
+
258
+ [More Information Needed]