From 58630571edbda26b6e74eee474c73225218ac396 Mon Sep 17 00:00:00 2001 From: "zhenxiong.duan1109" Date: Mon, 30 Oct 2023 15:45:27 +0800 Subject: [PATCH] new version of config adapts ResNet --- .../configs/_base_/datasets/imagenet_bs64.py | 60 +++++++++++++++++++ mmpretrain/configs/_base_/models/resnet101.py | 23 +++++++ .../configs/_base_/models/resnet101_cifar.py | 22 +++++++ mmpretrain/configs/_base_/models/resnet152.py | 22 +++++++ .../configs/_base_/models/resnet152_cifar.py | 21 +++++++ .../configs/_base_/models/resnet18_cifar.py | 21 +++++++ mmpretrain/configs/_base_/models/resnet34.py | 22 +++++++ .../configs/_base_/models/resnet34_cifar.py | 21 +++++++ .../configs/_base_/models/resnet34_gem.py | 22 +++++++ mmpretrain/configs/_base_/models/resnet50.py | 22 +++++++ .../configs/_base_/models/resnet50_cifar.py | 21 +++++++ .../_base_/models/resnet50_cifar_mixup.py | 22 +++++++ .../configs/_base_/models/resnet50_cutmix.py | 23 +++++++ .../_base_/schedules/imagenet_bs2048.py | 26 ++++++++ .../_base_/schedules/imagenet_bs256_coslr.py | 21 +++++++ .../configs/resnet/resnet101_8xb16_cifar10.py | 9 +++ .../configs/resnet/resnet101_8xb32_in1k.py | 9 +++ .../configs/resnet/resnet152_8xb16_cifar10.py | 9 +++ .../configs/resnet/resnet152_8xb32_in1k.py | 9 +++ .../configs/resnet/resnet18_8xb16_cifar10.py | 9 +++ .../configs/resnet/resnet34_8xb16_cifar10.py | 10 ++++ .../configs/resnet/resnet34_8xb32_in1k.py | 9 +++ .../resnet/resnet50_32xb64-warmup_in1k.py | 9 +++ .../resnet/resnet50_8xb16-mixup_cifar10.py | 9 +++ .../configs/resnet/resnet50_8xb16_cifar10.py | 9 +++ .../resnet50_8xb32-coslr-preciseBN_in1k.py | 23 +++++++ .../resnet/resnet50_8xb32-coslr_in1k.py | 9 +++ .../resnet/resnet50_8xb32-cutmix_in1k.py | 9 +++ .../configs/resnet/resnet50_8xb32_in1k.py | 9 +++ 29 files changed, 510 insertions(+) create mode 100644 mmpretrain/configs/_base_/datasets/imagenet_bs64.py create mode 100644 mmpretrain/configs/_base_/models/resnet101.py create mode 100644 mmpretrain/configs/_base_/models/resnet101_cifar.py create mode 100644 mmpretrain/configs/_base_/models/resnet152.py create mode 100644 mmpretrain/configs/_base_/models/resnet152_cifar.py create mode 100644 mmpretrain/configs/_base_/models/resnet18_cifar.py create mode 100644 mmpretrain/configs/_base_/models/resnet34.py create mode 100644 mmpretrain/configs/_base_/models/resnet34_cifar.py create mode 100644 mmpretrain/configs/_base_/models/resnet34_gem.py create mode 100644 mmpretrain/configs/_base_/models/resnet50.py create mode 100644 mmpretrain/configs/_base_/models/resnet50_cifar.py create mode 100644 mmpretrain/configs/_base_/models/resnet50_cifar_mixup.py create mode 100644 mmpretrain/configs/_base_/models/resnet50_cutmix.py create mode 100644 mmpretrain/configs/_base_/schedules/imagenet_bs2048.py create mode 100644 mmpretrain/configs/_base_/schedules/imagenet_bs256_coslr.py create mode 100644 mmpretrain/configs/resnet/resnet101_8xb16_cifar10.py create mode 100644 mmpretrain/configs/resnet/resnet101_8xb32_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet152_8xb16_cifar10.py create mode 100644 mmpretrain/configs/resnet/resnet152_8xb32_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet18_8xb16_cifar10.py create mode 100644 mmpretrain/configs/resnet/resnet34_8xb16_cifar10.py create mode 100644 mmpretrain/configs/resnet/resnet34_8xb32_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet50_32xb64-warmup_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet50_8xb16-mixup_cifar10.py create mode 100644 mmpretrain/configs/resnet/resnet50_8xb16_cifar10.py create mode 100644 mmpretrain/configs/resnet/resnet50_8xb32-coslr-preciseBN_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet50_8xb32-coslr_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet50_8xb32-cutmix_in1k.py create mode 100644 mmpretrain/configs/resnet/resnet50_8xb32_in1k.py diff --git a/mmpretrain/configs/_base_/datasets/imagenet_bs64.py b/mmpretrain/configs/_base_/datasets/imagenet_bs64.py new file mode 100644 index 00000000..2284b162 --- /dev/null +++ b/mmpretrain/configs/_base_/datasets/imagenet_bs64.py @@ -0,0 +1,60 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.dataset import DefaultSampler + +from mmpretrain.datasets import (CenterCrop, ImageNet, LoadImageFromFile, + PackInputs, RandomFlip, RandomResizedCrop, + ResizeEdge) +from mmpretrain.evaluation import Accuracy + +# dataset settings +dataset_type = ImageNet +data_preprocessor = dict( + num_classes=1000, + # RGB format normalization parameters + mean=[123.675, 116.28, 103.53], + std=[58.395, 57.12, 57.375], + # convert image from BGR to RGB + to_rgb=True, +) + +train_pipeline = [ + dict(type=LoadImageFromFile), + dict(type=RandomResizedCrop, scale=224), + dict(type=RandomFlip, prob=0.5, direction='horizontal'), + dict(type=PackInputs), +] + +test_pipeline = [ + dict(type=LoadImageFromFile), + dict(type=ResizeEdge, scale=256, edge='short'), + dict(type=CenterCrop, crop_size=224), + dict(type=PackInputs), +] + +train_dataloader = dict( + batch_size=64, + num_workers=5, + dataset=dict( + type=dataset_type, + data_root='data/imagenet', + split='train', + pipeline=train_pipeline), + sampler=dict(type=DefaultSampler, shuffle=True), +) + +val_dataloader = dict( + batch_size=64, + num_workers=5, + dataset=dict( + type=dataset_type, + data_root='data/imagenet', + split='val', + pipeline=test_pipeline), + sampler=dict(type=DefaultSampler, shuffle=False), +) +val_evaluator = dict(type=Accuracy, topk=(1, 5)) + +# If you want standard test, please manually configure the test dataset +test_dataloader = val_dataloader +test_evaluator = val_evaluator diff --git a/mmpretrain/configs/_base_/models/resnet101.py b/mmpretrain/configs/_base_/models/resnet101.py new file mode 100644 index 00000000..ca37353b --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet101.py @@ -0,0 +1,23 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet, + depth=101, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + topk=(1, 5), + )) + diff --git a/mmpretrain/configs/_base_/models/resnet101_cifar.py b/mmpretrain/configs/_base_/models/resnet101_cifar.py new file mode 100644 index 00000000..ab217ec7 --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet101_cifar.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet_CIFAR) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet_CIFAR, + depth=101, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + )) + diff --git a/mmpretrain/configs/_base_/models/resnet152.py b/mmpretrain/configs/_base_/models/resnet152.py new file mode 100644 index 00000000..759f6832 --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet152.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet, + depth=152, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + topk=(1, 5), + )) diff --git a/mmpretrain/configs/_base_/models/resnet152_cifar.py b/mmpretrain/configs/_base_/models/resnet152_cifar.py new file mode 100644 index 00000000..1de83e5d --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet152_cifar.py @@ -0,0 +1,21 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet_CIFAR) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet_CIFAR, + depth=152, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + )) diff --git a/mmpretrain/configs/_base_/models/resnet18_cifar.py b/mmpretrain/configs/_base_/models/resnet18_cifar.py new file mode 100644 index 00000000..62aa4d8c --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet18_cifar.py @@ -0,0 +1,21 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet_CIFAR) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet_CIFAR, + depth=18, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=10, + in_channels=512, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + )) \ No newline at end of file diff --git a/mmpretrain/configs/_base_/models/resnet34.py b/mmpretrain/configs/_base_/models/resnet34.py new file mode 100644 index 00000000..f563a24c --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet34.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet, + depth=34, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=512, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + topk=(1, 5), + )) diff --git a/mmpretrain/configs/_base_/models/resnet34_cifar.py b/mmpretrain/configs/_base_/models/resnet34_cifar.py new file mode 100644 index 00000000..98b74559 --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet34_cifar.py @@ -0,0 +1,21 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet_CIFAR) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet_CIFAR, + depth=34, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=10, + in_channels=512, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + )) \ No newline at end of file diff --git a/mmpretrain/configs/_base_/models/resnet34_gem.py b/mmpretrain/configs/_base_/models/resnet34_gem.py new file mode 100644 index 00000000..711f36e7 --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet34_gem.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GeneralizedMeanPooling, + ImageClassifier, LinearClsHead, ResNet) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet, + depth=34, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GeneralizedMeanPooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=512, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + topk=(1, 5), + )) diff --git a/mmpretrain/configs/_base_/models/resnet50.py b/mmpretrain/configs/_base_/models/resnet50.py new file mode 100644 index 00000000..1540417c --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet50.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet, + depth=50, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=1000, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + topk=(1, 5), + )) \ No newline at end of file diff --git a/mmpretrain/configs/_base_/models/resnet50_cifar.py b/mmpretrain/configs/_base_/models/resnet50_cifar.py new file mode 100644 index 00000000..89658764 --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet50_cifar.py @@ -0,0 +1,21 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, LinearClsHead, ResNet_CIFAR) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet_CIFAR, + depth=50, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=LinearClsHead, + num_classes=10, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0), + )) diff --git a/mmpretrain/configs/_base_/models/resnet50_cifar_mixup.py b/mmpretrain/configs/_base_/models/resnet50_cifar_mixup.py new file mode 100644 index 00000000..2f9df893 --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet50_cifar_mixup.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, MultiLabelLinearClsHead, ResNet_CIFAR, Mixup) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet_CIFAR, + depth=50, + num_stages=4, + out_indices=(3,), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=MultiLabelLinearClsHead, + num_classes=10, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0, use_soft=True)), + train_cfg=dict(augments=dict(type=Mixup, alpha=1.)), +) diff --git a/mmpretrain/configs/_base_/models/resnet50_cutmix.py b/mmpretrain/configs/_base_/models/resnet50_cutmix.py new file mode 100644 index 00000000..144eafec --- /dev/null +++ b/mmpretrain/configs/_base_/models/resnet50_cutmix.py @@ -0,0 +1,23 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmpretrain.models import (CrossEntropyLoss, GlobalAveragePooling, + ImageClassifier, MultiLabelLinearClsHead, ResNet, CutMix) + +# model settings +model = dict( + type=ImageClassifier, + backbone=dict( + type=ResNet, + depth=50, + num_stages=4, + out_indices=(3,), + style='pytorch'), + neck=dict(type=GlobalAveragePooling), + head=dict( + type=MultiLabelLinearClsHead, + num_classes=1000, + in_channels=2048, + loss=dict(type=CrossEntropyLoss, loss_weight=1.0, use_soft=True)), + train_cfg=dict(augments=dict(type=CutMix, alpha=1.0, num_classes=1000, prob=1.0)), +) + diff --git a/mmpretrain/configs/_base_/schedules/imagenet_bs2048.py b/mmpretrain/configs/_base_/schedules/imagenet_bs2048.py new file mode 100644 index 00000000..49f04583 --- /dev/null +++ b/mmpretrain/configs/_base_/schedules/imagenet_bs2048.py @@ -0,0 +1,26 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.optim import MultiStepLR, LinearLR +from torch.optim import SGD + +# optimizer +optim_wrapper = dict( + optimizer=dict( + type=SGD, lr=0.8, momentum=0.9, weight_decay=0.0001, nesterov=True)) + +# learning policy +param_scheduler = [ + dict( + type=LinearLR, start_factor=0.25, by_epoch=False, begin=0, end=2500), + dict( + type=MultiStepLR, by_epoch=True, milestones=[30, 60, 90], gamma=0.1) +] + +# train, val, test setting +train_cfg = dict(by_epoch=True, max_epochs=100, val_interval=1) +val_cfg = dict() +test_cfg = dict() + +# NOTE: `auto_scale_lr` is for automatically scaling LR, +# based on the actual training batch size. +auto_scale_lr = dict(base_batch_size=2048) diff --git a/mmpretrain/configs/_base_/schedules/imagenet_bs256_coslr.py b/mmpretrain/configs/_base_/schedules/imagenet_bs256_coslr.py new file mode 100644 index 00000000..33d31cd0 --- /dev/null +++ b/mmpretrain/configs/_base_/schedules/imagenet_bs256_coslr.py @@ -0,0 +1,21 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.optim import CosineAnnealingLR +from torch.optim import SGD + +# optimizer +optim_wrapper = dict( + optimizer=dict(type=SGD, lr=0.1, momentum=0.9, weight_decay=0.0001)) + +# learning policy +param_scheduler = dict( + type=CosineAnnealingLR, T_max=100, by_epoch=True, begin=0, end=100) + +# train, val, test setting +train_cfg = dict(by_epoch=True, max_epochs=100, val_interval=1) +val_cfg = dict() +test_cfg = dict() + +# NOTE: `auto_scale_lr` is for automatically scaling LR, +# based on the actual training batch size. +auto_scale_lr = dict(base_batch_size=256) diff --git a/mmpretrain/configs/resnet/resnet101_8xb16_cifar10.py b/mmpretrain/configs/resnet/resnet101_8xb16_cifar10.py new file mode 100644 index 00000000..30e54dc7 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet101_8xb16_cifar10.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.cifar10_bs16 import * + from .._base_.default_runtime import * + from .._base_.models.resnet101_cifar import * + from .._base_.schedules.cifar10_bs128 import * diff --git a/mmpretrain/configs/resnet/resnet101_8xb32_in1k.py b/mmpretrain/configs/resnet/resnet101_8xb32_in1k.py new file mode 100644 index 00000000..bdd0121e --- /dev/null +++ b/mmpretrain/configs/resnet/resnet101_8xb32_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet101 import * + from .._base_.schedules.imagenet_bs256 import * diff --git a/mmpretrain/configs/resnet/resnet152_8xb16_cifar10.py b/mmpretrain/configs/resnet/resnet152_8xb16_cifar10.py new file mode 100644 index 00000000..02c16753 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet152_8xb16_cifar10.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.cifar10_bs16 import * + from .._base_.default_runtime import * + from .._base_.models.resnet152_cifar import * + from .._base_.schedules.cifar10_bs128 import * diff --git a/mmpretrain/configs/resnet/resnet152_8xb32_in1k.py b/mmpretrain/configs/resnet/resnet152_8xb32_in1k.py new file mode 100644 index 00000000..7439eca6 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet152_8xb32_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet152 import * + from .._base_.schedules.imagenet_bs256 import * diff --git a/mmpretrain/configs/resnet/resnet18_8xb16_cifar10.py b/mmpretrain/configs/resnet/resnet18_8xb16_cifar10.py new file mode 100644 index 00000000..9fa5627d --- /dev/null +++ b/mmpretrain/configs/resnet/resnet18_8xb16_cifar10.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.cifar10_bs16 import * + from .._base_.default_runtime import * + from .._base_.models.resnet18_cifar import * + from .._base_.schedules.cifar10_bs128 import * diff --git a/mmpretrain/configs/resnet/resnet34_8xb16_cifar10.py b/mmpretrain/configs/resnet/resnet34_8xb16_cifar10.py new file mode 100644 index 00000000..f020567a --- /dev/null +++ b/mmpretrain/configs/resnet/resnet34_8xb16_cifar10.py @@ -0,0 +1,10 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.cifar10_bs16 import * + from .._base_.default_runtime import * + from .._base_.models.resnet34_cifar import * + from .._base_.schedules.cifar10_bs128 import * + diff --git a/mmpretrain/configs/resnet/resnet34_8xb32_in1k.py b/mmpretrain/configs/resnet/resnet34_8xb32_in1k.py new file mode 100644 index 00000000..086344f7 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet34_8xb32_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet34 import * + from .._base_.schedules.imagenet_bs256 import * \ No newline at end of file diff --git a/mmpretrain/configs/resnet/resnet50_32xb64-warmup_in1k.py b/mmpretrain/configs/resnet/resnet50_32xb64-warmup_in1k.py new file mode 100644 index 00000000..3070d59f --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_32xb64-warmup_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs64 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50 import * + from .._base_.schedules.imagenet_bs2048 import * diff --git a/mmpretrain/configs/resnet/resnet50_8xb16-mixup_cifar10.py b/mmpretrain/configs/resnet/resnet50_8xb16-mixup_cifar10.py new file mode 100644 index 00000000..43035176 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_8xb16-mixup_cifar10.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.cifar10_bs16 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50_cifar_mixup import * + from .._base_.schedules.cifar10_bs128 import * diff --git a/mmpretrain/configs/resnet/resnet50_8xb16_cifar10.py b/mmpretrain/configs/resnet/resnet50_8xb16_cifar10.py new file mode 100644 index 00000000..6ae2703f --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_8xb16_cifar10.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.cifar10_bs16 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50_cifar import * + from .._base_.schedules.cifar10_bs128 import * diff --git a/mmpretrain/configs/resnet/resnet50_8xb32-coslr-preciseBN_in1k.py b/mmpretrain/configs/resnet/resnet50_8xb32-coslr-preciseBN_in1k.py new file mode 100644 index 00000000..b84c5c23 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_8xb32-coslr-preciseBN_in1k.py @@ -0,0 +1,23 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +from mmpretrain.engine import PreciseBNHook + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50 import * + from .._base_.schedules.imagenet_bs256_coslr import * + +# Precise BN hook will update the bn stats, so this hook should be executed +# before CheckpointHook(priority of 'VERY_LOW') and +# EMAHook(priority of 'NORMAL') So set the priority of PreciseBNHook to +# 'ABOVENORMAL' here. +custom_hooks = [ + dict( + type=PreciseBNHook, + num_samples=8192, + interval=1, + priority='ABOVE_NORMAL') +] diff --git a/mmpretrain/configs/resnet/resnet50_8xb32-coslr_in1k.py b/mmpretrain/configs/resnet/resnet50_8xb32-coslr_in1k.py new file mode 100644 index 00000000..42f573c4 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_8xb32-coslr_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50 import * + from .._base_.schedules.imagenet_bs256_coslr import * diff --git a/mmpretrain/configs/resnet/resnet50_8xb32-cutmix_in1k.py b/mmpretrain/configs/resnet/resnet50_8xb32-cutmix_in1k.py new file mode 100644 index 00000000..d1c7addc --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_8xb32-cutmix_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50_cutmix import * + from .._base_.schedules.imagenet_bs256 import * diff --git a/mmpretrain/configs/resnet/resnet50_8xb32_in1k.py b/mmpretrain/configs/resnet/resnet50_8xb32_in1k.py new file mode 100644 index 00000000..75297f14 --- /dev/null +++ b/mmpretrain/configs/resnet/resnet50_8xb32_in1k.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# This is a BETA new format config file, and the usage may change recently. +from mmengine.config import read_base + +with read_base(): + from .._base_.datasets.imagenet_bs32 import * + from .._base_.default_runtime import * + from .._base_.models.resnet50 import * + from .._base_.schedules.imagenet_bs256 import *