Shortcuts

s3d

torchvision.models.video.s3d(*, weights: Optional[S3D_Weights] = None, progress: bool = True, **kwargs: Any) S3D[source]

Construct Separable 3D CNN model.

Reference: Rethinking Spatiotemporal Feature Learning.

Warning

The video module is in Beta stage, and backward compatibility is not guaranteed.

Parameters:
  • weights (S3D_Weights, optional) – The pretrained weights to use. See S3D_Weights below for more details, and possible values. By default, no pre-trained weights are used.

  • progress (bool) – If True, displays a progress bar of the download to stderr. Default is True.

  • **kwargs – parameters passed to the torchvision.models.video.S3D base class. Please refer to the source code for more details about this class.

class torchvision.models.video.S3D_Weights(value)[source]

The model builder above accepts the following values as the weights parameter. S3D_Weights.DEFAULT is equivalent to S3D_Weights.KINETICS400_V1. You can also use strings, e.g. weights='DEFAULT' or weights='KINETICS400_V1'.

S3D_Weights.KINETICS400_V1:

The weights aim to approximate the accuracy of the paper. The accuracies are estimated on clip-level with parameters frame_rate=15, clips_per_video=1, and clip_len=128. Also available as S3D_Weights.DEFAULT.

acc@1 (on Kinetics-400)

68.368

acc@5 (on Kinetics-400)

88.05

min_size

height=224, width=224

min_temporal_size

14

categories

abseiling, air drumming, answering questions, … (397 omitted)

recipe

link

num_params

8320048

GFLOPS

17.98

File size

32.0 MB

The inference transforms are available at S3D_Weights.KINETICS400_V1.transforms and perform the following preprocessing operations: Accepts batched (B, T, C, H, W) and single (T, C, H, W) video frame torch.Tensor objects. The frames are resized to resize_size=[256, 256] using interpolation=InterpolationMode.BILINEAR, followed by a central crop of crop_size=[224, 224]. Finally the values are first rescaled to [0.0, 1.0] and then normalized using mean=[0.43216, 0.394666, 0.37645] and std=[0.22803, 0.22145, 0.216989]. Finally the output dimensions are permuted to (..., C, T, H, W) tensors.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources