Skip to content

TorchVision 0.28.0 Release

Latest

Choose a tag to compare

@atalman atalman released this 08 Jul 18:27
8fb8771

TorchVision 0.28 is out! This is a small release whose main change is the removal of the deprecated video decoding and encoding APIs (read_video, write_video, read_video_timestamps, VideoReader) from torchvision.io. Video decoding and encoding has fully migrated to TorchCodec as a part of our efforts to re-focus TorchVision. On the transforms side, v2.Resize now accepts string interpolation modes (e.g. "bilinear") and correctly honors NEAREST_EXACT on masks.

Backwards Incompatible Changes

  • Video decoding/encoding removed from torchvision.io; migrated to TorchCodec (#9451)

    read_video, write_video, read_video_timestamps, and VideoReader are no longer available in OSS torchvision, and the video-backed datasets now require TorchCodec. These APIs were deprecated (with warnings) in prior releases and are now gone.

    Symptoms you may hit:

    • ImportError: cannot import name 'read_video' from 'torchvision.io'
    • import torchvision.io.video raising ModuleNotFoundError/ImportError
    • From video datasets: ImportError: Video decoding capabilities were removed from torchvision and migrated to TorchCodec. Please install TorchCodec following instructions at https://github.com/pytorch/torchcodec#installing-torchcodec

    As an example, if you performed the following on TorchVision 0.27:

    from torchvision.io import read_video
    frames, audio, info = read_video("video.mp4")

    You would now achieve that with:

    # pip install torchcodec
    from torchcodec.decoders import VideoDecoder
    decoder = VideoDecoder("video.mp4")
    frames = decoder[:]  # or decoder.get_frames_in_range(...), etc.

    See the TorchCodec documentation for tutorials and API references.

Improvements

  • Allow passing interpolation as a string (e.g. "bilinear", "nearest") in resize transforms, in addition to the InterpolationMode enum (#9461)
  • tv_tensors.wrap() now preserves metadata for custom TVTensor subclasses — a subclass can define its own .wrap() method to control how it is re-wrapped (#9490)

Bug fixes

  • Fix F.resize on tv_tensors.Mask to honor NEAREST_EXACT interpolation. Previously the interpolation argument was ignored for mask inputs (resize_mask hardcoded NEAREST), so NEAREST_EXACT silently produced plain NEAREST output (#9497)
  • Fix a GIF decoder bug on malformed GIFs that could write outside the allocated tensor's memory (#9520)