Shortcuts

RandomCrop

class torchcodec.transforms.RandomCrop(size: Sequence[int])[source]

Crop the decoded frame to a given size at a random location in the frame.

Complementary TorchVision transform: RandomCrop. Padding of all kinds is disabled. The random location within the frame is determined during the initialization of the VideoDecoder object that owns this transform. As a consequence, each decoded frame in the video will be cropped at the same location. Videos with variable resolution may result in undefined behavior.

Parameters:

size (Sequence[int]) – Desired output size. Must be a sequence of the form (height, width).

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