Shortcuts

mmpretrain.apis.list_models

mmpretrain.apis.list_models(pattern=None, exclude_patterns=None, task=None)[source]

List all models available in MMPretrain.

Parameters:
  • pattern (str | None) – A wildcard pattern to match model names. Defaults to None.

  • exclude_patterns (list | None) – A list of wildcard patterns to exclude names from the matched names. Defaults to None.

  • task (str | none) – The evaluation task of the model.

Returns:

a list of model names.

Return type:

List[str]

Examples

List all models:

>>> from mmpretrain import list_models
>>> list_models()

List ResNet-50 models on ImageNet-1k dataset:

>>> from mmpretrain import list_models
>>> list_models('resnet*in1k')
['resnet50_8xb32_in1k',
 'resnet50_8xb32-fp16_in1k',
 'resnet50_8xb256-rsb-a1-600e_in1k',
 'resnet50_8xb256-rsb-a2-300e_in1k',
 'resnet50_8xb256-rsb-a3-100e_in1k']

List Swin-Transformer models trained from stratch and exclude Swin-Transformer-V2 models:

>>> from mmpretrain import list_models
>>> list_models('swin', exclude_patterns=['swinv2', '*-pre'])
['swin-base_16xb64_in1k',
 'swin-base_3rdparty_in1k',
 'swin-base_3rdparty_in1k-384',
 'swin-large_8xb8_cub-384px',
 'swin-small_16xb64_in1k',
 'swin-small_3rdparty_in1k',
 'swin-tiny_16xb64_in1k',
 'swin-tiny_3rdparty_in1k']

List all EVA models for image classification task.

>>> from mmpretrain import list_models
>>> list_models('eva', task='Image Classification')
['eva-g-p14_30m-in21k-pre_3rdparty_in1k-336px',
 'eva-g-p14_30m-in21k-pre_3rdparty_in1k-560px',
 'eva-l-p14_mim-in21k-pre_3rdparty_in1k-196px',
 'eva-l-p14_mim-in21k-pre_3rdparty_in1k-336px',
 'eva-l-p14_mim-pre_3rdparty_in1k-196px',
 'eva-l-p14_mim-pre_3rdparty_in1k-336px']