🚀 VideoMAE(大型模型,仅预训练)
VideoMAE 模型在 Kinetics - 400 数据集上以自监督方式预训练了 1600 个周期。该模型由 Tong 等人在论文 VideoMAE: Masked Autoencoders are Data - Efficient Learners for Self - Supervised Video Pre - Training 中提出,并首次在 [此仓库](https://github.com/MCG - NJU/VideoMAE) 发布。
声明:发布 VideoMAE 的团队未为此模型撰写模型卡片,此模型卡片由 Hugging Face 团队撰写。
📚 详细文档
模型描述
VideoMAE 是 Masked Autoencoders (MAE) 在视频领域的扩展。该模型的架构与标准的视觉变换器(ViT)非常相似,顶部有一个解码器用于预测被掩码补丁的像素值。
视频以固定大小的补丁序列(分辨率为 16x16)的形式输入到模型中,并进行线性嵌入。在序列开头添加一个 [CLS] 标记,用于分类任务。在将序列输入到 Transformer 编码器层之前,还会添加固定的正弦/余弦位置嵌入。
通过对模型进行预训练,它学习到视频的内部表示,可用于提取对下游任务有用的特征。例如,如果你有一个带标签的视频数据集,可以在预训练的编码器上添加一个线性层,训练一个标准的分类器。通常会在 [CLS] 标记上添加一个线性层,因为该标记的最后隐藏状态可视为整个视频的表示。
预期用途和限制
你可以使用原始模型来预测视频中被掩码补丁的像素值,但它主要用于在下游任务上进行微调。请查看 模型中心,查找针对你感兴趣的任务进行微调的版本。
💻 使用示例
基础用法
以下是如何使用该模型预测随机掩码补丁的像素值:
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-large")
model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-large")
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}
}
属性 |
详情 |
模型类型 |
VideoMAE(大型模型,仅预训练) |
训练数据 |
暂未提供 |
训练过程 |
暂未提供 |
评估结果 |
暂未提供 |