模型:

facebook/timesformer-base-finetuned-k400

英文

TimeSformer (基本大小的模型,在Kinetics-400上进行了微调)

TimeSformer模型在 Kinetics-400 上进行了预训练。它由Tong等人在 TimeSformer: Is Space-Time Attention All You Need for Video Understanding? 的论文中引入,并于 this repository 首次发布。

免责声明:发布TimeSformer的团队没有为此模型撰写模型卡,因此此模型卡是由 fcakyon 撰写的。

预期用途和限制

您可以使用原始模型对视频进行分类,其中包括400个可能的Kinetics-400标签之一。

如何使用

使用此模型对视频进行分类的方法如下:

from transformers import AutoImageProcessor, TimesformerForVideoClassification
import numpy as np
import torch

video = list(np.random.randn(8, 3, 224, 224))

processor = AutoImageProcessor.from_pretrained("facebook/timesformer-base-finetuned-k400")
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-base-finetuned-k400")

inputs = processor(video, return_tensors="pt")

with torch.no_grad():
  outputs = model(**inputs)
  logits = outputs.logits

predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])

有关更多代码示例,请参阅 documentation

BibTeX条目和引用信息

@inproceedings{bertasius2021space,
  title={Is Space-Time Attention All You Need for Video Understanding?},
  author={Bertasius, Gedas and Wang, Heng and Torresani, Lorenzo},
  booktitle={International Conference on Machine Learning},
  pages={813--824},
  year={2021},
  organization={PMLR}
}