nielsr HF staff commited on
Commit
5957484
1 Parent(s): 87e8319

Update model card

Browse files

Small PR to update the "feature extractor" to "image processor".

Files changed (1) hide show
  1. README.md +4 -4
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 AutoFeatureExtractor, SegformerForSemanticSegmentation
21
  from PIL import Image
22
  import requests
23
  import matplotlib.pyplot as plt
24
  import torch.nn as nn
25
 
26
- extractor = AutoFeatureExtractor.from_pretrained("mattmdjaga/segformer_b2_clothes")
27
- model = SegformerForSemanticSegmentation.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 = extractor(images=image, return_tensors="pt")
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()