fix a typo in code snippet (#2)
- fix a typo in code snippet (3753aeee87a9b3b11c8e4fcff74f0c824a4cafed) - Update README.md (048d3c90f3f8c5343255801578a89ee6e1caad71) Co-authored-by: Fatih <fcakyon@users.noreply.huggingface.co>
This commit is contained in:
parent
113f762324
commit
eed8700e24
|
@ -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(16, 3, 448, 448))
|
video = list(np.random.randn(16, 3, 448, 448))
|
||||||
|
|
||||||
feature_extractor = TimesformerFeatureExtractor.from_pretrained("facebook/timesformer-hr-finetuned-ssv2")
|
processor = AutoImageProcessor.from_pretrained("facebook/timesformer-hr-finetuned-ssv2")
|
||||||
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-ssv22")
|
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-ssv2")
|
||||||
|
|
||||||
inputs = feature_extractor(video, return_tensors="pt")
|
inputs = feature_extractor(images=video, return_tensors="pt")
|
||||||
|
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
outputs = model(**inputs)
|
outputs = model(**inputs)
|
||||||
|
|
Loading…
Reference in New Issue