Skip to content

Commit

Permalink
set arch etc
Browse files Browse the repository at this point in the history
  • Loading branch information
timerring committed Sep 6, 2023
1 parent b0b4422 commit 7734f07
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
# model settings
checkpoint = 'https://download.openmmlab.com/mmclassification/v0/swin-transformer/convert/swin-large_3rdparty_in21k-384px.pth' # noqa

model = dict(
type=ImageClassifier,
model.update(
backbone=dict(
arch='large',
init_cfg=dict(
type=PretrainedInit, checkpoint=checkpoint, prefix='backbone')),
head=dict(num_classes=200, ))
head=dict(num_classes=200, in_channels=1536))

# schedule settings
optim_wrapper = dict(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +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
from mmengine.model import ConstantInit, TruncNormalInit

from mmpretrain.models import CutMix, Mixup

with read_base():
from .._base_.datasets.imagenet21k_bs128 import *
Expand All @@ -9,10 +12,17 @@
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

# model settings
model = dict(
backbone=dict(img_size=192, window_size=[12, 12, 12, 6]),
model.update(
backbone=dict(
img_size=192, drop_path_rate=0.5, window_size=[12, 12, 12, 6]),
head=dict(num_classes=21841),
)
init_cfg=[
dict(type=TruncNormalInit, layer='Linear', std=0.02, bias=0.),
dict(type=ConstantInit, layer='LayerNorm', val=1., bias=0.)
],
train_cfg=dict(
augments=[dict(type=Mixup, alpha=0.8),
dict(type=CutMix, alpha=1.0)]))

# dataset settings
data_preprocessor = dict(num_classes=21841)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# 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 mmengine.model import ConstantInit, TruncNormalInit

from mmpretrain.models import CutMix, Mixup

with read_base():
from .._base_.datasets.imagenet_bs64_swin_256 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(backbone=dict(window_size=[16, 16, 16, 8]))
# model settings
model.update(
backbone=dict(
img_size=256, drop_path_rate=0.5, window_size=[16, 16, 16, 8]),
init_cfg=[
dict(type=TruncNormalInit, layer='Linear', std=0.02, bias=0.),
dict(type=ConstantInit, layer='LayerNorm', val=1., bias=0.)
],
train_cfg=dict(
augments=[dict(type=Mixup, alpha=0.8),
dict(type=CutMix, alpha=1.0)]))
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
# 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 mmengine.model import ConstantInit, TruncNormalInit

from mmpretrain.models import ImageClassifier
from mmpretrain.models import CutMix, Mixup

with read_base():
from .._base_.datasets.imagenet_bs64_swin_256 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(
type=ImageClassifier,
# model settings
model.update(
backbone=dict(
img_size=256,
window_size=[16, 16, 16, 8],
drop_path_rate=0.2,
pretrained_window_sizes=[12, 12, 12, 6]))
pretrained_window_sizes=[12, 12, 12, 6]),
init_cfg=[
dict(type=TruncNormalInit, layer='Linear', std=0.02, bias=0.),
dict(type=ConstantInit, layer='LayerNorm', val=1., bias=0.)
],
train_cfg=dict(
augments=[dict(type=Mixup, alpha=0.8),
dict(type=CutMix, alpha=1.0)]))
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
# This is a BETA new format config file, and the usage may change recently.
from mmengine.config import read_base

from mmpretrain.models import ImageClassifier

with read_base():
from .._base_.datasets.imagenet_bs64_swin_384 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(
type=ImageClassifier,
# model settings
model.update(
backbone=dict(
img_size=384,
window_size=[24, 24, 24, 12],
drop_path_rate=0.2,
pretrained_window_sizes=[12, 12, 12, 6]))
window_size=[24, 24, 24, 12], pretrained_window_sizes=[12, 12, 12, 6]))
Original file line number Diff line number Diff line change
@@ -1,6 +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
from mmengine.model import ConstantInit, TruncNormalInit

from mmpretrain.models import CutMix, Mixup

with read_base():
from .._base_.datasets.imagenet21k_bs128 import *
Expand All @@ -9,10 +12,17 @@
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

# model settings
model = dict(
backbone=dict(img_size=192, window_size=[12, 12, 12, 6]),
model.update(
backbone=dict(
img_size=192, drop_path_rate=0.5, window_size=[12, 12, 12, 6]),
head=dict(num_classes=21841),
)
init_cfg=[
dict(type=TruncNormalInit, layer='Linear', std=0.02, bias=0.),
dict(type=ConstantInit, layer='LayerNorm', val=1., bias=0.)
],
train_cfg=dict(
augments=[dict(type=Mixup, alpha=0.8),
dict(type=CutMix, alpha=1.0)]))

# dataset settings
data_preprocessor = dict(num_classes=21841)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
# This is a BETA new format config file, and the usage may change recently.
from mmengine.config import read_base

from mmpretrain.models import ImageClassifier
from mmpretrain.models import CrossEntropyLoss

with read_base():
from .._base_.datasets.imagenet_bs64_swin_256 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(
type=ImageClassifier,
# model settings
model.update(
backbone=dict(
window_size=[16, 16, 16, 8], pretrained_window_sizes=[12, 12, 12, 6]),
)
arch='large',
img_size=256,
window_size=[16, 16, 16, 8],
pretrained_window_sizes=[12, 12, 12, 6]),
head=dict(
in_channels=1536,
loss=dict(type=CrossEntropyLoss, loss_weight=1.0),
topk=(1, 5)))
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
# This is a BETA new format config file, and the usage may change recently.
from mmengine.config import read_base

from mmpretrain.models import ImageClassifier
from mmpretrain.models import CrossEntropyLoss

with read_base():
from .._base_.datasets.imagenet_bs64_swin_384 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(
type=ImageClassifier,
# model settings
model.update(
backbone=dict(
arch='large',
img_size=384,
window_size=[24, 24, 24, 12],
pretrained_window_sizes=[12, 12, 12, 6]),
)
head=dict(
in_channels=1536,
loss=dict(type=CrossEntropyLoss, loss_weight=1.0),
topk=(1, 5)))
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
# 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 mmengine.model import ConstantInit, TruncNormalInit

from mmpretrain.models import CutMix, Mixup

with read_base():
from .._base_.datasets.imagenet_bs64_swin_256 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(backbone=dict(window_size=[16, 16, 16, 8]))
# model settings
model.update(
backbone=dict(
arch='small',
img_size=256,
drop_path_rate=0.3,
window_size=[16, 16, 16, 8]),
head=dict(in_channels=768),
init_cfg=[
dict(type=TruncNormalInit, layer='Linear', std=0.02, bias=0.),
dict(type=ConstantInit, layer='LayerNorm', val=1., bias=0.)
],
train_cfg=dict(
augments=[dict(type=Mixup, alpha=0.8),
dict(type=CutMix, alpha=1.0)]))
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
# 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 mmengine.model import ConstantInit, TruncNormalInit

from mmpretrain.models import CutMix, Mixup

with read_base():
from .._base_.datasets.imagenet_bs64_swin_256 import *
from .._base_.default_runtime import *
from .._base_.models.swin_transformer_v2_base import *
from .._base_.schedules.imagenet_bs1024_adamw_swin import *

model = dict(backbone=dict(window_size=[16, 16, 16, 8]))
# model settings
model.update(
backbone=dict(
arch='tiny',
img_size=256,
drop_path_rate=0.2,
window_size=[16, 16, 16, 8]),
head=dict(in_channels=768),
init_cfg=[
dict(type=TruncNormalInit, layer='Linear', std=0.02, bias=0.),
dict(type=ConstantInit, layer='LayerNorm', val=1., bias=0.)
],
train_cfg=dict(
augments=[dict(type=Mixup, alpha=0.8),
dict(type=CutMix, alpha=1.0)]))

0 comments on commit 7734f07

Please sign in to comment.