Saltar al contenido
ModelPublicadoExterno
Descargar

Lsvit Hmdb51

LS-ViT (Long-Short ViT) is a ViT-Base backbone augmented with two motion-aware modules for video action recognition:

TipoOtherVersiónBestBcalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
345 MB
Versión
vBest
Actualizado
11 oct 2026
Fuente
Hugging Face

Descripción de la fuente

LS-ViT for HMDB51 Action Recognition

LS-ViT (Long-Short ViT) is a ViT-Base backbone augmented with two motion-aware modules for video action recognition:

  • SMIFModule — Short-term Motion Injection & Fusion. Operates on raw RGB frames, computes a windowed motion map across neighboring frames, and fuses it back into the spatial features via a 1×1 convolution and a learned blend.
  • LMIModule — Long-term Motion Interaction. Inserted inside every transformer block. Operates on patch tokens by computing forward/backward temporal differences in a reduced space and using them as a token-level attention gate.

The backbone is initialized from vit_base_patch16_224 (timm) and the full model is fine-tuned on HMDB51 for 51-way action classification.

Files

FileDescription
lsvit_hmdb51_best.ptBest checkpoint by validation accuracy. State dict under key "model".
modeling.pySelf-contained model architecture (no timm runtime dependency).
README.mdThis card.

Training setup

Pretrained backbonevit_base_patch16_224
Image size224
Frames per clip12
Frame stride2
Epochs5
Batch size2 (gradient accumulation = 16)
OptimizerAdamW
Backbone LR5e-5
Head LR2.5e-4
Weight decay0.05
Mixed precisionYes (torch.amp)

Result

Top-1 validation accuracy on the held-out HMDB51 split: ~32.7% (best checkpoint). This is a short 5-epoch run on a small batch size and should be treated as a starting point rather than a competitive HMDB51 number.

Training curves

Training and validation loss/accuracy over 5 epochs

Validation accuracy climbs roughly linearly from ~13% (epoch 1) to ~32.7% (epoch 5). Training accuracy reaches ~45% by epoch 5, and validation loss tracks training loss closely after epoch 2 — the run was still improving when training stopped, so additional epochs would likely help.

Usage

import torch
from modeling import ViTConfig, LSViTForAction, HMDB51_CLASSES

config = ViTConfig(image_size=224)
model = LSViTForAction(config, num_classes=51)

ckpt = torch.load("lsvit_hmdb51_best.pt", map_location="cpu", weights_only=False)
model.load_state_dict(ckpt["model"])
model.eval()

# video: (B, T, C, H, W) — float tensor in [0, 1] normalized with
# mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225). Trained with T=12.
video = torch.randn(1, 12, 3, 224, 224)
with torch.no_grad():
    logits = model(video)

pred = logits.argmax(dim=-1).item()
print(HMDB51_CLASSES[pred])

Downloading from the Hub

from huggingface_hub import hf_hub_download

weights_path = hf_hub_download("devicoal/lsvit_hmdb51", "lsvit_hmdb51_best.pt")
modeling_path = hf_hub_download("devicoal/lsvit_hmdb51", "modeling.py")

Classes

51 HMDB51 action categories (alphabetical, matching sorted(os.listdir(...))):

brush_hair, cartwheel, catch, chew, clap, climb, climb_stairs, dive,
draw_sword, dribble, drink, eat, fall_floor, fencing, flic_flac, golf,
handstand, hit, hug, jump, kick, kick_ball, kiss, laugh, pick, pour, pullup,
punch, push, pushup, ride_bike, ride_horse, run, shake_hands, shoot_ball,
shoot_bow, shoot_gun, sit, situp, smile, smoke, somersault, stand,
swing_baseball, sword, sword_exercise, talk, throw, turn, walk, wave

License

Apache-2.0.

Fuentes

1 fuente
Hugging FacePrincipalVersión 34f017bf65d4b941c1d35622e2cde6cc8729014f
huggingface.co/devicoal/lsvit_hmdb51/tree/34f017bf65d4b941c1d35622e2cde6cc8729014f

Verificado 11 oct

Artefactos del modelo

1 artefacto

lsvit_hmdb51_best.pt

pt · 345 MB · SHA-256 85850de17fb0…104c · Hugging Face

Download file

Extractos de fuentes

2 extractos

--- license: apache-2.0 tags: - video-classification - action-recognition - vision-transformer - hmdb51 - pytorch datasets: - hmdb51 library_name: pytorch pipeline_tag: video-classification --- # LS-ViT for HMDB51 Action Recognition LS-ViT (Long-Short ViT) is a ViT-Base backbone augmented with two motion-aware modules for video action recognition: - **SMIFModule** — *Short-term Motion Injection & Fusion*. Operates on raw RGB frames, computes a windowed motion map across neighboring frames, and fuses it back into the spatial features via a 1×1 convolution and a learned blend. - **LMIModule** — *Long-term Motion Interaction*. Inserted inside every transformer block. Operates on patch tokens by computing forward/backward temporal differences in a reduced space and using them as a token-level attention gate. The backbone is initialized from `vit_base_patch16_224` (timm) and the full model is fine-tuned on HMDB51 for 51-way action classification. ## Files | File | Description | | --- | --- | | `lsvit_hmdb51_best.pt` | Best checkpoint by validation accuracy. State dict under key `"model"`. | | `modeling.py` | Self-contained model architecture (no `timm` runtime dependency). | | `README.md` | This card. | ## Training setup | | | | --- | --- | | Pretrained backbone | `vit_base_patch16_224` | | Image size | 224 | | Frames per clip | 12 | | Frame stride | 2 | | Epochs | 5 | | Batch size | 2 (gradient accumulation = 16) | | Optimizer | AdamW | | Backbone LR | 5e-5 | | Head LR | 2.5e-4 | | Weight decay | 0.05 | | Mixed precision | Yes (`torch.amp`) | ## Result Top-1 validation accuracy on the held-out HMDB51 split: **~32.7%** (best checkpoint). This is a short 5-epoch run on a small batch size and should be treated as a starting point rather than a competitive HMDB51 number. ### Training curves ![Training and validation loss/accuracy over 5 epochs](accuracy_graph.png) Validation accuracy climbs roughly linearly from ~13% (epoch 1) to ~32.7% (epoch 5). Training accuracy reaches ~45% by epoch 5, and validation loss tracks training loss closely after epoch 2 — the run was still improving when training stopped, so additional epochs would likely help. ## Usage ```python import torch from modeling import ViTConfig, LSViTForAction, HMDB51_CLASSES config = ViTConfig(image_size=224) model = LSViTForAction(config, num_classes=51) ckpt = torch.load("...

Source context: 0 downloads · 1 likes · Pipeline video-classification · Library pytorch · Repo devicoal/lsvit_hmdb51