fix a typo in code snippet (#3)
- fix a typo in code snippet (4655a3825d3fd6bcdc6f862f92bae4c348ab3516) - Update README.md (fa5f033feb1c19ba739ff3ebbd1447fe85ebf4b0) Co-authored-by: Fatih <fcakyon@users.noreply.huggingface.co>
This commit is contained in:
parent
53067950fd
commit
c12281dea7
|
@ -20,16 +20,16 @@ You can use the raw model for video classification into one of the 174 possible
|
||||||
Here is how to use this model to classify a video:
|
Here is how to use this model to classify a video:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from transformers import TimesformerFeatureExtractor, TimesformerForVideoClassification
|
from transformers import AutoImageProcessor, TimesformerForVideoClassification
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
video = list(np.random.randn(8, 3, 224, 224))
|
video = list(np.random.randn(8, 3, 224, 224))
|
||||||
|
|
||||||
feature_extractor = TimesformerFeatureExtractor.from_pretrained("facebook/timesformer-base-finetuned-ssv2")
|
processor = AutoImageProcessor.from_pretrained("facebook/timesformer-base-finetuned-ssv2")
|
||||||
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-base-finetuned-ssv2")
|
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-base-finetuned-ssv2")
|
||||||
|
|
||||||
inputs = feature_extractor(video, return_tensors="pt")
|
inputs = processor(images=video, return_tensors="pt")
|
||||||
|
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
outputs = model(**inputs)
|
outputs = model(**inputs)
|
||||||
|
|
Loading…
Reference in New Issue