not-lain commited on
Commit
4900c61
·
verified ·
1 Parent(s): c1728f9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -9
README.md CHANGED
@@ -16,23 +16,38 @@ This model has been pushed to the Hub using the [PytorchModelHubMixin](https://h
16
 
17
  Library: [nobg](https://github.com/feyninc/nobg)
18
 
19
- ## how to load
20
  ```
21
  pip install nobg
22
  ```
23
 
24
- use the AutoModel class
25
  ```python
26
- from nobg import AutoModel
27
- model = AutoModel.from_pretrained("feyninc/FeyNobg")
28
- ```
29
- or you can use the model class directly
30
- ```python
31
- from nobg import BiRefNet
32
- model = BiRefNet.from_pretrained("feyninc/FeyNobg")
 
 
 
 
 
 
 
 
 
 
33
  ```
34
 
35
 
 
 
 
 
 
 
36
  ## Citation
37
  If you use this model, please cite:
38
  ```bibtex
 
16
 
17
  Library: [nobg](https://github.com/feyninc/nobg)
18
 
19
+ ## how to use the model
20
  ```
21
  pip install nobg
22
  ```
23
 
 
24
  ```python
25
+ import torch
26
+ from loadimg import load_img
27
+ from nobg import AutoModel, AutoProcessor
28
+
29
+ model = AutoModel.from_pretrained("feyninc/FeyNobg").eval()
30
+ processor = AutoProcessor.from_pretrained("feyninc/FeyNobg")
31
+
32
+ image = load_img("input.jpg").convert("RGB")
33
+ inputs = processor(image, return_tensors="pt")
34
+
35
+ with torch.no_grad():
36
+ outputs = model(pixel_values=inputs["pixel_values"])
37
+
38
+ alpha = processor.post_process_alpha_matting(
39
+ outputs, target_sizes=[(image.height, image.width)]
40
+ )[0]
41
+ processor.cutout(image, alpha).save("output.png")
42
  ```
43
 
44
 
45
+ ![image](https://cdn-uploads.huggingface.co/production/uploads/6527e89a8808d80ccff88b7a/2QIFDxrIJCLlXY87vOzH2.png)
46
+
47
+ ![image](https://cdn-uploads.huggingface.co/production/uploads/6527e89a8808d80ccff88b7a/W0rNUdiP56son6i33vHzY.png)
48
+
49
+ ![image](https://cdn-uploads.huggingface.co/production/uploads/6527e89a8808d80ccff88b7a/ohqZF89NGEm5LXrEOMLP0.png)
50
+
51
  ## Citation
52
  If you use this model, please cite:
53
  ```bibtex