nielsr HF staff commited on
Commit
9c9bb74
1 Parent(s): 76306c5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -29,17 +29,17 @@ You can use the raw model for semantic segmentation. See the [model hub](https:/
29
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
30
 
31
  ```python
32
- from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
33
  from PIL import Image
34
  import requests
35
 
36
- feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b4-finetuned-cityscapes-1024-1024")
37
  model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b4-finetuned-cityscapes-1024-1024")
38
 
39
  url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40
  image = Image.open(requests.get(url, stream=True).raw)
41
 
42
- inputs = feature_extractor(images=image, return_tensors="pt")
43
  outputs = model(**inputs)
44
  logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
45
  ```
 
29
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
30
 
31
  ```python
32
+ from transformers import SegformerImageProcessor, SegformerForSemanticSegmentation
33
  from PIL import Image
34
  import requests
35
 
36
+ processor = SegformerImageProcessor.from_pretrained("nvidia/segformer-b4-finetuned-cityscapes-1024-1024")
37
  model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b4-finetuned-cityscapes-1024-1024")
38
 
39
  url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40
  image = Image.open(requests.get(url, stream=True).raw)
41
 
42
+ inputs = processor(images=image, return_tensors="pt")
43
  outputs = model(**inputs)
44
  logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
45
  ```