Getting Started

Welcome

Welcome to the timm documentation, a lean set of docs that covers the basics of timm.

For a more comprehensive set of docs (currently under development), please visit timmdocs by Aman Arora.

Install

The library can be installed with pip:

pip install timm

I update the PyPi (pip) packages when I’m confident there are no significant model regressions from previous releases. If you want to pip install the bleeding edge from GitHub, use:

pip install git+https://github.com/rwightman/pytorch-image-models.git

Conda Environment

I’ve tried to keep the dependencies minimal, the setup is as per the PyTorch default install instructions for Conda:

conda create -n torch-env
conda activate torch-env
conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
conda install pyyaml

Load a Pretrained Model

Pretrained models can be loaded using timm.create_model

>>> import timm

>>> m = timm.create_model('mobilenetv3_large_100', pretrained=True)
>>> m.eval()

List Models with Pretrained Weights

>>> import timm
>>> from pprint import pprint
>>> model_names = timm.list_models(pretrained=True)
>>> pprint(model_names)
[
    'adv_inception_v3',
    'cspdarknet53',
    'cspresnext50',
    'densenet121',
    'densenet161',
    'densenet169',
    'densenet201',
    'densenetblur121d',
    'dla34',
    'dla46_c',
]

List Model Architectures by Wildcard

>>> import timm
>>> from pprint import pprint
>>> model_names = timm.list_models('*resne*t*')
>>> pprint(model_names)
[
    'cspresnet50',
    'cspresnet50d',
    'cspresnet50w',
    'cspresnext50',
    ...
]