Update model card
Browse filesSmall PR to update the "feature extractor" to "image processor".
README.md
CHANGED
@@ -17,19 +17,19 @@ SegFormer model fine-tuned on [ATR dataset](https://github.com/lemondan/HumanPar
|
|
17 |
The dataset on hugging face is called "mattmdjaga/human_parsing_dataset".
|
18 |
|
19 |
```python
|
20 |
-
from transformers import
|
21 |
from PIL import Image
|
22 |
import requests
|
23 |
import matplotlib.pyplot as plt
|
24 |
import torch.nn as nn
|
25 |
|
26 |
-
|
27 |
-
model =
|
28 |
|
29 |
url = "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80"
|
30 |
|
31 |
image = Image.open(requests.get(url, stream=True).raw)
|
32 |
-
inputs =
|
33 |
|
34 |
outputs = model(**inputs)
|
35 |
logits = outputs.logits.cpu()
|
|
|
17 |
The dataset on hugging face is called "mattmdjaga/human_parsing_dataset".
|
18 |
|
19 |
```python
|
20 |
+
from transformers import AutoImageProcessor, AutoModelForSemanticSegmentation
|
21 |
from PIL import Image
|
22 |
import requests
|
23 |
import matplotlib.pyplot as plt
|
24 |
import torch.nn as nn
|
25 |
|
26 |
+
processor = AutoImageProcessor.from_pretrained("mattmdjaga/segformer_b2_clothes")
|
27 |
+
model = AutoModelForSemanticSegmentation.from_pretrained("mattmdjaga/segformer_b2_clothes")
|
28 |
|
29 |
url = "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80"
|
30 |
|
31 |
image = Image.open(requests.get(url, stream=True).raw)
|
32 |
+
inputs = processor(images=image, return_tensors="pt")
|
33 |
|
34 |
outputs = model(**inputs)
|
35 |
logits = outputs.logits.cpu()
|