Rate this Page

DecoderTransform#

class torchcodec.transforms.DecoderTransform[source]#

Base class for all decoder transforms.

A decoder transform is a transform that is applied by the decoder before returning the decoded frame. Applying decoder transforms to frames should be both faster and more memory efficient than receiving normally decoded frames and applying the same kind of transform.

Most DecoderTransform objects have a complementary transform in TorchVision, specificially in torchvision.transforms.v2. For such transforms, we ensure that:

  1. The names are the same.

  2. Default behaviors are the same.

  3. The parameters for the DecoderTransform object are a subset of the TorchVision Transform object.

  4. Parameters with the same name control the same behavior and accept a subset of the same types.

  5. The difference between the frames returned by a decoder transform and the complementary TorchVision transform are such that a model should not be able to tell the difference.

Examples using DecoderTransform:

TorchCodec Performance Tips and Best Practices

TorchCodec Performance Tips and Best Practices

Decoder Transforms: Applying transforms during decoding

Decoder Transforms: Applying transforms during decoding