r2plus1d_18¶
- torchvision.models.video.r2plus1d_18(*, weights: Optional[R2Plus1D_18_Weights] = None, progress: bool = True, **kwargs: Any) VideoResNet [source]¶
Construct 18 layer deep R(2+1)D network as in
Warning
The video module is in Beta stage, and backward compatibility is not guaranteed.
Reference: A Closer Look at Spatiotemporal Convolutions for Action Recognition.
- Parameters:
weights (
R2Plus1D_18_Weights
, optional) – The pretrained weights to use. SeeR2Plus1D_18_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.resnet.VideoResNet
base class. Please refer to the source code for more details about this class.
- class torchvision.models.video.R2Plus1D_18_Weights(value)[source]¶
The model builder above accepts the following values as the
weights
parameter.R2Plus1D_18_Weights.DEFAULT
is equivalent toR2Plus1D_18_Weights.KINETICS400_V1
. You can also use strings, e.g.weights='DEFAULT'
orweights='KINETICS400_V1'
.R2Plus1D_18_Weights.KINETICS400_V1:
The weights reproduce closely the accuracy of the paper. The accuracies are estimated on video-level with parameters frame_rate=15, clips_per_video=5, and clip_len=16. Also available as
R2Plus1D_18_Weights.DEFAULT
.acc@1 (on Kinetics-400)
67.463
acc@5 (on Kinetics-400)
86.175
min_size
height=1, width=1
categories
abseiling, air drumming, answering questions, … (397 omitted)
recipe
num_params
31505325
GFLOPS
40.52
File size
120.3 MB
The inference transforms are available at
R2Plus1D_18_Weights.KINETICS400_V1.transforms
and perform the following preprocessing operations: Accepts batched(B, T, C, H, W)
and single(T, C, H, W)
video frametorch.Tensor
objects. The frames are resized toresize_size=[128, 171]
usinginterpolation=InterpolationMode.BILINEAR
, followed by a central crop ofcrop_size=[112, 112]
. Finally the values are first rescaled to[0.0, 1.0]
and then normalized usingmean=[0.43216, 0.394666, 0.37645]
andstd=[0.22803, 0.22145, 0.216989]
. Finally the output dimensions are permuted to(..., C, T, H, W)
tensors.