🚀 VideoMAE(超大型模型,在Kinetics - 400上微調)
VideoMAE是一個視頻模型,它以自監督的方式預訓練了1600個週期,並在Kinetics - 400上進行了有監督的微調。該模型由Tong等人在論文VideoMAE: Masked Autoencoders are Data - Efficient Learners for Self - Supervised Video Pre - Training中提出,並首次在[此倉庫](https://github.com/MCG - NJU/VideoMAE)中發佈。
免責聲明:發佈VideoMAE的團隊並未為此模型撰寫模型卡片,此模型卡片由Hugging Face團隊編寫。
✨ 主要特性
- VideoMAE是掩碼自編碼器(MAE)在視頻領域的擴展。其架構與標準的視覺Transformer(ViT)非常相似,頂部有一個解碼器,用於預測掩碼塊的像素值。
- 模型通過預訓練學習視頻的內部表示,可用於提取對下游任務有用的特徵。例如,若有帶標籤的視頻數據集,可在預訓練編碼器頂部添加線性層來訓練標準分類器。
📚 詳細文檔
模型描述
視頻以固定大小的塊(分辨率16x16)序列形式輸入到模型中,並進行線性嵌入。在序列開頭添加一個[CLS]標記,用於分類任務。在將序列輸入到Transformer編碼器層之前,還會添加固定的正弦/餘弦位置嵌入。
通過預訓練,模型學習到視頻的內部表示,可用於提取對下游任務有用的特徵。例如,若有帶標籤的視頻數據集,可在預訓練編碼器頂部添加線性層來訓練標準分類器。通常在[CLS]標記頂部添加線性層,因為該標記的最後隱藏狀態可視為整個視頻的表示。
預期用途和侷限性
可使用原始模型將視頻分類為400種可能的Kinetics - 400標籤之一。
💻 使用示例
基礎用法
以下是如何使用此模型對視頻進行分類的示例:
from transformers import VideoMAEImageProcessor, VideoMAEForVideoClassification
import numpy as np
import torch
video = list(np.random.randn(16, 3, 224, 224))
processor = VideoMAEImageProcessor.from_pretrained("MCG-NJU/videomae-huge-finetuned-kinetics")
model = VideoMAEForVideoClassification.from_pretrained("MCG-NJU/videomae-huge-finetuned-kinetics")
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])
更多代碼示例請參考文檔。
🔧 技術細節
評估結果
該模型在Kinetics - 400測試集上的top - 1準確率為86.6,top - 5準確率為97.1。
BibTeX引用和引用信息
misc{https://doi.org/10.48550/arxiv.2203.12602,
doi = {10.48550/ARXIV.2203.12602},
url = {https://arxiv.org/abs/2203.12602},
author = {Tong, Zhan and Song, Yibing and Wang, Jue and Wang, Limin},
keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}
📄 許可證
本模型採用CC - BY - NC - 4.0許可證。