模型:

facebook/timesformer-hr-finetuned-ssv2

英文

TimeSformer(高分辨率变体,在Something Something v2上进行微调)

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

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

预期用途和限制

您可以使用原始模型对视频进行分类,分为174个可能的Something Something v2标签之一。

如何使用

这是如何使用这个模型对视频进行分类的方法:

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

video = list(np.random.randn(16, 3, 448, 448))

processor = AutoImageProcessor.from_pretrained("facebook/timesformer-hr-finetuned-ssv2")
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-ssv2")

inputs = feature_extractor(images=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}
}