Shortcuts

mmcls.models

The models package contains several sub-packages for addressing the different components of a model.

  • classifiers: The top-level module which defines the whole process of a classification model.

  • backbones: Usually a feature extraction network, e.g., ResNet, MobileNet.

  • necks: The component between backbones and heads, e.g., GlobalAveragePooling.

  • heads: The component for specific tasks. In MMClassification, we provides heads for classification.

  • losses: Loss functions.

  • utils: Some helper functions and common components used in various networks.

Build Functions

build_classifier

Build classifier.

build_backbone

Build backbone.

build_neck

Build neck.

build_head

Build head.

build_loss

Build loss.

Classifiers

BaseClassifier

Base class for classifiers.

ImageClassifier

Image classifiers for supervised classification task.

TimmClassifier

Image classifiers for pytorch-image-models (timm) model.

HuggingFaceClassifier

Image classifiers for HuggingFace model.

Backbones

AlexNet

AlexNet backbone.

CSPDarkNet

CSP-Darknet backbone used in YOLOv4.

CSPNet

The abstract CSP Network class.

CSPResNeXt

CSP-ResNeXt backbone.

CSPResNet

CSP-ResNet backbone.

Conformer

Conformer backbone.

ConvMixer

ConvMixer.

ConvNeXt

ConvNeXt.

DaViT

DaViT.

DeiT3

DeiT3 backbone.

DenseNet

DenseNet.

DistilledVisionTransformer

Distilled Vision Transformer.

EdgeNeXt

EdgeNeXt.

EfficientFormer

EfficientFormer.

EfficientNet

EfficientNet backbone.

HorNet

HorNet backbone.

HRNet

HRNet backbone.

InceptionV3

Inception V3 backbone.

LeNet5

LeNet5 backbone.

MViT

Multi-scale ViT v2.

MlpMixer

Mlp-Mixer backbone.

MobileNetV2

MobileNetV2 backbone.

MobileNetV3

MobileNetV3 backbone.

MobileOne

MobileOne backbone.

MobileViT

MobileViT backbone.

PCPVT

The backbone of Twins-PCPVT.

PoolFormer

PoolFormer.

RegNet

RegNet backbone.

RepLKNet

RepLKNet backbone.

RepMLPNet

RepMLPNet backbone.

RepVGG

RepVGG backbone.

Res2Net

Res2Net backbone.

ResNeSt

ResNeSt backbone.

ResNeXt

ResNeXt backbone.

ResNet

ResNet backbone.

ResNetV1c

ResNetV1c backbone.

ResNetV1d

ResNetV1d backbone.

ResNet_CIFAR

ResNet backbone for CIFAR.

SEResNeXt

SEResNeXt backbone.

SEResNet

SEResNet backbone.

SVT

The backbone of Twins-SVT.

ShuffleNetV1

ShuffleNetV1 backbone.

ShuffleNetV2

ShuffleNetV2 backbone.

SwinTransformer

Swin Transformer.

SwinTransformerV2

Swin Transformer V2.

T2T_ViT

Tokens-to-Token Vision Transformer (T2T-ViT)

TIMMBackbone

Wrapper to use backbones from timm library.

TNT

Transformer in Transformer.

VAN

Visual Attention Network.

VGG

VGG backbone.

VisionTransformer

Vision Transformer.

Necks

GlobalAveragePooling

Global Average Pooling neck.

GeneralizedMeanPooling

Generalized Mean Pooling neck.

HRFuseScales

Fuse feature map of multiple scales in HRNet.

Heads

ClsHead

Classification head.

LinearClsHead

Linear classifier head.

StackedLinearClsHead

Classifier head with several hidden fc layer and a output fc layer.

VisionTransformerClsHead

Vision Transformer classifier head.

EfficientFormerClsHead

EfficientFormer classifier head.

DeiTClsHead

Distilled Vision Transformer classifier head.

ConformerHead

Linear classifier head.

ArcFaceClsHead

ArcFace classifier head.

MultiLabelClsHead

Classification head for multilabel task.

MultiLabelLinearClsHead

Linear classification head for multilabel task.

CSRAClsHead

Class-specific residual attention classifier head.

Losses

CrossEntropyLoss

Cross entropy loss.

LabelSmoothLoss

Initializer for the label smoothed cross entropy loss.

FocalLoss

Focal loss.

AsymmetricLoss

asymmetric loss.

SeesawLoss

Implementation of seesaw loss.

models.utils

This package includes some helper functions and common components used in various networks.

Common Components

InvertedResidual

Inverted Residual Block.

SELayer

Squeeze-and-Excitation Module.

WindowMSA

Window based multi-head self-attention (W-MSA) module with relative position bias.

WindowMSAV2

Window based multi-head self-attention (W-MSA) module with relative position bias.

ShiftWindowMSA

Shift Window Multihead Self-Attention Module.

MultiheadAttention

Multi-head Attention Module.

ConditionalPositionEncoding

The Conditional Position Encoding (CPE) module.

PatchEmbed

Image to Patch Embedding.

PatchMerging

Merge patch feature map.

HybridEmbed

CNN Feature Map Embedding.

LayerScale

LayerScale layer.

Helper Functions

channel_shuffle

Channel Shuffle operation.

make_divisible

Make divisible function.

resize_pos_embed

Resize pos_embed weights.

resize_relative_position_bias_table

Resize relative position bias table.

to_ntuple

A to_tuple function generator.

is_tracing

Determine whether the model is called during the tracing of code with torch.jit.trace.

Read the Docs v: 1.x
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.