🚀 videomae-base-finetuned-ucf101
このモデルは、UCF101データセットでFine-tuningされたVideoMAE Baseモデルです。動画行動認識タスクに使用できます。WandBレポートでメトリクスを確認できます。
🚀 クイックスタート
以下のコードを使って、このモデルを始めることができます。
クリックして展開
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])
✨ 主な機能
直接使用
このモデルは、動画行動認識に使用できます。
推奨事項
ユーザー(直接的および下流的なユーザー)は、このモデルのリスク、バイアス、および制限について認識する必要があります。さらなる推奨事項については、詳細情報が必要です。
📦 インストール
ドキュメントにインストール手順が記載されていないため、このセクションをスキップします。
💻 使用例
基本的な使用法
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])
📚 ドキュメント
モデルの詳細
モデルの説明
UCF101でFine-tuningされたVideoMAE Baseモデルです。
- 開発者: @nateraw
- 共有者 [オプション]: [詳細情報が必要]
- モデルタイプ: fine-tuned
- 言語 (NLP): en
- ライセンス: mit
- 関連モデル [オプション]: [詳細情報が必要]
- 詳細情報のリソース: [詳細情報が必要]
トレーニングの詳細
トレーニングデータ
[詳細情報が必要]
トレーニング手順 [オプション]
前処理
動画から64フレームのクリップをサンプリングし、それらのフレームを均等にサンプリングして、モデルに16フレームの入力を取得しました。トレーニング中は、PyTorchVideoのMixVideo
を使用して、mixup/cutmixを適用しました。
速度、サイズ、時間
[詳細情報が必要]
評価
テストデータ、要因、メトリクス
テストデータ
[詳細情報が必要]
要因
[詳細情報が必要]
メトリクス
[詳細情報が必要]
結果
UCF101のアノテーションの1つのフォールドのみをトレーニング/評価しました。VideoMAEの論文とは異なり、検証動画の複数のクロップ/セグメントに対して推論を行わなかったため、結果はそうした場合よりもわずかに低くなる可能性があります。
- 評価精度: 0.758209764957428
- 評価精度(上位5): 0.8983050584793091
環境への影響
炭素排出量は、Lacoste et al. (2019)で提示されたMachine Learning Impact calculatorを使用して推定できます。
- ハードウェアタイプ: [詳細情報が必要]
- 使用時間: [詳細情報が必要]
- クラウドプロバイダー: [詳細情報が必要]
- コンピュートリージョン: [詳細情報が必要]
- 排出された炭素量: [詳細情報が必要]
🔧 技術詳細
ドキュメントに技術詳細が不十分なため、このセクションをスキップします。
📄 ライセンス
このモデルはMITライセンスの下で提供されています。