From d460be8db836a8515377b3d7c262b138977204df Mon Sep 17 00:00:00 2001 From: Niels Rogge Date: Fri, 2 Dec 2022 08:18:26 +0000 Subject: [PATCH] Create README.md --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..487c7a2 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +--- +license: "cc-by-nc-4.0" +tags: +- vision +- video-classification +--- + +# TimeSformer (high-resolution variant, fine-tuned on Something Something v2) + +TimeSformer model pre-trained on [Something Something v2](https://developer.qualcomm.com/software/ai-datasets/something-something). It was introduced in the paper [TimeSformer: Is Space-Time Attention All You Need for Video Understanding?](https://arxiv.org/abs/2102.05095) by Tong et al. and first released in [this repository](https://github.com/facebookresearch/TimeSformer). + +Disclaimer: The team releasing TimeSformer did not write a model card for this model so this model card has been written by [fcakyon](https://github.com/fcakyon). + +## Intended uses & limitations + +You can use the raw model for video classification into one of the 174 possible Something Something v2 labels. + +### How to use + +Here is how to use this model to classify a video: + +```python +from transformers import TimesformerFeatureExtractor, TimesformerForVideoClassification +import numpy as np +import torch + +video = list(np.random.randn(16, 3, 448, 448)) + +feature_extractor = TimesformerFeatureExtractor.from_pretrained("facebook/timesformer-hr-finetuned-ssv2") +model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-ssv22") + +inputs = feature_extractor(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]) +``` + +For more code examples, we refer to the [documentation](https://huggingface.co/transformers/main/model_doc/timesformer.html#). + +### BibTeX entry and citation info + +```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} +} +``` \ No newline at end of file