timm
**timm (PyTorch Image Models)** is a **comprehensive library of pre-trained computer vision models created by Ross Wightman that serves as the "Hugging Face of Computer Vision"** — providing 800+ model architectures (Vision Transformers, EfficientNets, ConvNeXt, Swin, DeiT, NFNet, and more) with ImageNet-pretrained weights, a consistent API across all models, and the training recipes needed to reproduce state-of-the-art image classification results, filling the gap left by PyTorch's limited torchvision model zoo.
**What Is timm?**
- **Definition**: An open-source Python library (`pip install timm`) that provides a unified interface to hundreds of image classification model architectures with pre-trained weights — where `torchvision` offers ~20 models, timm offers 800+ with consistent `forward_features()` and `forward_head()` methods.
- **Creator**: Ross Wightman (rwightman) — an independent researcher who single-handedly implemented, trained, and benchmarked hundreds of vision architectures, making timm one of the most impactful individual contributions to the ML ecosystem.
- **Pretrained Weights**: 99% of models come with ImageNet-1k or ImageNet-21k pretrained weights — many models have multiple weight versions (different training recipes, resolutions, or datasets).
- **Consistent API**: Every model in timm shares the same interface — `model = timm.create_model("vit_base_patch16_224", pretrained=True)` works for any of the 800+ architectures, making it trivial to swap models in experiments.
- **HuggingFace Integration**: timm models are available on the Hugging Face Hub — `timm.create_model("hf_hub:timm/vit_base_patch16_224.augreg_in21k")` loads models directly from the Hub with version tracking.
**Key Model Families in timm**
| Family | Architecture | Key Models | ImageNet Top-1 |
|--------|-------------|-----------|----------------|
| Vision Transformer | Transformer | ViT-B/16, ViT-L/16, ViT-H/14 | 85-88% |
| EfficientNet | CNN (NAS) | EfficientNet-B0 to B7, V2 | 77-87% |
| ConvNeXt | Modern CNN | ConvNeXt-T/S/B/L/XL | 82-87% |
| Swin Transformer | Shifted window | Swin-T/S/B/L | 81-87% |
| DeiT | Data-efficient ViT | DeiT-S/B, DeiT III | 80-86% |
| ResNet | Classic CNN | ResNet-50/101/152, ResNetV2 | 76-82% |
| NFNet | Normalizer-free | NFNet-F0 to F6 | 83-87% |
| MaxViT | Multi-axis ViT | MaxViT-T/S/B | 83-87% |
**Why timm Matters**
- **Backbone Provider**: timm is the standard source of pretrained backbones for detection (MMDetection, Detectron2), segmentation (mmsegmentation), and other downstream tasks — most CV research starts with a timm backbone.
- **Training Recipes**: timm includes the exact training configurations (augmentation, optimizer, learning rate schedule) used to achieve published accuracy numbers — enabling reproducible research.
- **Feature Extraction**: `model.forward_features(x)` returns intermediate feature maps — essential for using timm models as backbones in detection, segmentation, and other tasks that need multi-scale features.
- **Rapid Experimentation**: Swap `resnet50` for `convnext_base` or `swin_base_patch4_window7_224` with a single string change — timm's consistent API makes architecture search trivial.
**timm is the essential computer vision model library that provides the pretrained backbones powering most modern CV research and applications** — offering 800+ architectures with consistent APIs and pretrained weights that make it the first dependency added to any PyTorch computer vision project.