From 8fcde3889d3a3eec61e143e80f31af610e749b89 Mon Sep 17 00:00:00 2001 From: wemoveon2 Date: Mon, 7 Oct 2024 20:01:29 -0400 Subject: [PATCH] Revert previous changes This reverts commit efb5851addea8e29c8da9dafd4200e422b1c236f. --- .../benchmark_regression/1-benchmark_valid.py | 2 +- docs/en/tutorials/MMClassification_python.ipynb | 4 ++-- .../tutorials/MMClassification_python_cn.ipynb | 4 ++-- mmcls/apis/inference.py | 2 +- mmcls/apis/test.py | 2 +- mmcls/apis/train.py | 6 +++--- mmcls/core/hook/class_num_check_hook.py | 4 ++-- mmcls/core/hook/lr_updater.py | 2 +- mmcls/core/hook/precise_bn_hook.py | 4 ++-- mmcls/core/optimizers/lamb.py | 2 +- mmcls/core/utils/dist_utils.py | 2 +- mmcls/datasets/builder.py | 2 +- mmcls/datasets/cifar.py | 2 +- mmcls/datasets/mnist.py | 2 +- mmcls/datasets/samplers/repeat_aug.py | 2 +- mmcls/models/backbones/base_backbone.py | 2 +- mmcls/models/backbones/convnext.py | 4 ++-- mmcls/models/backbones/cspnet.py | 2 +- mmcls/models/backbones/efficientnet.py | 2 +- mmcls/models/backbones/hrnet.py | 2 +- mmcls/models/backbones/mlp_mixer.py | 2 +- mmcls/models/backbones/mobilenet_v2.py | 2 +- mmcls/models/backbones/poolformer.py | 2 +- mmcls/models/backbones/repmlp.py | 2 +- mmcls/models/backbones/repvgg.py | 6 +++--- mmcls/models/backbones/res2net.py | 2 +- mmcls/models/backbones/resnet.py | 2 +- mmcls/models/backbones/shufflenet_v1.py | 2 +- mmcls/models/backbones/shufflenet_v2.py | 2 +- mmcls/models/backbones/swin_transformer.py | 2 +- mmcls/models/backbones/t2t_vit.py | 2 +- mmcls/models/backbones/tnt.py | 2 +- mmcls/models/backbones/twins.py | 2 +- mmcls/models/backbones/vision_transformer.py | 2 +- mmcls/models/classifiers/base.py | 2 +- mmcls/models/classifiers/image.py | 6 +++--- mmcls/models/heads/base_head.py | 2 +- mmcls/models/heads/stacked_head.py | 2 +- mmcls/models/heads/vision_transformer_head.py | 2 +- mmcls/models/necks/hr_fuse.py | 2 +- mmcls/models/utils/attention.py | 2 +- mmcls/models/utils/embed.py | 2 +- mmcls/models/utils/inverted_residual.py | 2 +- mmcls/models/utils/position_encoding.py | 2 +- mmcls/models/utils/se_layer.py | 2 +- requirements/mminstall.txt | 3 +-- tests/test_downstream/test_mmdet_inference.py | 2 +- tests/test_models/test_backbones/test_deit.py | 2 +- tests/test_models/test_backbones/test_repmlp.py | 2 +- tests/test_models/test_backbones/test_repvgg.py | 2 +- .../test_backbones/test_swin_transformer.py | 2 +- tests/test_models/test_backbones/test_t2t_vit.py | 2 +- .../test_backbones/test_vision_transformer.py | 2 +- tests/test_models/test_classifiers.py | 2 +- tests/test_runtime/test_eval_hook.py | 14 +++++++------- tests/test_runtime/test_hooks.py | 4 ++-- tests/test_runtime/test_num_class_hook.py | 4 ++-- tests/test_runtime/test_optimizer.py | 4 ++-- tests/test_runtime/test_preciseBN_hook.py | 2 +- tests/test_utils/test_setup_env.py | 2 +- tools/analysis_tools/eval_metric.py | 2 +- tools/analysis_tools/get_flops.py | 2 +- tools/convert_models/efficientnet_to_mmcls.py | 2 +- tools/convert_models/twins2mmcls.py | 2 +- tools/deployment/pytorch2mlmodel.py | 2 +- tools/deployment/pytorch2onnx.py | 2 +- tools/deployment/pytorch2torchscript.py | 2 +- tools/kfold-cross-valid.py | 4 ++-- tools/misc/print_config.py | 2 +- tools/misc/verify_dataset.py | 2 +- tools/test.py | 2 +- tools/train.py | 4 ++-- tools/visualizations/vis_cam.py | 2 +- tools/visualizations/vis_lr.py | 4 ++-- tools/visualizations/vis_pipeline.py | 2 +- 75 files changed, 98 insertions(+), 99 deletions(-) diff --git a/.dev_scripts/benchmark_regression/1-benchmark_valid.py b/.dev_scripts/benchmark_regression/1-benchmark_valid.py index 7324913ca1f..3fbf16e707d 100644 --- a/.dev_scripts/benchmark_regression/1-benchmark_valid.py +++ b/.dev_scripts/benchmark_regression/1-benchmark_valid.py @@ -7,7 +7,7 @@ import numpy as np import torch -from mmengine.config import Config +from mmcv import Config from mmcv.parallel import collate, scatter from modelindex.load_model_index import load from rich.console import Console diff --git a/docs/en/tutorials/MMClassification_python.ipynb b/docs/en/tutorials/MMClassification_python.ipynb index 6fe1064f834..d0acfa58237 100755 --- a/docs/en/tutorials/MMClassification_python.ipynb +++ b/docs/en/tutorials/MMClassification_python.ipynb @@ -945,7 +945,7 @@ "text/plain": [ "(mmcls.models.classifiers.image.ImageClassifier,\n", " mmcls.models.classifiers.base.BaseClassifier,\n", - " mmengine.runner.base_module.BaseModule,\n", + " mmcv.runner.base_module.BaseModule,\n", " torch.nn.modules.module.Module,\n", " object)" ] @@ -1113,7 +1113,7 @@ }, "source": [ "# Load the base config file\n", - "from mmengine.config import Config\n", + "from mmcv import Config\n", "cfg = Config.fromfile('configs/mobilenet_v2/mobilenet-v2_8xb32_in1k.py')\n", "\n", "# Modify the number of classes in the head.\n", diff --git a/docs/zh_CN/tutorials/MMClassification_python_cn.ipynb b/docs/zh_CN/tutorials/MMClassification_python_cn.ipynb index 52477da0e67..adbbeeb3f5c 100755 --- a/docs/zh_CN/tutorials/MMClassification_python_cn.ipynb +++ b/docs/zh_CN/tutorials/MMClassification_python_cn.ipynb @@ -947,7 +947,7 @@ "text/plain": [ "(mmcls.models.classifiers.image.ImageClassifier,\n", " mmcls.models.classifiers.base.BaseClassifier,\n", - " mmengine.runner.base_module.BaseModule,\n", + " mmcv.runner.base_module.BaseModule,\n", " torch.nn.modules.module.Module,\n", " object)" ] @@ -1115,7 +1115,7 @@ }, "source": [ "# 载入已经存在的配置文件\n", - "from mmengine.config import Config\n", + "from mmcv import Config\n", "cfg = Config.fromfile('configs/mobilenet_v2/mobilenet-v2_8xb32_in1k.py')\n", "\n", "# 修改模型分类头中的类别数目\n", diff --git a/mmcls/apis/inference.py b/mmcls/apis/inference.py index 1e45c1db216..09e004183dc 100644 --- a/mmcls/apis/inference.py +++ b/mmcls/apis/inference.py @@ -5,7 +5,7 @@ import numpy as np import torch from mmcv.parallel import collate, scatter -from mmengine.runner import load_checkpoint +from mmcv.runner import load_checkpoint from mmcls.datasets.pipelines import Compose from mmcls.models import build_classifier diff --git a/mmcls/apis/test.py b/mmcls/apis/test.py index 46e315bd883..3b20c809f92 100644 --- a/mmcls/apis/test.py +++ b/mmcls/apis/test.py @@ -10,7 +10,7 @@ import torch import torch.distributed as dist from mmcv.image import tensor2imgs -from mmengine.dist.utils import get_dist_info +from mmcv.runner import get_dist_info def single_gpu_test(model, diff --git a/mmcls/apis/train.py b/mmcls/apis/train.py index de203c7fa5b..aa263d2d235 100644 --- a/mmcls/apis/train.py +++ b/mmcls/apis/train.py @@ -6,9 +6,9 @@ import torch import torch.distributed as dist from mmcv.parallel import MMDataParallel, MMDistributedDataParallel -from mmengine.runner import (DistSamplerSeedHook, Fp16OptimizerHook, +from mmcv.runner import (DistSamplerSeedHook, Fp16OptimizerHook, build_optimizer, build_runner, get_dist_info) -from mmengine.runner.hooks import DistEvalHook, EvalHook +from mmcv.runner.hooks import DistEvalHook, EvalHook from mmcls.core import DistOptimizerHook from mmcls.datasets import build_dataloader, build_dataset @@ -89,7 +89,7 @@ def train_model(model, distributed (bool): Whether to train the model in a distributed environment. Defaults to False. validate (bool): Whether to do validation with - :obj:`mmengine.runner.EvalHook`. Defaults to False. + :obj:`mmcv.runner.EvalHook`. Defaults to False. timestamp (str, optional): The timestamp string to auto generate the name of log files. Defaults to None. device (str, optional): TODO diff --git a/mmcls/core/hook/class_num_check_hook.py b/mmcls/core/hook/class_num_check_hook.py index b45404e50f4..52c2c9a59d0 100644 --- a/mmcls/core/hook/class_num_check_hook.py +++ b/mmcls/core/hook/class_num_check_hook.py @@ -1,6 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved -from mmengine.runner import IterBasedRunner -from mmengine.runner.hooks import HOOKS, Hook +from mmcv.runner import IterBasedRunner +from mmcv.runner.hooks import HOOKS, Hook from mmcv.utils import is_seq_of diff --git a/mmcls/core/hook/lr_updater.py b/mmcls/core/hook/lr_updater.py index 122fc2be252..021f66b5738 100644 --- a/mmcls/core/hook/lr_updater.py +++ b/mmcls/core/hook/lr_updater.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. from math import cos, pi -from mmengine.runner.hooks import HOOKS, LrUpdaterHook +from mmcv.runner.hooks import HOOKS, LrUpdaterHook @HOOKS.register_module() diff --git a/mmcls/core/hook/precise_bn_hook.py b/mmcls/core/hook/precise_bn_hook.py index 831fa47fe8c..384fd806725 100644 --- a/mmcls/core/hook/precise_bn_hook.py +++ b/mmcls/core/hook/precise_bn_hook.py @@ -9,8 +9,8 @@ import mmcv import torch import torch.nn as nn -from mmengine.runner import EpochBasedRunner, get_dist_info -from mmengine.runner.hooks import HOOKS, Hook +from mmcv.runner import EpochBasedRunner, get_dist_info +from mmcv.runner.hooks import HOOKS, Hook from mmcv.utils import print_log from torch.functional import Tensor from torch.nn import GroupNorm diff --git a/mmcls/core/optimizers/lamb.py b/mmcls/core/optimizers/lamb.py index 6a7bce58340..c65fbae2749 100644 --- a/mmcls/core/optimizers/lamb.py +++ b/mmcls/core/optimizers/lamb.py @@ -59,7 +59,7 @@ import math import torch -from mmengine.runner import OPTIMIZERS +from mmcv.runner import OPTIMIZERS from torch.optim import Optimizer diff --git a/mmcls/core/utils/dist_utils.py b/mmcls/core/utils/dist_utils.py index 6209705ea75..8912cea435a 100644 --- a/mmcls/core/utils/dist_utils.py +++ b/mmcls/core/utils/dist_utils.py @@ -4,7 +4,7 @@ import numpy as np import torch import torch.distributed as dist -from mmengine.runner import OptimizerHook, get_dist_info +from mmcv.runner import OptimizerHook, get_dist_info from torch._utils import (_flatten_dense_tensors, _take_tensors, _unflatten_dense_tensors) diff --git a/mmcls/datasets/builder.py b/mmcls/datasets/builder.py index 81fec8a7399..1c74af9c42b 100644 --- a/mmcls/datasets/builder.py +++ b/mmcls/datasets/builder.py @@ -7,7 +7,7 @@ import numpy as np import torch from mmcv.parallel import collate -from mmengine.dist.utils import get_dist_info +from mmcv.runner import get_dist_info from mmcv.utils import Registry, build_from_cfg, digit_version from torch.utils.data import DataLoader diff --git a/mmcls/datasets/cifar.py b/mmcls/datasets/cifar.py index 313ec9b48e2..453b8d9d95f 100644 --- a/mmcls/datasets/cifar.py +++ b/mmcls/datasets/cifar.py @@ -5,7 +5,7 @@ import numpy as np import torch.distributed as dist -from mmengine.dist.utils import get_dist_info +from mmcv.runner import get_dist_info from .base_dataset import BaseDataset from .builder import DATASETS diff --git a/mmcls/datasets/mnist.py b/mmcls/datasets/mnist.py index a88137836f7..4065e0d5422 100644 --- a/mmcls/datasets/mnist.py +++ b/mmcls/datasets/mnist.py @@ -6,7 +6,7 @@ import numpy as np import torch import torch.distributed as dist -from mmengine.dist.utils import get_dist_info, master_only +from mmcv.runner import get_dist_info, master_only from .base_dataset import BaseDataset from .builder import DATASETS diff --git a/mmcls/datasets/samplers/repeat_aug.py b/mmcls/datasets/samplers/repeat_aug.py index 38c9b6d4488..5de096bdef2 100644 --- a/mmcls/datasets/samplers/repeat_aug.py +++ b/mmcls/datasets/samplers/repeat_aug.py @@ -1,7 +1,7 @@ import math import torch -from mmengine.dist.utils import get_dist_info +from mmcv.runner import get_dist_info from torch.utils.data import Sampler from mmcls.core.utils import sync_random_seed diff --git a/mmcls/models/backbones/base_backbone.py b/mmcls/models/backbones/base_backbone.py index 2ce4a86e5d5..c1050fab1c3 100644 --- a/mmcls/models/backbones/base_backbone.py +++ b/mmcls/models/backbones/base_backbone.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule class BaseBackbone(BaseModule, metaclass=ABCMeta): diff --git a/mmcls/models/backbones/convnext.py b/mmcls/models/backbones/convnext.py index 8764f7e2394..1e0a3e9c5ea 100644 --- a/mmcls/models/backbones/convnext.py +++ b/mmcls/models/backbones/convnext.py @@ -8,8 +8,8 @@ import torch.nn.functional as F from mmcv.cnn.bricks import (NORM_LAYERS, DropPath, build_activation_layer, build_norm_layer) -from mmengine.runner import BaseModule -from mmengine.runner.base_module import ModuleList, Sequential +from mmcv.runner import BaseModule +from mmcv.runner.base_module import ModuleList, Sequential from ..builder import BACKBONES from .base_backbone import BaseBackbone diff --git a/mmcls/models/backbones/cspnet.py b/mmcls/models/backbones/cspnet.py index 610635b3d90..70aff4c881a 100644 --- a/mmcls/models/backbones/cspnet.py +++ b/mmcls/models/backbones/cspnet.py @@ -6,7 +6,7 @@ import torch.nn as nn from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.cnn.bricks import DropPath -from mmengine.runner import BaseModule, Sequential +from mmcv.runner import BaseModule, Sequential from torch.nn.modules.batchnorm import _BatchNorm from ..builder import BACKBONES diff --git a/mmcls/models/backbones/efficientnet.py b/mmcls/models/backbones/efficientnet.py index 15b420637b3..ede2c184e14 100644 --- a/mmcls/models/backbones/efficientnet.py +++ b/mmcls/models/backbones/efficientnet.py @@ -7,7 +7,7 @@ import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn.bricks import ConvModule, DropPath -from mmengine.runner import BaseModule, Sequential +from mmcv.runner import BaseModule, Sequential from mmcls.models.backbones.base_backbone import BaseBackbone from mmcls.models.utils import InvertedResidual, SELayer, make_divisible diff --git a/mmcls/models/backbones/hrnet.py b/mmcls/models/backbones/hrnet.py index 9618e2537de..57baf0cae74 100644 --- a/mmcls/models/backbones/hrnet.py +++ b/mmcls/models/backbones/hrnet.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import build_conv_layer, build_norm_layer -from mmengine.runner import BaseModule, ModuleList, Sequential +from mmcv.runner import BaseModule, ModuleList, Sequential from torch.nn.modules.batchnorm import _BatchNorm from ..builder import BACKBONES diff --git a/mmcls/models/backbones/mlp_mixer.py b/mmcls/models/backbones/mlp_mixer.py index a54aec87645..13171a4b389 100644 --- a/mmcls/models/backbones/mlp_mixer.py +++ b/mmcls/models/backbones/mlp_mixer.py @@ -4,7 +4,7 @@ import torch.nn as nn from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN, PatchEmbed -from mmengine.runner.base_module import BaseModule, ModuleList +from mmcv.runner.base_module import BaseModule, ModuleList from ..builder import BACKBONES from ..utils import to_2tuple diff --git a/mmcls/models/backbones/mobilenet_v2.py b/mmcls/models/backbones/mobilenet_v2.py index 674dda3ffe8..8f171eda790 100644 --- a/mmcls/models/backbones/mobilenet_v2.py +++ b/mmcls/models/backbones/mobilenet_v2.py @@ -2,7 +2,7 @@ import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import ConvModule -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.utils import make_divisible diff --git a/mmcls/models/backbones/poolformer.py b/mmcls/models/backbones/poolformer.py index ab403bcdcc0..e3fc4e1cc0c 100644 --- a/mmcls/models/backbones/poolformer.py +++ b/mmcls/models/backbones/poolformer.py @@ -4,7 +4,7 @@ import torch import torch.nn as nn from mmcv.cnn.bricks import DropPath, build_activation_layer, build_norm_layer -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from ..builder import BACKBONES from .base_backbone import BaseBackbone diff --git a/mmcls/models/backbones/repmlp.py b/mmcls/models/backbones/repmlp.py index 31c7ab7fb39..9e6e2ed9883 100644 --- a/mmcls/models/backbones/repmlp.py +++ b/mmcls/models/backbones/repmlp.py @@ -6,7 +6,7 @@ from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer, build_norm_layer) from mmcv.cnn.bricks.transformer import PatchEmbed as _PatchEmbed -from mmengine.runner import BaseModule, ModuleList, Sequential +from mmcv.runner import BaseModule, ModuleList, Sequential from mmcls.models.builder import BACKBONES from mmcls.models.utils import SELayer, to_2tuple diff --git a/mmcls/models/backbones/repvgg.py b/mmcls/models/backbones/repvgg.py index 3805e7257dd..0186e623965 100644 --- a/mmcls/models/backbones/repvgg.py +++ b/mmcls/models/backbones/repvgg.py @@ -3,7 +3,7 @@ import torch.nn.functional as F import torch.utils.checkpoint as cp from mmcv.cnn import build_activation_layer, build_conv_layer, build_norm_layer -from mmengine.runner import BaseModule, Sequential +from mmcv.runner import BaseModule, Sequential from mmcv.utils.parrots_wrapper import _BatchNorm from ..builder import BACKBONES @@ -208,7 +208,7 @@ def _fuse_conv_bn(self, branch): """Fuse the parameters in a branch with a conv and bn. Args: - branch (mmengine.runner.Sequential): A branch with conv and bn. + branch (mmcv.runner.Sequential): A branch with conv and bn. Returns: tuple[torch.Tensor, torch.Tensor]: The parameters obtained after @@ -237,7 +237,7 @@ def _norm_to_conv3x3(self, branch_nrom): branch (nn.BatchNorm2d): A branch only with bn in the block. Returns: - tmp_conv3x3 (mmengine.runner.Sequential): a sequential with conv3x3 and + tmp_conv3x3 (mmcv.runner.Sequential): a sequential with conv3x3 and bn. """ input_dim = self.in_channels // self.groups diff --git a/mmcls/models/backbones/res2net.py b/mmcls/models/backbones/res2net.py index a241a9f81d5..491b6f4717d 100644 --- a/mmcls/models/backbones/res2net.py +++ b/mmcls/models/backbones/res2net.py @@ -5,7 +5,7 @@ import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer -from mmengine.runner import ModuleList, Sequential +from mmcv.runner import ModuleList, Sequential from ..builder import BACKBONES from .resnet import Bottleneck as _Bottleneck diff --git a/mmcls/models/backbones/resnet.py b/mmcls/models/backbones/resnet.py index 7cd4c9d7ab1..d01ebe0c546 100644 --- a/mmcls/models/backbones/resnet.py +++ b/mmcls/models/backbones/resnet.py @@ -5,7 +5,7 @@ from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer, build_norm_layer, constant_init) from mmcv.cnn.bricks import DropPath -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from mmcv.utils.parrots_wrapper import _BatchNorm from ..builder import BACKBONES diff --git a/mmcls/models/backbones/shufflenet_v1.py b/mmcls/models/backbones/shufflenet_v1.py index a36e1981b6c..0b6c70f08c7 100644 --- a/mmcls/models/backbones/shufflenet_v1.py +++ b/mmcls/models/backbones/shufflenet_v1.py @@ -4,7 +4,7 @@ import torch.utils.checkpoint as cp from mmcv.cnn import (ConvModule, build_activation_layer, constant_init, normal_init) -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.utils import channel_shuffle, make_divisible diff --git a/mmcls/models/backbones/shufflenet_v2.py b/mmcls/models/backbones/shufflenet_v2.py index 1c21274e487..bfe7ac8282a 100644 --- a/mmcls/models/backbones/shufflenet_v2.py +++ b/mmcls/models/backbones/shufflenet_v2.py @@ -3,7 +3,7 @@ import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import ConvModule, constant_init, normal_init -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.utils import channel_shuffle diff --git a/mmcls/models/backbones/swin_transformer.py b/mmcls/models/backbones/swin_transformer.py index 075a3f1b886..2295c267864 100644 --- a/mmcls/models/backbones/swin_transformer.py +++ b/mmcls/models/backbones/swin_transformer.py @@ -9,7 +9,7 @@ from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN, PatchEmbed, PatchMerging from mmcv.cnn.utils.weight_init import trunc_normal_ -from mmengine.runner.base_module import BaseModule, ModuleList +from mmcv.runner.base_module import BaseModule, ModuleList from mmcv.utils.parrots_wrapper import _BatchNorm from ..builder import BACKBONES diff --git a/mmcls/models/backbones/t2t_vit.py b/mmcls/models/backbones/t2t_vit.py index f7b344832f0..e3160ccd756 100644 --- a/mmcls/models/backbones/t2t_vit.py +++ b/mmcls/models/backbones/t2t_vit.py @@ -8,7 +8,7 @@ from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN from mmcv.cnn.utils.weight_init import trunc_normal_ -from mmengine.runner.base_module import BaseModule, ModuleList +from mmcv.runner.base_module import BaseModule, ModuleList from ..builder import BACKBONES from ..utils import MultiheadAttention, resize_pos_embed, to_2tuple diff --git a/mmcls/models/backbones/tnt.py b/mmcls/models/backbones/tnt.py index 51dedac2a29..b03120b91d6 100644 --- a/mmcls/models/backbones/tnt.py +++ b/mmcls/models/backbones/tnt.py @@ -6,7 +6,7 @@ from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention from mmcv.cnn.utils.weight_init import trunc_normal_ -from mmengine.runner.base_module import BaseModule, ModuleList +from mmcv.runner.base_module import BaseModule, ModuleList from ..builder import BACKBONES from ..utils import to_2tuple diff --git a/mmcls/models/backbones/twins.py b/mmcls/models/backbones/twins.py index 384fc860fb0..0e3c47a4992 100644 --- a/mmcls/models/backbones/twins.py +++ b/mmcls/models/backbones/twins.py @@ -9,7 +9,7 @@ from mmcv.cnn.bricks.transformer import FFN, PatchEmbed from mmcv.cnn.utils.weight_init import (constant_init, normal_init, trunc_normal_init) -from mmengine.runner import BaseModule, ModuleList +from mmcv.runner import BaseModule, ModuleList from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.builder import BACKBONES diff --git a/mmcls/models/backbones/vision_transformer.py b/mmcls/models/backbones/vision_transformer.py index 1f2d39e3653..87a70640e24 100644 --- a/mmcls/models/backbones/vision_transformer.py +++ b/mmcls/models/backbones/vision_transformer.py @@ -7,7 +7,7 @@ from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN, PatchEmbed from mmcv.cnn.utils.weight_init import trunc_normal_ -from mmengine.runner.base_module import BaseModule, ModuleList +from mmcv.runner.base_module import BaseModule, ModuleList from mmcls.utils import get_root_logger from ..builder import BACKBONES diff --git a/mmcls/models/classifiers/base.py b/mmcls/models/classifiers/base.py index 36ebcfa48d9..0fe6ef18389 100644 --- a/mmcls/models/classifiers/base.py +++ b/mmcls/models/classifiers/base.py @@ -6,7 +6,7 @@ import mmcv import torch import torch.distributed as dist -from mmengine.runner import BaseModule, auto_fp16 +from mmcv.runner import BaseModule, auto_fp16 from mmcls.core.visualization import imshow_infos diff --git a/mmcls/models/classifiers/image.py b/mmcls/models/classifiers/image.py index da174bfd537..b49333b7fe6 100644 --- a/mmcls/models/classifiers/image.py +++ b/mmcls/models/classifiers/image.py @@ -52,7 +52,7 @@ def extract_feat(self, img, stage='neck'): 1. Backbone output >>> import torch - >>> from mmengine.config import Config + >>> from mmcv import Config >>> from mmcls.models import build_classifier >>> >>> cfg = Config.fromfile('configs/resnet/resnet18_8xb32_in1k.py').model @@ -69,7 +69,7 @@ def extract_feat(self, img, stage='neck'): 2. Neck output >>> import torch - >>> from mmengine.config import Config + >>> from mmcv import Config >>> from mmcls.models import build_classifier >>> >>> cfg = Config.fromfile('configs/resnet/resnet18_8xb32_in1k.py').model @@ -87,7 +87,7 @@ def extract_feat(self, img, stage='neck'): 3. Pre-logits output (without the final linear classifier head) >>> import torch - >>> from mmengine.config import Config + >>> from mmcv import Config >>> from mmcls.models import build_classifier >>> >>> cfg = Config.fromfile('configs/vision_transformer/vit-base-p16_pt-64xb64_in1k-224.py').model diff --git a/mmcls/models/heads/base_head.py b/mmcls/models/heads/base_head.py index 860cfee3ab1..e8936f28fe5 100644 --- a/mmcls/models/heads/base_head.py +++ b/mmcls/models/heads/base_head.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule class BaseHead(BaseModule, metaclass=ABCMeta): diff --git a/mmcls/models/heads/stacked_head.py b/mmcls/models/heads/stacked_head.py index 1883e50a94a..bbb0dc24ccb 100644 --- a/mmcls/models/heads/stacked_head.py +++ b/mmcls/models/heads/stacked_head.py @@ -4,7 +4,7 @@ import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_activation_layer, build_norm_layer -from mmengine.runner import BaseModule, ModuleList +from mmcv.runner import BaseModule, ModuleList from ..builder import HEADS from .cls_head import ClsHead diff --git a/mmcls/models/heads/vision_transformer_head.py b/mmcls/models/heads/vision_transformer_head.py index 2d89448f566..d0586cb9d78 100644 --- a/mmcls/models/heads/vision_transformer_head.py +++ b/mmcls/models/heads/vision_transformer_head.py @@ -6,7 +6,7 @@ import torch.nn.functional as F from mmcv.cnn import build_activation_layer from mmcv.cnn.utils.weight_init import trunc_normal_ -from mmengine.runner import Sequential +from mmcv.runner import Sequential from ..builder import HEADS from .cls_head import ClsHead diff --git a/mmcls/models/necks/hr_fuse.py b/mmcls/models/necks/hr_fuse.py index be3dd4bfc28..1acc382756b 100644 --- a/mmcls/models/necks/hr_fuse.py +++ b/mmcls/models/necks/hr_fuse.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn.bricks import ConvModule -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from ..backbones.resnet import Bottleneck, ResLayer from ..builder import NECKS diff --git a/mmcls/models/utils/attention.py b/mmcls/models/utils/attention.py index e4ccb260a11..155127f7877 100644 --- a/mmcls/models/utils/attention.py +++ b/mmcls/models/utils/attention.py @@ -7,7 +7,7 @@ from mmcv.cnn.bricks.registry import DROPOUT_LAYERS from mmcv.cnn.bricks.transformer import build_dropout from mmcv.cnn.utils.weight_init import trunc_normal_ -from mmengine.runner.base_module import BaseModule +from mmcv.runner.base_module import BaseModule from ..builder import ATTENTION from .helpers import to_2tuple diff --git a/mmcls/models/utils/embed.py b/mmcls/models/utils/embed.py index 1e129374d2f..7dd27cd51a3 100644 --- a/mmcls/models/utils/embed.py +++ b/mmcls/models/utils/embed.py @@ -6,7 +6,7 @@ import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_conv_layer, build_norm_layer -from mmengine.runner.base_module import BaseModule +from mmcv.runner.base_module import BaseModule from .helpers import to_2tuple diff --git a/mmcls/models/utils/inverted_residual.py b/mmcls/models/utils/inverted_residual.py index ff5b71ba8e7..7c432943b5b 100644 --- a/mmcls/models/utils/inverted_residual.py +++ b/mmcls/models/utils/inverted_residual.py @@ -3,7 +3,7 @@ import torch.utils.checkpoint as cp from mmcv.cnn import ConvModule from mmcv.cnn.bricks import DropPath -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from .se_layer import SELayer diff --git a/mmcls/models/utils/position_encoding.py b/mmcls/models/utils/position_encoding.py index b22875f4e7a..99f32de07c3 100644 --- a/mmcls/models/utils/position_encoding.py +++ b/mmcls/models/utils/position_encoding.py @@ -1,6 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn -from mmengine.runner.base_module import BaseModule +from mmcv.runner.base_module import BaseModule class ConditionalPositionEncoding(BaseModule): diff --git a/mmcls/models/utils/se_layer.py b/mmcls/models/utils/se_layer.py index 11aad64cd10..47a830ac7d8 100644 --- a/mmcls/models/utils/se_layer.py +++ b/mmcls/models/utils/se_layer.py @@ -2,7 +2,7 @@ import mmcv import torch.nn as nn from mmcv.cnn import ConvModule -from mmengine.runner import BaseModule +from mmcv.runner import BaseModule from .make_divisible import make_divisible diff --git a/requirements/mminstall.txt b/requirements/mminstall.txt index 5df4a7fb476..6306cb53601 100644 --- a/requirements/mminstall.txt +++ b/requirements/mminstall.txt @@ -1,2 +1 @@ -mmcv==2.2.0 -mmengine==0.10.5 \ No newline at end of file +mmcv-full>=1.4.2,<1.6.0 diff --git a/tests/test_downstream/test_mmdet_inference.py b/tests/test_downstream/test_mmdet_inference.py index 5ae6211b42f..096c5db7d3f 100644 --- a/tests/test_downstream/test_mmdet_inference.py +++ b/tests/test_downstream/test_mmdet_inference.py @@ -1,6 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import numpy as np -from mmengine.config import Config +from mmcv import Config from mmdet.apis import inference_detector from mmdet.models import build_detector diff --git a/tests/test_models/test_backbones/test_deit.py b/tests/test_models/test_backbones/test_deit.py index 599c1d84f7b..5f11a3ae57b 100644 --- a/tests/test_models/test_backbones/test_deit.py +++ b/tests/test_models/test_backbones/test_deit.py @@ -6,7 +6,7 @@ from unittest import TestCase import torch -from mmengine.runner import load_checkpoint, save_checkpoint +from mmcv.runner import load_checkpoint, save_checkpoint from mmcls.models.backbones import DistilledVisionTransformer from .utils import timm_resize_pos_embed diff --git a/tests/test_models/test_backbones/test_repmlp.py b/tests/test_models/test_backbones/test_repmlp.py index 084020b64f7..dcab2cfbf50 100644 --- a/tests/test_models/test_backbones/test_repmlp.py +++ b/tests/test_models/test_backbones/test_repmlp.py @@ -5,7 +5,7 @@ from unittest import TestCase import torch -from mmengine.runner import load_checkpoint, save_checkpoint +from mmcv.runner import load_checkpoint, save_checkpoint from mmcls.models.backbones import RepMLPNet diff --git a/tests/test_models/test_backbones/test_repvgg.py b/tests/test_models/test_backbones/test_repvgg.py index 48e64abef3e..f4c78abcac4 100644 --- a/tests/test_models/test_backbones/test_repvgg.py +++ b/tests/test_models/test_backbones/test_repvgg.py @@ -4,7 +4,7 @@ import pytest import torch -from mmengine.runner import load_checkpoint, save_checkpoint +from mmcv.runner import load_checkpoint, save_checkpoint from torch import nn from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm diff --git a/tests/test_models/test_backbones/test_swin_transformer.py b/tests/test_models/test_backbones/test_swin_transformer.py index a8dbb89f15a..b90ac0ede79 100644 --- a/tests/test_models/test_backbones/test_swin_transformer.py +++ b/tests/test_models/test_backbones/test_swin_transformer.py @@ -7,7 +7,7 @@ from unittest import TestCase import torch -from mmengine.runner import load_checkpoint, save_checkpoint +from mmcv.runner import load_checkpoint, save_checkpoint from mmcv.utils.parrots_wrapper import _BatchNorm from mmcls.models.backbones import SwinTransformer diff --git a/tests/test_models/test_backbones/test_t2t_vit.py b/tests/test_models/test_backbones/test_t2t_vit.py index d0cdbcb35b5..cc7e839c32a 100644 --- a/tests/test_models/test_backbones/test_t2t_vit.py +++ b/tests/test_models/test_backbones/test_t2t_vit.py @@ -6,7 +6,7 @@ from unittest import TestCase import torch -from mmengine.runner import load_checkpoint, save_checkpoint +from mmcv.runner import load_checkpoint, save_checkpoint from mmcls.models.backbones import T2T_ViT from .utils import timm_resize_pos_embed diff --git a/tests/test_models/test_backbones/test_vision_transformer.py b/tests/test_models/test_backbones/test_vision_transformer.py index c3f5c4e509c..26cc73707f4 100644 --- a/tests/test_models/test_backbones/test_vision_transformer.py +++ b/tests/test_models/test_backbones/test_vision_transformer.py @@ -6,7 +6,7 @@ from unittest import TestCase import torch -from mmengine.runner import load_checkpoint, save_checkpoint +from mmcv.runner import load_checkpoint, save_checkpoint from mmcls.models.backbones import VisionTransformer from .utils import timm_resize_pos_embed diff --git a/tests/test_models/test_classifiers.py b/tests/test_models/test_classifiers.py index 50e5e94ef03..b9487d114a5 100644 --- a/tests/test_models/test_classifiers.py +++ b/tests/test_models/test_classifiers.py @@ -5,7 +5,7 @@ import numpy as np import torch -from mmengine.config import ConfigDict +from mmcv import ConfigDict from mmcls.models import CLASSIFIERS from mmcls.models.classifiers import ImageClassifier diff --git a/tests/test_runtime/test_eval_hook.py b/tests/test_runtime/test_eval_hook.py index 580909a5cbe..b925bdebcd0 100644 --- a/tests/test_runtime/test_eval_hook.py +++ b/tests/test_runtime/test_eval_hook.py @@ -3,12 +3,12 @@ import tempfile from unittest.mock import MagicMock, patch -import mmengine.runner +import mmcv.runner import pytest import torch import torch.nn as nn -from mmengine.runner import obj_from_dict -from mmengine.runner.hooks import DistEvalHook, EvalHook +from mmcv.runner import obj_from_dict +from mmcv.runner.hooks import DistEvalHook, EvalHook from torch.utils.data import DataLoader, Dataset from mmcls.apis import single_gpu_test @@ -65,7 +65,7 @@ def test_iter_eval_hook(): # test EvalHook with tempfile.TemporaryDirectory() as tmpdir: eval_hook = EvalHook(data_loader, by_epoch=False) - runner = mmengine.runner.IterBasedRunner( + runner = mmcv.runner.IterBasedRunner( model=model, optimizer=optimizer, work_dir=tmpdir, @@ -103,7 +103,7 @@ def test_epoch_eval_hook(): # test EvalHook with interval with tempfile.TemporaryDirectory() as tmpdir: eval_hook = EvalHook(data_loader, by_epoch=True, interval=2) - runner = mmengine.runner.EpochBasedRunner( + runner = mmcv.runner.EpochBasedRunner( model=model, optimizer=optimizer, work_dir=tmpdir, @@ -149,7 +149,7 @@ def test_dist_eval_hook(): p = patch('mmcv.engine.multi_gpu_test', multi_gpu_test) p.start() eval_hook = DistEvalHook(data_loader, by_epoch=False) - runner = mmengine.runner.IterBasedRunner( + runner = mmcv.runner.IterBasedRunner( model=model, optimizer=optimizer, work_dir=tmpdir, @@ -191,7 +191,7 @@ def test_dist_eval_hook_epoch(): p = patch('mmcv.engine.multi_gpu_test', multi_gpu_test) p.start() eval_hook = DistEvalHook(data_loader, by_epoch=True, interval=2) - runner = mmengine.runner.EpochBasedRunner( + runner = mmcv.runner.EpochBasedRunner( model=model, optimizer=optimizer, work_dir=tmpdir, diff --git a/tests/test_runtime/test_hooks.py b/tests/test_runtime/test_hooks.py index 8ae64b02f7d..70140d9e52b 100644 --- a/tests/test_runtime/test_hooks.py +++ b/tests/test_runtime/test_hooks.py @@ -7,8 +7,8 @@ import pytest import torch import torch.nn as nn -from mmengine.runner import build_runner -from mmengine.runner.hooks import Hook, IterTimerHook +from mmcv.runner import build_runner +from mmcv.runner.hooks import Hook, IterTimerHook from torch.utils.data import DataLoader import mmcls.core # noqa: F401 diff --git a/tests/test_runtime/test_num_class_hook.py b/tests/test_runtime/test_num_class_hook.py index 9bc4f373988..fe8fb059f59 100644 --- a/tests/test_runtime/test_num_class_hook.py +++ b/tests/test_runtime/test_num_class_hook.py @@ -3,10 +3,10 @@ import tempfile from unittest.mock import MagicMock -import mmengine.runner as mmcv_runner +import mmcv.runner as mmcv_runner import pytest import torch -from mmengine.runner import obj_from_dict +from mmcv.runner import obj_from_dict from torch.utils.data import DataLoader, Dataset from mmcls.core.hook import ClassNumCheckHook diff --git a/tests/test_runtime/test_optimizer.py b/tests/test_runtime/test_optimizer.py index 537d5db657b..2fdaeb08f49 100644 --- a/tests/test_runtime/test_optimizer.py +++ b/tests/test_runtime/test_optimizer.py @@ -6,8 +6,8 @@ import torch import torch.nn as nn -from mmengine.runner import build_optimizer -from mmengine.runner.optimizer.builder import OPTIMIZERS +from mmcv.runner import build_optimizer +from mmcv.runner.optimizer.builder import OPTIMIZERS from mmcv.utils.registry import build_from_cfg from torch.autograd import Variable from torch.optim.optimizer import Optimizer diff --git a/tests/test_runtime/test_preciseBN_hook.py b/tests/test_runtime/test_preciseBN_hook.py index 2213276c38f..d9cd71569e5 100644 --- a/tests/test_runtime/test_preciseBN_hook.py +++ b/tests/test_runtime/test_preciseBN_hook.py @@ -4,7 +4,7 @@ import torch import torch.nn as nn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel -from mmengine.runner import EpochBasedRunner, IterBasedRunner, build_optimizer +from mmcv.runner import EpochBasedRunner, IterBasedRunner, build_optimizer from mmcv.utils import get_logger from mmcv.utils.logging import print_log from torch.utils.data import DataLoader, Dataset diff --git a/tests/test_utils/test_setup_env.py b/tests/test_utils/test_setup_env.py index 7fa74f94ef5..2679dbbf5e2 100644 --- a/tests/test_utils/test_setup_env.py +++ b/tests/test_utils/test_setup_env.py @@ -4,7 +4,7 @@ import platform import cv2 -from mmengine.config import Config +from mmcv import Config from mmcls.utils import setup_multi_processes diff --git a/tools/analysis_tools/eval_metric.py b/tools/analysis_tools/eval_metric.py index 2453ffe926b..1c95dbc0aa4 100644 --- a/tools/analysis_tools/eval_metric.py +++ b/tools/analysis_tools/eval_metric.py @@ -2,7 +2,7 @@ import argparse import mmcv -from mmengine.config import Config, DictAction +from mmcv import Config, DictAction from mmcls.datasets import build_dataset diff --git a/tools/analysis_tools/get_flops.py b/tools/analysis_tools/get_flops.py index 51dd86d9a43..58683d98238 100644 --- a/tools/analysis_tools/get_flops.py +++ b/tools/analysis_tools/get_flops.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import argparse -from mmengine.config import Config +from mmcv import Config from mmcv.cnn.utils import get_model_complexity_info from mmcls.models import build_classifier diff --git a/tools/convert_models/efficientnet_to_mmcls.py b/tools/convert_models/efficientnet_to_mmcls.py index 8d2028aa18b..d1b097bd4ca 100644 --- a/tools/convert_models/efficientnet_to_mmcls.py +++ b/tools/convert_models/efficientnet_to_mmcls.py @@ -4,7 +4,7 @@ import numpy as np import torch -from mmengine.runner import Sequential +from mmcv.runner import Sequential from tensorflow.python.training import py_checkpoint_reader from mmcls.models.backbones.efficientnet import EfficientNet diff --git a/tools/convert_models/twins2mmcls.py b/tools/convert_models/twins2mmcls.py index 8b822ad9322..e0ea04c27d4 100644 --- a/tools/convert_models/twins2mmcls.py +++ b/tools/convert_models/twins2mmcls.py @@ -5,7 +5,7 @@ import mmcv import torch -from mmengine.runner import CheckpointLoader +from mmcv.runner import CheckpointLoader def convert_twins(args, ckpt): diff --git a/tools/deployment/pytorch2mlmodel.py b/tools/deployment/pytorch2mlmodel.py index da577963ab1..814cbe94e75 100644 --- a/tools/deployment/pytorch2mlmodel.py +++ b/tools/deployment/pytorch2mlmodel.py @@ -8,7 +8,7 @@ import mmcv import numpy as np import torch -from mmengine.runner import load_checkpoint +from mmcv.runner import load_checkpoint from torch import nn from mmcls.models import build_classifier diff --git a/tools/deployment/pytorch2onnx.py b/tools/deployment/pytorch2onnx.py index 7b02657cb40..8015e86173c 100644 --- a/tools/deployment/pytorch2onnx.py +++ b/tools/deployment/pytorch2onnx.py @@ -8,7 +8,7 @@ import onnxruntime as rt import torch from mmcv.onnx import register_extra_symbolics -from mmengine.runner import load_checkpoint +from mmcv.runner import load_checkpoint from mmcls.models import build_classifier diff --git a/tools/deployment/pytorch2torchscript.py b/tools/deployment/pytorch2torchscript.py index e70118efece..f261b7c9526 100644 --- a/tools/deployment/pytorch2torchscript.py +++ b/tools/deployment/pytorch2torchscript.py @@ -7,7 +7,7 @@ import mmcv import numpy as np import torch -from mmengine.runner import load_checkpoint +from mmcv.runner import load_checkpoint from torch import nn from mmcls.models import build_classifier diff --git a/tools/kfold-cross-valid.py b/tools/kfold-cross-valid.py index d186527a1c6..c6d8d89d013 100644 --- a/tools/kfold-cross-valid.py +++ b/tools/kfold-cross-valid.py @@ -10,8 +10,8 @@ import mmcv import torch -from mmengine.config import Config, DictAction -from mmengine.dist.utils import get_dist_info, init_dist +from mmcv import Config, DictAction +from mmcv.runner import get_dist_info, init_dist from mmcls import __version__ from mmcls.apis import init_random_seed, set_random_seed, train_model diff --git a/tools/misc/print_config.py b/tools/misc/print_config.py index 31eaf8ed8bb..a2781a607ea 100644 --- a/tools/misc/print_config.py +++ b/tools/misc/print_config.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import argparse -from mmengine.config import Config, DictAction +from mmcv import Config, DictAction def parse_args(): diff --git a/tools/misc/verify_dataset.py b/tools/misc/verify_dataset.py index 7d1a0d45285..6114adb152c 100644 --- a/tools/misc/verify_dataset.py +++ b/tools/misc/verify_dataset.py @@ -4,7 +4,7 @@ import os from pathlib import Path -from mmengine.config import Config, DictAction, track_parallel_progress, track_progress +from mmcv import Config, DictAction, track_parallel_progress, track_progress from mmcls.datasets import PIPELINES, build_dataset diff --git a/tools/test.py b/tools/test.py index f58e917657c..4ade85fca60 100644 --- a/tools/test.py +++ b/tools/test.py @@ -9,7 +9,7 @@ import torch from mmcv import DictAction from mmcv.parallel import MMDataParallel, MMDistributedDataParallel -from mmengine.runner import (get_dist_info, init_dist, load_checkpoint, +from mmcv.runner import (get_dist_info, init_dist, load_checkpoint, wrap_fp16_model) from mmcls.apis import multi_gpu_test, single_gpu_test diff --git a/tools/train.py b/tools/train.py index d279bc7f83c..cf21c93a5ee 100644 --- a/tools/train.py +++ b/tools/train.py @@ -9,8 +9,8 @@ import mmcv import torch import torch.distributed as dist -from mmengine.config import Config, DictAction -from mmengine.dist.utils import get_dist_info, init_dist +from mmcv import Config, DictAction +from mmcv.runner import get_dist_info, init_dist from mmcls import __version__ from mmcls.apis import init_random_seed, set_random_seed, train_model diff --git a/tools/visualizations/vis_cam.py b/tools/visualizations/vis_cam.py index bf7af333d36..a1fcadac232 100644 --- a/tools/visualizations/vis_cam.py +++ b/tools/visualizations/vis_cam.py @@ -8,7 +8,7 @@ import mmcv import numpy as np -from mmengine.config import Config, DictAction +from mmcv import Config, DictAction from mmcv.utils import to_2tuple from torch.nn import BatchNorm1d, BatchNorm2d, GroupNorm, LayerNorm diff --git a/tools/visualizations/vis_lr.py b/tools/visualizations/vis_lr.py index 557321a0797..bd34421505b 100644 --- a/tools/visualizations/vis_lr.py +++ b/tools/visualizations/vis_lr.py @@ -9,8 +9,8 @@ import matplotlib.pyplot as plt import mmcv import torch.nn as nn -from mmengine.config import Config, DictAction, ProgressBar -from mmengine.runner import (EpochBasedRunner, IterBasedRunner, IterLoader, +from mmcv import Config, DictAction, ProgressBar +from mmcv.runner import (EpochBasedRunner, IterBasedRunner, IterLoader, build_optimizer) from torch.utils.data import DataLoader diff --git a/tools/visualizations/vis_pipeline.py b/tools/visualizations/vis_pipeline.py index 268a5bdfec2..ffb9b183c5c 100644 --- a/tools/visualizations/vis_pipeline.py +++ b/tools/visualizations/vis_pipeline.py @@ -12,7 +12,7 @@ import cv2 import mmcv import numpy as np -from mmengine.config import Config, DictAction, ProgressBar +from mmcv import Config, DictAction, ProgressBar from mmcls.core import visualization as vis from mmcls.datasets.builder import PIPELINES, build_dataset, build_from_cfg