Repolode
huggingface

huggingface/pytorch-image-models

PyTorch library of image model architectures, pretrained weights, and training, validation, and export scripts for computer vision tasks.

Stars
37,232
Forks
5,217
Open issues
18
Last commit
16 hours ago

What is it?

PyTorch Image Models (timm) is a Python library that collects a large number of image encoders and backbones, such as ResNet, EfficientNet, Vision Transformer (ViT), Swin Transformer, ConvNeXt, and MobileNet variants, many with pretrained weights. Models are created by name through a common factory, so the same code can load a ResNet or a ViT and use it for classification or as a feature extractor.

Beyond the models, the repository includes optimizers, learning rate schedulers, data augmentations such as RandAugment, Mixup and CutMix, and reference scripts for training, validation, and inference. Models share a consistent interface for swapping the classifier, extracting features, and producing multi-scale feature pyramids.

The project is aimed at researchers and engineers who want to reuse or benchmark vision backbones in PyTorch, or reproduce ImageNet training results. Pretrained weights are published through the Hugging Face Hub, and the library is licensed under Apache 2.0, with the note that ImageNet-trained weights carry the dataset's non-commercial terms.

Key features

  • 01Hundreds of image architectures including ResNet, EfficientNet, ViT, Swin, ConvNeXt and MobileNet, many with pretrained weights.
  • 02Create any supported model by name through a common factory function.
  • 03Built-in optimizers such as AdamW variants, Lion, and Muon, plus learning rate schedulers.
  • 04Data augmentations including RandAugment, AugMix, Mixup and CutMix.
  • 05Reference scripts for training, validation, and inference, with distributed multi-GPU support.
  • 06Consistent API for swapping classifiers and extracting multi-scale feature maps.

Use cases

  • Fine-tuning a pretrained ViT or ConvNeXt on a custom image classification dataset.
  • Using a backbone as a feature extractor for detection or segmentation pipelines.
  • Benchmarking different architectures under the same training and evaluation setup.
  • Reproducing ImageNet training results or exporting models for deployment.

Quick start

  1. 1

    Install the library from PyPI

    pip install timm
  2. 2

    Create a pretrained model and run inference via the README's quick example

Things to know

  • Requires PyTorch to be installed separately for it to run.
  • Some model variants and weights depend on recent PyTorch versions.

Topics

FAQ

What is pytorch-image-models?
PyTorch library of image model architectures, pretrained weights, and training, validation, and export scripts for computer vision tasks. PyTorch Image Models (timm) is a Python library that collects a large number of image encoders and backbones, such as ResNet, EfficientNet, Vision Transformer (ViT), Swin Transformer, ConvNeXt, and MobileNet variants, many with pretrained weights. Models are created by name through a common factory, so the same code can load a ResNet or a ViT and use it for classification or as a feature extractor.
Is pytorch-image-models free to use? What license does it have?
pytorch-image-models is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is pytorch-image-models still maintained?
Actively maintained. The last commit to pytorch-image-models was on Oct 20, 2026.
What can I use pytorch-image-models for?
Fine-tuning a pretrained ViT or ConvNeXt on a custom image classification dataset. Using a backbone as a feature extractor for detection or segmentation pipelines. Benchmarking different architectures under the same training and evaluation setup. Reproducing ImageNet training results or exporting models for deployment.
How do I install pytorch-image-models?
Install the library from PyPI: pip install timm Create a pretrained model and run inference via the README's quick example
Where can I get pytorch-image-models?
The source code and installation instructions are on GitHub: https://github.com/huggingface/pytorch-image-models

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects