备注
您正在阅读 MMClassification 0.x 版本的文档。MMClassification 0.x 会在 2022 年末被切换为次要分支。建议您升级到 MMClassification 1.0 版本,体验更多新特性和新功能。请查阅 MMClassification 1.0 的安装教程、迁移教程以及更新日志。
mmcls.models.MlpMixer¶
- class mmcls.models.MlpMixer(arch='base', img_size=224, patch_size=16, out_indices=- 1, drop_rate=0.0, drop_path_rate=0.0, norm_cfg={'type': 'LN'}, act_cfg={'type': 'GELU'}, patch_cfg={}, layer_cfgs={}, init_cfg=None)[源代码]¶
Mlp-Mixer backbone.
Pytorch implementation of MLP-Mixer: An all-MLP Architecture for Vision
- 参数
MLP Mixer architecture. If use string, choose from ‘small’, ‘base’ and ‘large’. If use dict, it should have below keys:
embed_dims (int): The dimensions of embedding.
num_layers (int): The number of MLP blocks.
tokens_mlp_dims (int): The hidden dimensions for tokens FFNs.
channels_mlp_dims (int): The The hidden dimensions for channels FFNs.
Defaults to ‘base’.
img_size (int | tuple) – The input image shape. Defaults to 224.
patch_size (int | tuple) – The patch size in patch embedding. Defaults to 16.
out_indices (Sequence | int) – Output from which layer. Defaults to -1, means the last layer.
drop_rate (float) – Probability of an element to be zeroed. Defaults to 0.
drop_path_rate (float) – stochastic depth rate. Defaults to 0.
norm_cfg (dict) – Config dict for normalization layer. Defaults to
dict(type='LN')
.act_cfg (dict) – The activation config for FFNs. Default GELU.
patch_cfg (dict) – Configs of patch embeding. Defaults to an empty dict.
layer_cfgs (Sequence | dict) – Configs of each mixer block layer. Defaults to an empty dict.
init_cfg (dict, optional) – Initialization config dict. Defaults to None.