🚀 VideoMAE(基礎大小模型,僅預訓練)
VideoMAE 是一個在 Kinetics - 400 數據集上以自監督方式預訓練 800 個週期的視頻模型。該模型由 Tong 等人在論文 VideoMAE: Masked Autoencoders are Data - Efficient Learners for Self - Supervised Video Pre - Training 中提出,並首次在 [此倉庫](https://github.com/MCG - NJU/VideoMAE) 發佈。
聲明:發佈 VideoMAE 的團隊並未為此模型編寫模型卡片,此卡片由 Hugging Face 團隊編寫。
🚀 快速開始
本部分將為你介紹如何使用 VideoMAE 模型進行視頻處理。
✨ 主要特性
- VideoMAE 是 Masked Autoencoders (MAE) 在視頻領域的擴展。
- 模型架構與標準的視覺變換器(ViT)非常相似,頂部有一個解碼器用於預測掩碼塊的像素值。
- 通過預訓練,模型學習到視頻的內部表示,可用於提取對下游任務有用的特徵。
📚 詳細文檔
模型描述
VideoMAE 是 Masked Autoencoders (MAE) 在視頻領域的擴展。其模型架構與標準的視覺變換器(ViT)極為相似,頂部配備一個解碼器,用於預測掩碼塊的像素值。
視頻以固定大小的塊序列(分辨率為 16x16)的形式輸入到模型中,並進行線性嵌入。同時,在序列開頭添加一個 [CLS] 標記,用於分類任務。在將序列輸入到 Transformer 編碼器層之前,還會添加固定的正弦/餘弦位置嵌入。
通過預訓練,模型學習到視頻的內部表示,這些表示可用於提取對下游任務有用的特徵。例如,如果你有一個帶標籤的視頻數據集,可以在預訓練的編碼器頂部放置一個線性層,訓練一個標準的分類器。通常,會在 [CLS] 標記頂部放置一個線性層,因為該標記的最後隱藏狀態可視為整個視頻的表示。
預期用途與限制
你可以使用原始模型來預測視頻掩碼塊的像素值,但該模型主要用於在下游任務上進行微調。你可以訪問 模型中心 查找針對你感興趣任務的微調版本。
訓練數據
(待完成,歡迎提交 PR)
訓練過程
預處理
(待完成,歡迎提交 PR)
預訓練
(待完成,歡迎提交 PR)
評估結果
(待完成,歡迎提交 PR)
💻 使用示例
基礎用法
以下是如何使用該模型預測隨機掩碼塊像素值的示例代碼:
from transformers import VideoMAEImageProcessor, VideoMAEForPreTraining
import numpy as np
import torch
num_frames = 16
video = list(np.random.randn(16, 3, 224, 224))
processor = VideoMAEImageProcessor.from_pretrained("MCG-NJU/videomae-base-short")
model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-base-short")
pixel_values = processor(video, return_tensors="pt").pixel_values
num_patches_per_frame = (model.config.image_size // model.config.patch_size) ** 2
seq_length = (num_frames // model.config.tubelet_size) * num_patches_per_frame
bool_masked_pos = torch.randint(0, 2, (1, seq_length)).bool()
outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss = outputs.loss
更多代碼示例,請參考 文檔。
📄 許可證
本模型採用 CC - BY - NC - 4.0 許可證。
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}
}