nielsr HF staff commited on
Commit
80983a4
1 Parent(s): ed0b85c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -32,17 +32,17 @@ You can use the model for fine-tuning of semantic segmentation. See the [model h
32
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
33
 
34
  ```python
35
- from transformers import SegformerFeatureExtractor, SegformerForImageClassification
36
  from PIL import Image
37
  import requests
38
 
39
  url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40
  image = Image.open(requests.get(url, stream=True).raw)
41
 
42
- feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/mit-b0")
43
  model = SegformerForImageClassification.from_pretrained("nvidia/mit-b0")
44
 
45
- inputs = feature_extractor(images=image, return_tensors="pt")
46
  outputs = model(**inputs)
47
  logits = outputs.logits
48
  # model predicts one of the 1000 ImageNet classes
 
32
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
33
 
34
  ```python
35
+ from transformers import SegformerImageProcessor, SegformerForImageClassification
36
  from PIL import Image
37
  import requests
38
 
39
  url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40
  image = Image.open(requests.get(url, stream=True).raw)
41
 
42
+ image_processor = SegformerImageProcessor.from_pretrained("nvidia/mit-b0")
43
  model = SegformerForImageClassification.from_pretrained("nvidia/mit-b0")
44
 
45
+ inputs = image_processor(images=image, return_tensors="pt")
46
  outputs = model(**inputs)
47
  logits = outputs.logits
48
  # model predicts one of the 1000 ImageNet classes