fix a typo in code snippet and processor config (#2)
- fix a typo in code snippet (d4a091673f1e222362b66e76cd12503485811488) - Update README.md (283d3dadb4278dff272703e1e49660120ac9ee32) - Update README.md (3d47cc1abbe7e66e6e1508588b094529329c99a0) - fix processor config (5c99ed640fbd5953e8c10441c808bbb1d4eedca4) Co-authored-by: Fatih <fcakyon@users.noreply.huggingface.co>
This commit is contained in:
parent
d88ecd6e9a
commit
c0805983e9
|
@ -20,16 +20,16 @@ You can use the raw model for video classification into one of the 600 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(16, 3, 448, 448))
|
||||||
|
|
||||||
feature_extractor = TimesformerFeatureExtractor.from_pretrained("facebook/timesformer-hr-finetuned-k600")
|
processor = AutoImageProcessor.from_pretrained("facebook/timesformer-hr-finetuned-k600")
|
||||||
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-k600")
|
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-k600")
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"crop_size": {
|
"crop_size": {
|
||||||
"height": 224,
|
"height": 448,
|
||||||
"width": 224
|
"width": 448
|
||||||
},
|
},
|
||||||
"do_center_crop": true,
|
"do_center_crop": true,
|
||||||
"do_normalize": true,
|
"do_normalize": true,
|
||||||
|
@ -21,6 +21,6 @@
|
||||||
"resample": 2,
|
"resample": 2,
|
||||||
"rescale_factor": 0.00392156862745098,
|
"rescale_factor": 0.00392156862745098,
|
||||||
"size": {
|
"size": {
|
||||||
"shortest_edge": 224
|
"shortest_edge": 448
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue