Update README.md
Browse files
README.md
CHANGED
|
@@ -6,8 +6,12 @@ license: mit
|
|
| 6 |
|
| 7 |
## VitMatte
|
| 8 |
The demo files are [here](https://github.com/hustvl/ViTMatte/tree/main/demo)
|
|
|
|
|
|
|
|
|
|
| 9 |
```python
|
| 10 |
import torch
|
|
|
|
| 11 |
|
| 12 |
image = Image.open("./retriever_rgb.png").convert("RGB")
|
| 13 |
image = F.to_tensor(image).unsqueeze(0).to("cuda").half()
|
|
@@ -22,4 +26,6 @@ alpha = model(input)
|
|
| 22 |
|
| 23 |
output = F.to_pil_image(predictions)
|
| 24 |
output.save("./predicted.png")
|
| 25 |
-
```
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
## VitMatte
|
| 8 |
The demo files are [here](https://github.com/hustvl/ViTMatte/tree/main/demo)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
```python
|
| 13 |
import torch
|
| 14 |
+
from torchvision.transforms import functional as F
|
| 15 |
|
| 16 |
image = Image.open("./retriever_rgb.png").convert("RGB")
|
| 17 |
image = F.to_tensor(image).unsqueeze(0).to("cuda").half()
|
|
|
|
| 26 |
|
| 27 |
output = F.to_pil_image(predictions)
|
| 28 |
output.save("./predicted.png")
|
| 29 |
+
```
|
| 30 |
+
This is the output:
|
| 31 |
+
<img width=400 src="https://cdn-uploads.huggingface.co/production/uploads/62ff65702979d8fc339b0905/2LdOFka5RXucDCWzzVxwl.png"/>
|