mmclassification/mmcls/models/backbones/__init__.py

118 lines
2.8 KiB
Python
Raw Normal View History

# Copyright (c) OpenMMLab. All rights reserved.
2020-07-08 10:48:08 +08:00
from .alexnet import AlexNet
from .beit import BEiT
from .conformer import Conformer
from .convmixer import ConvMixer
from .convnext import ConvNeXt
from .cspnet import CSPDarkNet, CSPNet, CSPResNet, CSPResNeXt
from .davit import DaViT
from .deit import DistilledVisionTransformer
from .deit3 import DeiT3
from .densenet import DenseNet
from .edgenext import EdgeNeXt
from .efficientformer import EfficientFormer
from .efficientnet import EfficientNet
[Feature] [CodeCamp #68] Add EfficientnetV2 Backbone. (#1253) * add efficientnet_v2.py * add efficientnet_v2 in __init__.py * add efficientnet_v2_s base config file * add efficientnet_v2 config file * add efficientnet_v2 config file * update tuple output * update config file * update model file * update model file * update model file * update config file * update model file * update config file * update model file * update model file * update model file * update model file * update model file * update config file * update config file * update model file * update model file * update model file * update model file * update model config file * Update efficientnet_v2.py * add config file and modify arch * add config file and modify arch * add the file about convert_pth from timm to mmcls * update efficientnetv2 model file with mmcls style * add the file about convert_pth from timm to mmcls * add the file about convert_pth from timm to mmcls * update convert file * update model file * update convert file * update model file * update model file * update model file * add metefile and README * Update tools/model_converters/efficientnetv2-timm_to_mmcls.py Co-authored-by: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com> * update model file and convert file * update model file and convert file * update model file and convert file * update model file and convert file * update model file * update model file * update model file * update config file and README file * update metafile * Update efficientnetv2_to_mmcls.py * update model-index.yml * update metafile.yml * update b0 and s train pipeline * update b0 and s train pipeline * update b0 and s train pipeline * add test_efficientnet_v2 * update test_efficientnet_v2 * update model file docs * update test_efficientnet_v2 * update test_efficientnet_v2 * add efficientnet_v2.py * add efficientnet_v2 in __init__.py * add efficientnet_v2_s base config file * add efficientnet_v2 config file * add efficientnet_v2 config file * update tuple output * update config file * update model file * update model file * update model file * update model file * update config file * update config file * update model file * update model file * update model file * update model file * update model file * update config file * update config file * update model file * update model file * update model file * update model file * update model config file * Update efficientnet_v2.py * add config file and modify arch * add config file and modify arch * add the file about convert_pth from timm to mmcls * update efficientnetv2 model file with mmcls style * add the file about convert_pth from timm to mmcls * add the file about convert_pth from timm to mmcls * update convert file * update model file * update convert file * update model file * update model file * update model file * add metefile and README * Update tools/model_converters/efficientnetv2-timm_to_mmcls.py Co-authored-by: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com> * update model file and convert file * update model file and convert file * update model file and convert file * update model file and convert file * update model file * update model file * update model file * update config file and README file * update metafile * Update efficientnetv2_to_mmcls.py * update model-index.yml * update metafile.yml * update b0 and s train pipeline * update b0 and s train pipeline * update b0 and s train pipeline * add test_efficientnet_v2 * update test_efficientnet_v2 * update model file docs * update test_efficientnet_v2 * update test_efficientnet_v2 * pass pre-commit hook * refactor efficientnetv2 * refactor efficientnetv2 * update readme, metafile and weight links * update model-index.yml * fix lint * fix typo * Update efficientnetv2-b1_8xb32_in1k.py * Update efficientnetv2-b2_8xb32_in1k.py * Update efficientnetv2-b3_8xb32_in1k.py * update two moduals and model file * update modual file * update accuracys * update accuracys * update metafile * fix build docs * update links * update README.md Co-authored-by: qingtian <459291290@qq.com> Co-authored-by: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com>
2022-12-30 15:18:39 +08:00
from .efficientnet_v2 import EfficientNetV2
from .hornet import HorNet
from .hrnet import HRNet
2022-07-12 16:10:59 +08:00
from .inception_v3 import InceptionV3
2020-07-08 10:48:08 +08:00
from .lenet import LeNet5
[Feature] Support LeViT backbone. (#1238) * 网络搭建完成、能正常推理 * 网络搭建完成、能正常推理 * 网络搭建完成、能正常推理 * 添加了模型转换未验证,配置文件 但有无法运行 * 模型转换、结构验证完成,可以推理出正确答案 * 推理精度与原论文一致 已完成转化 * 三个方法改为class 暂存 * 完成推理精度对齐 误差0.04 * 暂时使用的levit2mmcls * 训练跑通,训练相关参数未对齐 * '训练相关参数对齐'参数' * '修复训练时验证导致模型结构改变无法复原问题' * '修复训练时验证导致模型结构改变无法复原问题' * '添加mixup和labelsmooth' * '配置文件补齐' * 添加模型转换 * 添加meta文件 * 添加meta文件 * 删除demo.py测试文件 * 添加模型README文件 * docs文件回滚 * model-index删除末行空格 * 更新模型metafile * 更新metafile * 更新metafile * 更新README和metafile * 更新模型README * 更新模型metafile * Delete the model class and get_LeViT_model methods in the mmcls.models.backone.levit file * Change the class name to Google Code Style * use arch to provide default architectures * use nn.Conv2d * mmcv.cnn.fuse_conv_bn * modify some details * remove down_ops from the architectures. * remove init_weight function * Modify ambiguous variable names * Change the drop_path in config to drop_path_rate * Add unit test * remove train function * add unit test * modify nn.norm1d to build_norm_layer * update metafile and readme * Update configs and LeViT implementations. * Update README. * Add docstring and update unit tests. * Revert irrelative modification. * Fix unit tests * minor fix Co-authored-by: mzr1996 <mzr1996@163.com>
2023-01-17 17:43:42 +08:00
from .levit import LeViT
from .mixmim import MixMIMTransformer
from .mlp_mixer import MlpMixer
2020-06-16 14:37:03 +08:00
from .mobilenet_v2 import MobileNetV2
from .mobilenet_v3 import MobileNetV3
from .mobileone import MobileOne
from .mobilevit import MobileViT
from .mvit import MViT
from .poolformer import PoolFormer
2020-07-01 14:21:45 +08:00
from .regnet import RegNet
from .replknet import RepLKNet
from .repmlp import RepMLPNet
[Feature] Add RepVGG backbone and checkpoints. (#414) * Add RepVGG code. * Add se_module as plugin. * Add the repvggA0 primitive config * Change repvggA0.py to fit mmcls * Add RepVGG configs * Add repvgg_to_mmcls * Add tools/deployment/convert_repvggblock_param_to_deploy.py * Change configs/repvgg/README.md * Streamlining the number of configuration files. * Fix lints * Delete plugins * Delete code about plugin. * Modify the code for using se module. * Modify config to fit repvgg with se. * Change se_cfg to allow loading of pre-training parameters. * Reduce the complexity of the configuration file. * Finsh unitest for repvgg. * Fix bug about se in repvgg_to_mmcls. * Rename convert_repvggblock_param_to_deploy.py to reparameterize_repvgg.py, and delete setting about device. * test commit * test commit * test commit command * Modify repvgg.py to make the code more readable. * Add value=0 in F.pad() * Add se_cfg to arch_settings. * Fix bug. * modeify some attr name and Update unit tests * rename stage_0 to stem and branch_identity to branch_norm * update unit tests * add m.eval in unit tests * [Enhance] Enhence SE layer to support custom squeeze channels. (#417) * add enhenced SE * Update * rm basechannel * fix docstring * Update se_layer.py fix docstring * [Docs] Add algorithm readme and update meta yml (#418) * Add README.md for models without checkpoints. * Update model-index.yml * Update metafile.yml of seresnet * [Enhance] Add `hparams` argument in `AutoAugment` and `RandAugment` and some other improvement. (#398) * Add hparams argument in `AutoAugment` and `RandAugment`. And `pad_val` supports sequence instead of tuple only. * Add unit tests for `AutoAugment` and `hparams` in `RandAugment`. * Use smaller test image to speed up uni tests. * Use hparams to simplify RandAugment config in swin-transformer. * Rename augment config name from `pipeline` to `pipelines`. * Add some commnet ad docstring. * [Feature] Support classwise weight in losses (#388) * Add classwise weight in losses:CE,BCE,softBCE * Update unit test * rm some extra code * rm some extra code * fix broadcast * fix broadcast * update unit tests * use new_tensor * fix lint * [Enhance] Better result visualization (#419) * Imporve result visualization to support wait time and change the backend to matplotlib. * Add unit test for visualization * Add adaptive dpi function * Rename `imshow_cls_result` to `imshow_infos`. * Support str in `imshow_infos` * Improve docstring. * Bump version to v0.15.0 (#426) * [CI] Add PyTorch 1.9 and Python 3.9 build workflow, and remove some CI. (#422) * Add PyTorch 1.9 build workflow, and remove some CI. * Add Python 3.9 CI * Show Python 3.9 support. * [Enhance] Rename the option `--options` in some tools to `--cfg-options`. (#425) * [Docs] Fix sphinx version (#429) * [Docs] Add `CITATION.cff` (#428) * Add CITATION.cff * Fix typo in setup.py * Change author in setup.py * modeify some attr name and Update unit tests * rename stage_0 to stem and branch_identity to branch_norm * update unit tests * add m.eval in unit tests * Update unit tests * refactor * refactor * Alignment inference accuracy * Update configs, readme and metafile * Update readme * return tuple and fix metafile * fix unit test * rm regnet and classifiers changes * update auto_aug * update metafile & readme * use delattr * rename cfgs * Update checkpoint url * Update readme * Rename config files. * Update readme and metafile * add comment * Update mmcls/models/backbones/repvgg.py Co-authored-by: Ma Zerun <mzr1996@163.com> * Update docstring * Improve docstring. * Update unittest_testblock Co-authored-by: Ezra-Yu <1105212286@qq.com> Co-authored-by: Ma Zerun <mzr1996@163.com>
2021-09-29 11:06:23 +08:00
from .repvgg import RepVGG
from .res2net import Res2Net
from .resnest import ResNeSt
from .resnet import ResNet, ResNetV1c, ResNetV1d
2020-07-09 14:19:15 +08:00
from .resnet_cifar import ResNet_CIFAR
2020-06-14 12:08:37 +08:00
from .resnext import ResNeXt
from .revvit import RevVisionTransformer
2020-06-17 14:20:20 +08:00
from .seresnet import SEResNet
2020-06-19 11:45:42 +08:00
from .seresnext import SEResNeXt
2020-06-16 14:37:03 +08:00
from .shufflenet_v1 import ShuffleNetV1
from .shufflenet_v2 import ShuffleNetV2
[Feature] Add swin-transformer model. (#271) * Add swin transformer archs S, B and L. * Add SwinTransformer configs * Add train config files of swin. * Align init method with original code * Use nn.Unfold to merge patch * Change all ConfigDict to dict * Add init_cfg for all subclasses of BaseModule. * Use mmcv version init function * Add Swin README * Use safer cfg copy method * Improve docstring and variable name. * Fix some difference in randaug Fix BGR bug, align scheduler config. Fix label smoothing parameter difference. * Fix missing droppath in attn * Fix bug of relative posititon table if window width is not equal to height. * Make `PatchMerging` more general, support kernel, stride, padding and dilation. * Rename `residual` to `identity` in attention and FFN. * Add `auto_pad` option to auto pad feature map * Improve docstring. * Fix bug in ShiftWMSA padding. * Remove unused `key` and `value` in ShiftWMSA * Move `PatchMerging` into utils and use common `PatchEmbed`. * Use latest `LinearClsHead`, train augments and label smooth settings. And remove original `SwinLinearClsHead`. * Mark some configs as "Evalution Only". * Remove useless comment in config * 1. Move ShiftWindowMSA and WindowMSA to `utils/attention.py` 2. Add docstrings of each module. 3. Fix some variables' names. 4. Other small improvement. * Add unit tests of swin-transformer and patchmerging. * Fix some bugs in unit tests. * Fix bug of rel_position_index if window is not square. * Make WindowMSA implicit, and add unit tests. * Add metafile.yml, update readme and model_zoo.
2021-07-01 09:30:42 +08:00
from .swin_transformer import SwinTransformer
from .swin_transformer_v2 import SwinTransformerV2
from .t2t_vit import T2T_ViT
from .timm_backbone import TIMMBackbone
from .tinyvit import TinyViT
from .tnt import TNT
from .twins import PCPVT, SVT
from .van import VAN
from .vgg import VGG
from .vig import PyramidVig, Vig
from .vision_transformer import VisionTransformer
from .xcit import XCiT
2020-06-03 15:51:17 +08:00
2020-06-15 02:16:13 +08:00
__all__ = [
'LeNet5',
'AlexNet',
'VGG',
'RegNet',
'ResNet',
'ResNeXt',
'ResNetV1d',
'ResNeSt',
'ResNet_CIFAR',
'SEResNet',
'SEResNeXt',
'ShuffleNetV1',
'ShuffleNetV2',
'MobileNetV2',
'MobileNetV3',
'VisionTransformer',
'SwinTransformer',
'TNT',
'TIMMBackbone',
'T2T_ViT',
'Res2Net',
'RepVGG',
'Conformer',
'MlpMixer',
'DistilledVisionTransformer',
'PCPVT',
'SVT',
'EfficientNet',
[Feature] [CodeCamp #68] Add EfficientnetV2 Backbone. (#1253) * add efficientnet_v2.py * add efficientnet_v2 in __init__.py * add efficientnet_v2_s base config file * add efficientnet_v2 config file * add efficientnet_v2 config file * update tuple output * update config file * update model file * update model file * update model file * update config file * update model file * update config file * update model file * update model file * update model file * update model file * update model file * update config file * update config file * update model file * update model file * update model file * update model file * update model config file * Update efficientnet_v2.py * add config file and modify arch * add config file and modify arch * add the file about convert_pth from timm to mmcls * update efficientnetv2 model file with mmcls style * add the file about convert_pth from timm to mmcls * add the file about convert_pth from timm to mmcls * update convert file * update model file * update convert file * update model file * update model file * update model file * add metefile and README * Update tools/model_converters/efficientnetv2-timm_to_mmcls.py Co-authored-by: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com> * update model file and convert file * update model file and convert file * update model file and convert file * update model file and convert file * update model file * update model file * update model file * update config file and README file * update metafile * Update efficientnetv2_to_mmcls.py * update model-index.yml * update metafile.yml * update b0 and s train pipeline * update b0 and s train pipeline * update b0 and s train pipeline * add test_efficientnet_v2 * update test_efficientnet_v2 * update model file docs * update test_efficientnet_v2 * update test_efficientnet_v2 * add efficientnet_v2.py * add efficientnet_v2 in __init__.py * add efficientnet_v2_s base config file * add efficientnet_v2 config file * add efficientnet_v2 config file * update tuple output * update config file * update model file * update model file * update model file * update model file * update config file * update config file * update model file * update model file * update model file * update model file * update model file * update config file * update config file * update model file * update model file * update model file * update model file * update model config file * Update efficientnet_v2.py * add config file and modify arch * add config file and modify arch * add the file about convert_pth from timm to mmcls * update efficientnetv2 model file with mmcls style * add the file about convert_pth from timm to mmcls * add the file about convert_pth from timm to mmcls * update convert file * update model file * update convert file * update model file * update model file * update model file * add metefile and README * Update tools/model_converters/efficientnetv2-timm_to_mmcls.py Co-authored-by: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com> * update model file and convert file * update model file and convert file * update model file and convert file * update model file and convert file * update model file * update model file * update model file * update config file and README file * update metafile * Update efficientnetv2_to_mmcls.py * update model-index.yml * update metafile.yml * update b0 and s train pipeline * update b0 and s train pipeline * update b0 and s train pipeline * add test_efficientnet_v2 * update test_efficientnet_v2 * update model file docs * update test_efficientnet_v2 * update test_efficientnet_v2 * pass pre-commit hook * refactor efficientnetv2 * refactor efficientnetv2 * update readme, metafile and weight links * update model-index.yml * fix lint * fix typo * Update efficientnetv2-b1_8xb32_in1k.py * Update efficientnetv2-b2_8xb32_in1k.py * Update efficientnetv2-b3_8xb32_in1k.py * update two moduals and model file * update modual file * update accuracys * update accuracys * update metafile * fix build docs * update links * update README.md Co-authored-by: qingtian <459291290@qq.com> Co-authored-by: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com>
2022-12-30 15:18:39 +08:00
'EfficientNetV2',
'ConvNeXt',
'HRNet',
'ResNetV1c',
'ConvMixer',
'EdgeNeXt',
'CSPDarkNet',
'CSPResNet',
'CSPResNeXt',
'CSPNet',
'RepLKNet',
'RepMLPNet',
'PoolFormer',
'DenseNet',
'VAN',
'InceptionV3',
'MobileOne',
'EfficientFormer',
'SwinTransformerV2',
'MViT',
'DeiT3',
'HorNet',
'MobileViT',
'DaViT',
'BEiT',
'RevVisionTransformer',
'MixMIMTransformer',
'TinyViT',
[Feature] Support LeViT backbone. (#1238) * 网络搭建完成、能正常推理 * 网络搭建完成、能正常推理 * 网络搭建完成、能正常推理 * 添加了模型转换未验证,配置文件 但有无法运行 * 模型转换、结构验证完成,可以推理出正确答案 * 推理精度与原论文一致 已完成转化 * 三个方法改为class 暂存 * 完成推理精度对齐 误差0.04 * 暂时使用的levit2mmcls * 训练跑通,训练相关参数未对齐 * '训练相关参数对齐'参数' * '修复训练时验证导致模型结构改变无法复原问题' * '修复训练时验证导致模型结构改变无法复原问题' * '添加mixup和labelsmooth' * '配置文件补齐' * 添加模型转换 * 添加meta文件 * 添加meta文件 * 删除demo.py测试文件 * 添加模型README文件 * docs文件回滚 * model-index删除末行空格 * 更新模型metafile * 更新metafile * 更新metafile * 更新README和metafile * 更新模型README * 更新模型metafile * Delete the model class and get_LeViT_model methods in the mmcls.models.backone.levit file * Change the class name to Google Code Style * use arch to provide default architectures * use nn.Conv2d * mmcv.cnn.fuse_conv_bn * modify some details * remove down_ops from the architectures. * remove init_weight function * Modify ambiguous variable names * Change the drop_path in config to drop_path_rate * Add unit test * remove train function * add unit test * modify nn.norm1d to build_norm_layer * update metafile and readme * Update configs and LeViT implementations. * Update README. * Add docstring and update unit tests. * Revert irrelative modification. * Fix unit tests * minor fix Co-authored-by: mzr1996 <mzr1996@163.com>
2023-01-17 17:43:42 +08:00
'LeViT',
'Vig',
'PyramidVig',
'XCiT',
2020-06-15 02:16:13 +08:00
]