vision

PyTorch's official library for datasets, pretrained models, and image transformations in computer vision.

Library
PyPI
v0.29.0
17,898stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
95/100Excellent
Development Activity100
Maintenance84
Community96
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
88/100Excellent
Architecture90
Code Quality92
Innovation78
Learning Curve90

torchvision is the official companion library to PyTorch for computer vision work. It bundles ready-to-use datasets, a large catalog of pretrained model architectures spanning classification, detection, segmentation, and video understanding, and a transforms system for preprocessing and augmenting images before they reach a model.

The library sits at the seam between raw image data and PyTorch tensors: torchvision.datasets wraps popular benchmark datasets behind a consistent Dataset interface, torchvision.models exposes architectures like ResNet, ConvNeXt, Vision Transformer, and Faster R-CNN with optional pretrained weights, and torchvision.transforms (with the newer transforms.v2 API) handles resizing, cropping, normalization, and augmentation for both images and their associated bounding boxes or masks. A torchvision.ops module adds vision-specific primitives such as RoI Align, non-max suppression, and focal loss that aren’t part of core PyTorch.

Because it ships from the PyTorch team and is version-pinned to specific PyTorch releases, torchvision is the default starting point for nearly any PyTorch vision project, from quick prototyping notebooks to production training pipelines.

What You Get

  • Dozens of pretrained model architectures (ResNet, ConvNeXt, EfficientNet, Vision Transformer, Faster/Mask R-CNN, DeepLab) accessible via torchvision.models with a unified weights-enum API
  • Built-in wrappers for standard vision datasets (ImageNet, COCO, CIFAR, VOC, Cityscapes, and dozens more) that return PyTorch Dataset objects out of the box
  • A transforms pipeline (transforms and the newer transforms.v2) for resizing, cropping, color jitter, and augmentation that works consistently across images, bounding boxes, masks, and video
  • Vision-specific tensor operators in torchvision.ops — RoI Align/Pool, non-max suppression, deformable convolution, IoU losses — used internally by detection and segmentation models
  • Image and video I/O utilities (torchvision.io) for decoding JPEG/PNG/WebP and reading video frames directly into tensors without going through PIL

Common Use Cases

  • Fine-tuning a pretrained ResNet or ViT backbone on a custom image classification dataset
  • Building an object detection pipeline with Faster R-CNN or RetinaNet plus torchvision’s box/NMS operators
  • Loading a standard benchmark dataset (ImageNet, COCO, CIFAR-10) for reproducing or comparing against published results
  • Composing a training-time data augmentation pipeline with transforms.v2 that transforms images and their labels/boxes/masks together
  • Extracting intermediate feature maps from a torchvision backbone for a downstream task via feature_extraction

Under The Hood

Architecture The package is organized into clearly separated submodules that mirror the CV pipeline itself: datasets (data loading), transforms/transforms.v2 (preprocessing and augmentation, built around a tv_tensors abstraction that tags tensors as images, bounding boxes, or masks so a single transform call can update all of them together), models (architectures plus a register_model/Weights enum system for pretrained-weight discovery), ops (CUDA-backed vision primitives like RoI Align and NMS that back the detection/segmentation models), and io (image/video decoding). Base classes such as VisionDataset in datasets/vision.py define a small, consistent contract (__getitem__, __len__, optional transforms) that every dataset wrapper implements, and models are composed from shared building blocks (e.g. BasicBlock/Bottleneck in resnet.py) rather than duplicated per-architecture. Swapping the transform system (v1 to v2) or extending the model registry does not require touching dataset or ops code, indicating deliberate layering rather than incidental separation.

Tech Stack Written primarily in Python (about 88% of the codebase) with substantial C++/CUDA extensions (roughly 10% combined) compiled via torch.utils.cpp_extension for performance-critical operators and image/video codecs. Built with setuptools and CMake for the native extensions, with a hard runtime dependency on a matching torch release (the README documents an explicit torch-to-torchvision version compatibility table). Uses Pillow (or Pillow-SIMD) as its default PIL-backed image backend, with optional GPU-accelerated NVJPEG decoding and support for JPEG/PNG/WebP via native decoders. No web framework or database involved — this is a pure computational/data library.

Code Quality Extensive automated testing lives under test/, covering datasets, transforms, models, ops, and even C++ extension code (test/cpp), run through pytest with strict xfail handling (xfail_strict = True) and dedicated CI workflows per platform (Linux, Windows, ARM64, macOS). Type checking is enforced via mypy.ini, though several performance-critical submodules (ops, models, low-level transform internals) are explicitly exempted with ignore_errors = True, a pragmatic tradeoff rather than an oversight. Style is enforced through a .pre-commit-config.yaml running ufmt (black + usort), flake8, pydocstyle, and clang-format for the C++ sources, backed by dedicated lint.yml and tests.yml GitHub Actions workflows. This reflects a mature, actively maintained testing and linting posture typical of a foundational PyTorch ecosystem package.

What Makes It Unique torchvision’s distinguishing trait isn’t a novel algorithm but its role as the canonical, version-synchronized vision extension to PyTorch itself — its tv_tensors-based transforms system solves a real, recurring pain point (keeping augmentations consistent across an image and its associated boxes/masks/video frames) that most ad hoc vision codebases solve inconsistently or not at all. Its CUDA-backed ops module also centralizes detection/segmentation primitives (RoI Align, deformable convolution) that would otherwise be reimplemented per-project, and its pretrained model registry gives a single consistent interface across dozens of architecture families rather than each model shipping its own weight-loading convention.

Used by 10 apps in this directory

Python
91%
Apache 2.0

ART

AI Development

10,703

Give your LLM agents on-the-job training—ART lets you apply GRPO reinforcement learning to any multi-step agentic workflow with minimal code changes.

View details
84
Repo Health
82
Technical
73
Dependency
Built with
Python91%
Updated 2 days ago
Python
100%
Apache 2.0

ClearML

Devops · Automation

6,858

Auto-magical MLOps platform that tracks experiments, versions data, orchestrates pipelines, and serves models with just two lines of code.

View details
95
Repo Health
79
Technical
67
Dependency
Built with
Python100%
Updated yesterday
Go
59%
Apache 2.0

Cog

AI Development · Devops · Developer Tools

9,468

An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.

View details
89
Repo Health
88
Technical
69
Dependency
Built with
Go59%
Rust17%
HTML13%
Updated 5 days ago
Python
100%
GPL 3.0

ComfyUI

AI Design Tools · AI Development

131,801

The most powerful node-based AI workflow engine for creating images, video, 3D models, and audio with full control over every generation step.

View details
92
Repo Health
81
Technical
75
Dependency
Built with
Python100%
Updated today
Python
68%
MIT

Langflow

AI Agents · AI Development

154,349

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today
Python
67%
Other

Morphik

AI Development · Search · Databases

3,710

Morphik is an AI-native ingestion and retrieval engine that lets developers store, search, and reason over visually rich documents — scanned PDFs, manuals, slides, and video — without duct-taping together OCR, an embedding model, and a vector database.

View details
61
Repo Health
71
Technical
67
Dependency
Built with
Python67%
TypeScript25%
Updated 3 days ago
Rust
63%
MIT

PostgresML

Databases · AI Development

6,819

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust63%
JavaScript11%
Updated 1 years ago
Python
86%
Apache 2.0

PrivateGPT

AI Development

57,494

The open-source API layer that turns local LLMs into production private AI applications with full Claude API compatibility

View details
87
Repo Health
83
Technical
69
Dependency
Built with
Python86%
HTML10%
Updated 4 days ago
Python
70%
Apache 2.0

SurfSense

Search · AI Assistants

16,103

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
88
Repo Health
71
Technical
66
Dependency
Built with
Python70%
TypeScript28%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search