Practical overview
When it fits
Use it when you already have video frames prepared as tensors and need a PyTorch STAM model to produce classification scores.
Who it is for
- Developers building video-classification prototypes in Python and PyTorch.
- Researchers or practitioners evaluating a space-time attention model on prepared video frames.
Documented uses
- Configure a STAM model for a chosen frame size, clip length and number of output classes.
- Pass batches of prepared video frames to the model and obtain class-score vectors.
Requirements & limits
The repository is public and specifies an MIT license. Its README gives `pip install stam-pytorch` as the installation command.
- The example uses five frames per clip and 100 output classes, but exposes parameters for frame count, image size and class count.
- The documented model input is a five-dimensional batch × frames × channels × height × width tensor.
- The README does not provide a frame-extraction pipeline or dataset-loading workflow.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install STAM-pytorch and classify a batch of frames
Install the package, create an STAM model, and pass it a batch of five-frame video samples to obtain class scores.
Before you start
- Python environment with PyTorch available as
torch. - Input frames shaped as batch × frames × channels × height × width; the example uses two batches of five 256×256 RGB frames.
Steps
Install the package with the command below.
pip install stam-pytorchImport
torchandSTAMfromstam_pytorch, then create an STAM model; the example setsnum_frames=5,image_size=256, andnum_classes=100.Create a frame tensor, for example
torch.randn(2, 5, 3, 256, 256), and pass it to the model withpred = model(frames).Use the returned scores, shaped
(2, 100)in the example, as the model output for the two input samples.
Expected outcome
The model returns 100 class scores for each sample in the example batch.
Guide limitations
- The example uses randomly generated frames; it does not document video decoding, frame sampling, labels, or evaluation.
- The documented input configuration uses five frames at 256×256 resolution and returns scores for 100 classes; other configurations and performance are not demonstrated.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- lucidrains/STAM-pytorch · Official homepage title · retained in its source language

