# torchvision

> PyTorch's computer-vision library: datasets, model architectures and transforms

- Category: Multimodal Generation / Vision & Understanding
- Language: Python
- Licence: BSD-3-Clause
- Repository: https://github.com/pytorch/vision
- Website: https://pytorch.org/vision/stable/index.html
- Canonical page: https://ai-tldr.dev/tools/torchvision/

## In short

torchvision is the computer-vision companion package to PyTorch, maintained in the PyTorch organisation itself. It consists of three things developers reach for constantly: popular vision datasets with loaders, model architectures with pre-trained weights, and the common image transformations used to prepare data for them. It sits in the Vision & Understanding category of the Multimodal Generation tools and is open-source, written in Python and licensed BSD-3-Clause.

## Overview

torchvision is the computer-vision companion package to PyTorch, maintained in the PyTorch organisation itself. It consists of three things developers reach for constantly: popular vision datasets with loaders, model architectures with pre-trained weights, and the common image transformations used to prepare data for them.

Its role in the ecosystem is to be the layer you do not have to write. Instead of hand-rolling a dataset downloader, re-implementing a classification or detection backbone, or reimplementing resize/crop/normalize pipelines, you import them — and because everything speaks native torch tensors, the pieces compose with the rest of a PyTorch training loop without conversion glue. Transforms operate on torch tensors and on PIL images, with Pillow or the faster drop-in Pillow-SIMD as the image backend.

Versions are pinned to PyTorch releases: torchvision 0.28 pairs with torch 2.13, 0.27 with 2.12, 0.26 with 2.11 and 0.25 with 2.10, all supporting Python 3.10 through 3.14. Two licensing caveats are worth knowing: torchvision downloads public datasets but does not host or license them, and some pre-trained weights carry their own terms — the SWAG models, for instance, are released under CC-BY-NC 4.0 rather than the package's BSD-3-Clause licence.

## What it does

- Loaders for popular public vision datasets, with download and preparation handled for you
- Reference implementations of widely used model architectures, many with pre-trained weights
- Common image transformations (resize, crop, normalize, augmentation) that run on torch tensors and PIL images
- Multiple image backends: torch tensors, Pillow, and the SIMD-accelerated Pillow-SIMD drop-in replacement
- Version matrix pinned to PyTorch releases so torch/torchvision/Python combinations are unambiguous
- Full API documentation published alongside the PyTorch docs

## Getting started

torchvision is installed together with PyTorch. The project points to the official PyTorch install selector rather than a single pip line, because the right wheel depends on your OS, package manager and CUDA version.

1. Install torch and torchvision together

   Follow the official instructions at pytorch.org/get-started/locally to pick the wheel matching your platform and accelerator. Check the README's compatibility table to confirm which torchvision version pairs with your torch version — for example torchvision 0.28 with torch 2.13.

2. Verify the install

   Import the package and print its version to confirm the pairing is what you expect.

```python
import torch, torchvision
print(torch.__version__, torchvision.__version__)
```

3. Read the API docs

   The full reference — datasets, models, transforms and ops — lives at pytorch.org/vision/stable/index.html, with a dedicated transforms guide at pytorch.org/vision/stable/transforms.html.

4. Build from source (contributors)

   To develop against torchvision, follow the development-installation section of the repository's CONTRIBUTING guide rather than installing the published wheel.

```bash
git clone https://github.com/pytorch/vision.git
cd vision
```

## When to use it

- Fine-tune a pre-trained classification or detection backbone instead of training a vision model from scratch
- Load a standard benchmark dataset with one line while prototyping or reproducing a paper
- Assemble a reproducible image augmentation and preprocessing pipeline that runs directly on torch tensors
- Provide the vision layer under a multimodal PyTorch model, alongside text or audio encoders
