语言: 英语
许可证: MIT
库名称: transformers
标签:
模型卡片:videomae-base-finetuned-ucf101
WandB报告链接 查看指标。
目录
- 模型详情
- 用途
- 偏差、风险与限制
- 训练详情
- 评估
- 模型检查
- 环境影响
- 技术规格
- 引用
- 术语表
- 更多信息
- 模型卡片作者
- 模型卡片联系方式
- 如何开始使用模型
模型详情
模型描述
基于VideoMAE Base模型在UCF101数据集上微调
- 开发者: @nateraw
- 共享者(可选): [需更多信息]
- 模型类型: 微调模型
- 语言(NLP): 英语
- 许可证: MIT
- 相关模型(可选): [需更多信息]
- 更多信息资源: [需更多信息]
用途
直接使用
该模型可用于视频动作识别。
下游使用(可选)
[需更多信息]
超出范围的使用
[需更多信息]
偏差、风险与限制
[需更多信息]
建议
用户(包括直接使用和下游使用)应了解模型的风险、偏差和限制。需更多信息以提供进一步建议。
训练详情
训练数据
[需更多信息]
训练过程(可选)
预处理
我们从视频中采样64帧的片段,然后均匀采样得到16帧作为模型输入。训练时使用了PyTorchVideo的MixVideo
进行mixup/cutmix增强。
速度、大小与时间
[需更多信息]
评估
测试数据、因素与指标
测试数据
[需更多信息]
因素
[需更多信息]
指标
[需更多信息]
结果
我们仅训练/评估了UCF101标注的一个折叠。与VideoMAE论文不同,我们未在验证视频的多裁剪/片段上进行推理,因此结果可能略低于预期。
- 评估准确率: 0.758209764957428
- 评估Top 5准确率: 0.8983050584793091
模型检查(可选)
[需更多信息]
环境影响
碳排放量可使用机器学习影响计算器估算,详见Lacoste等(2019)。
- 硬件类型: [需更多信息]
- 使用时长: [需更多信息]
- 云服务提供商: [需更多信息]
- 计算区域: [需更多信息]
- 碳排放量: [需更多信息]
技术规格(可选)
模型架构与目标
[需更多信息]
计算基础设施
[需更多信息]
硬件
[需更多信息]
软件
[需更多信息]
引用(可选)
BibTeX:
[需更多信息]
APA:
[需更多信息]
术语表(可选)
[需更多信息]
更多信息(可选)
[需更多信息]
模型卡片作者(可选)
@nateraw
模型卡片联系方式
@nateraw
如何开始使用模型
使用以下代码开始使用模型。
点击展开
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])