adirik commited on
Commit
2f5c76b
1 Parent(s): 51c29e3

Update README.md

Browse files

Just minor corrections to the code snippet - we shouldn't need to specify resizing the image if the AutoImageProcessor loads the correct preprocessing configuration.

Files changed (1) hide show
  1. README.md +2 -1
README.md CHANGED
@@ -36,6 +36,7 @@ Here is how to use this model:
36
  ```python
37
  import requests
38
  import torch
 
39
  from PIL import Image
40
  from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
41
 
@@ -46,7 +47,7 @@ model = Mask2FormerForUniversalSegmentation.from_pretrained("facebook/video-mask
46
 
47
  file_path = hf_hub_download(repo_id="shivi/video-demo", filename="cars.mp4", repo_type="dataset")
48
  video = torchvision.io.read_video(file_path)[0]
49
- video_frames = [image_processor(images=frame, return_tensors="pt", do_resize=True, size=(480, 640)).pixel_values for frame in video]
50
  video_input = torch.cat(video_frames)
51
 
52
  with torch.no_grad():
 
36
  ```python
37
  import requests
38
  import torch
39
+ import torchvision
40
  from PIL import Image
41
  from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
42
 
 
47
 
48
  file_path = hf_hub_download(repo_id="shivi/video-demo", filename="cars.mp4", repo_type="dataset")
49
  video = torchvision.io.read_video(file_path)[0]
50
+ video_frames = [image_processor(images=frame, return_tensors="pt").pixel_values for frame in video]
51
  video_input = torch.cat(video_frames)
52
 
53
  with torch.no_grad():