🚀 视频MAE基础模型在UCF101数据集上微调版本
这是一个在UCF101数据集上微调的VideoMAE基础模型,可用于视频动作识别任务。
🚀 快速开始
使用以下代码开始使用该模型:
点击展开
from decord import VideoReader, cpu
import torch
import numpy as np
from transformers import VideoMAEFeatureExtractor, VideoMAEForVideoClassification
from huggingface_hub import hf_hub_download
np.random.seed(0)
def sample_frame_indices(clip_len, frame_sample_rate, seg_len):
converted_len = int(clip_len * frame_sample_rate)
end_idx = np.random.randint(converted_len, seg_len)
start_idx = end_idx - converted_len
indices = np.linspace(start_idx, end_idx, num=clip_len)
indices = np.clip(indices, start_idx, end_idx - 1).astype(np.int64)
return indices
file_path = hf_hub_download(
repo_id="nateraw/dino-clips", filename="archery.mp4", repo_type="space"
)
videoreader = VideoReader(file_path, num_threads=1, ctx=cpu(0))
videoreader.seek(0)
indices = sample_frame_indices(clip_len=16, frame_sample_rate=4, seg_len=len(videoreader))
video = videoreader.get_batch(indices).asnumpy()
feature_extractor = VideoMAEFeatureExtractor.from_pretrained("nateraw/videomae-base-finetuned-ucf101")
model = VideoMAEForVideoClassification.from_pretrained("nateraw/videomae-base-finetuned-ucf101")
inputs = feature_extractor(list(video), return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])
✨ 主要特性
- 该模型基于VideoMAE基础模型,在UCF101数据集上进行了微调。
- 可用于视频动作识别任务。
📚 详细文档
模型详情
模型描述
VideoMAE基础模型在UCF101数据集上微调版本。
- 开发者:@nateraw
- 模型类型:微调模型
- 语言:英文
- 许可证:MIT
- 相关模型:
- 更多信息资源:[待补充]
用途
直接使用
该模型可用于视频动作识别。
建议
直接用户和下游用户都应该了解该模型的风险、偏差和局限性。如需进一步建议,还需更多信息。
训练详情
训练数据
[待补充]
训练过程
预处理
我们从视频中采样64帧的片段,然后对这些帧进行均匀采样,以获得16帧的模型输入。在训练过程中,我们使用了PyTorchVideo的MixVideo
来应用mixup/cutmix。
速度、大小、时间
[待补充]
评估
测试数据、因素和指标
测试数据
[待补充]
因素
[待补充]
指标
[待补充]
结果
我们仅对UCF101标注中的一个折叠进行了训练和评估。与VideoMAE论文不同,我们没有对验证视频的多个裁剪/片段进行推理,因此结果可能略低于进行该操作时的结果。
- 评估准确率:0.758209764957428
- 评估前5准确率:0.8983050584793091
环境影响
可以使用Lacoste等人(2019)提出的机器学习影响计算器来估算碳排放。
- 硬件类型:[待补充]
- 使用时长:[待补充]
- 云服务提供商:[待补充]
- 计算区域:[待补充]
- 碳排放:[待补充]
模型卡片作者
@nateraw
模型卡片联系方式
@nateraw
指标报告
这里有一份WandB报告提供了相关指标。
表格目录
- 模型详情
- 用途
- 偏差、风险和局限性
- 训练详情
- 评估
- 模型检查(可选)
- 环境影响
- 技术规格(可选)
- 引用(可选)
- 术语表(可选)
- 更多信息(可选)
- 模型卡片作者(可选)
- 模型卡片联系方式
- 如何开始使用该模型
偏差、风险和局限性
[待补充]
模型检查(可选)
[待补充]
技术规格(可选)
模型架构和目标
[待补充]
计算基础设施
硬件
[待补充]
软件
[待补充]
引用(可选)
BibTeX
[待补充]
APA
[待补充]
术语表(可选)
[待补充]
更多信息(可选)
[待补充]