TorchVision ships a comprehensive model zoo covering six computer vision task families, each with pre-trained weights, built-in preprocessing transforms, and a unified loading API. Whether you need a lightweight classifier for edge deployment, a Faster R-CNN detector for production, or a video-understanding backbone,Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pytorch/vision/llms.txt
Use this file to discover all available pages before exploring further.
torchvision.models provides ready-to-use architectures that follow a consistent weights= convention introduced in v0.13.
Model Categories
TorchVision organises its models into six task-oriented submodules:Classification
Image-level labels on ImageNet-1K. Includes ResNet, EfficientNet, ViT, Swin Transformer, ConvNeXt, MaxViT, and more.
Detection
Object detection and instance segmentation. Faster R-CNN, FCOS, RetinaNet, SSD, Mask R-CNN, and Keypoint R-CNN.
Segmentation
Pixel-wise semantic segmentation. FCN, DeepLabV3, and LR-ASPP trained on COCO/VOC.
Video
Spatio-temporal action recognition on Kinetics-400. R3D, MC3, R(2+1)D, MViT, S3D, and Swin3D.
Optical Flow
Dense motion estimation between frames. RAFT with pre-trained weights on synthetic and real datasets.
Quantized
INT8 quantized versions of popular classifiers for efficient CPU inference. Includes quantized ResNet, MobileNet, and more.
The Model Registry API
Starting in v0.14, TorchVision maintains a global registry of all model builder functions. Theget_model and list_models helpers let you work with models by string name — useful for configuration-driven training scripts and hyperparameter sweeps.
list_models parameters
| Parameter | Type | Description |
|---|---|---|
module | ModuleType, optional | Filter to models defined in this module (e.g. torchvision.models for classifiers only). |
include | str or Iterable[str], optional | Unix shell-style wildcard pattern(s). The result is the union of all matching sets. |
exclude | str or Iterable[str], optional | Wildcard pattern(s) applied after include. Models matching any exclude filter are removed. |
get_model parameters
| Parameter | Type | Description |
|---|---|---|
name | str | The registered model name (case-insensitive). |
**config | Any | Any keyword argument accepted by the underlying builder, such as weights, num_classes, or progress. |
The weights= Parameter
Every model builder in TorchVision accepts a weights keyword argument that controls pre-trained weight loading. The value can be a WeightsEnum member, a plain string shorthand, or None.
WeightsEnum entry bundles the checkpoint URL, preprocessing transforms, and metadata (accuracy, parameter count, training recipe link) together. See the Weights API page for a full breakdown.
Common Usage Patterns
Inference
Load weights and model
Instantiate the model with the best available weights and switch to evaluation mode to disable dropout and freeze batch-norm statistics.
Build the preprocessing pipeline
Retrieve the preprocessing transforms that were used during training — they are bundled directly onto the weights object so they always match the checkpoint.
Fine-Tuning for a Custom Task
Transfer learning from ImageNet weights is one of the most common workflows in computer vision. The pattern below freezes the backbone and replaces only the classification head:When you replace
model.fc, the new nn.Linear has requires_grad=True by default, so only the new head will receive gradient updates from the frozen-backbone loop above.model.parameters() to the optimizer with a small learning rate (e.g. 1e-4).
Loading by String Name (Config-Driven)
When building configurable training pipelines, load models entirely by name:PyTorch Hub
Most TorchVision classifiers can be loaded directly throughtorch.hub without installing the full TorchVision package:
Detection models (
torchvision.models.detection) require TorchVision to be installed locally because they depend on custom C++ operators that are not shipped via Hub.Cache & Environment
Pre-trained weights are downloaded to a local cache on first use. Set theTORCH_HOME environment variable to control the cache directory:
torch.hub.load_state_dict_from_url, so proxy settings and SSL configuration follow the standard PyTorch hub conventions.