Downloads · 30 days
111
49% of all-time downloads
kfkas/movinet-a0-stream-pytorch
movinet-a0-stream-pytorch is a video classification model from kfkas. Use it for the video classification task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
Trainable PyTorch and Transformers implementation of causal MoViNet-A0 Stream. The checkpoint contains the Kinetics-600 weights ported by Atze00/MoViNet-pytorch from the official Google Research MoViNet release.
Downloads · 30 days
111
49% of all-time downloads
All-time downloads
226
Public
Parameters
3.8M
15.1 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors15.1 MB · 99%
From the Hugging Face model README
Trainable PyTorch and Transformers implementation of causal MoViNet-A0 Stream. The checkpoint contains the Kinetics-600 weights ported by Atze00/MoViNet-pytorch from the official Google Research MoViNet release.
The model accepts clips in Transformers video layout:
[batch, frames, channels, height, width]
The reference spatial resolution is 172x172, and RGB values should be
floating point values in [0, 1].
pip install "torch>=2.1" "transformers>=5.0" \
"fvcore>=0.1.5.post20210630" "einops>=0.8"
import torch
from transformers import AutoModelForVideoClassification
model = AutoModelForVideoClassification.from_pretrained(
"kfkas/movinet-a0-stream-pytorch",
revision="0c1fcb4911f4971afc984bca813af2f9c9ab9cdd",
trust_remote_code=True,
)
pixel_values = torch.rand(2, 8, 3, 172, 172)
labels = torch.tensor([10, 25])
output = model(pixel_values=pixel_values, labels=labels)
output.loss.backward()
For a new task, replace the Kinetics classifier:
model = AutoModelForVideoClassification.from_pretrained(
"kfkas/movinet-a0-stream-pytorch",
revision="0c1fcb4911f4971afc984bca813af2f9c9ab9cdd",
num_labels=3,
ignore_mismatched_sizes=True,
trust_remote_code=True,
)
Independent clip calls reset causal state automatically. To retain state across
successive frames, reset once and pass use_stream_state=True:
model.reset_stream()
for frame in frames:
output = model(
pixel_values=frame[:, None],
use_stream_state=True,
)
frame has shape [batch, channels, height, width]. Call reset_stream()
before starting another video.
c2d1edf48fc6c5259707f9d833f22171b4f63493This repository uses custom Transformers code. Review the modeling files and pin a repository revision for production use.