Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmpretrain
Commits
cbc25585
Commit
cbc25585
authored
Jun 24, 2025
by
limm
Browse files
add mmpretrain/ part
parent
1baf0566
Pipeline
#2801
canceled with stages
Changes
458
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
864 additions
and
0 deletions
+864
-0
mmpretrain/configs/_base_/datasets/imagenet_bs32_simclr.py
mmpretrain/configs/_base_/datasets/imagenet_bs32_simclr.py
+63
-0
mmpretrain/configs/_base_/datasets/imagenet_bs512_mae.py
mmpretrain/configs/_base_/datasets/imagenet_bs512_mae.py
+40
-0
mmpretrain/configs/_base_/datasets/imagenet_bs64_pil_resize.py
...train/configs/_base_/datasets/imagenet_bs64_pil_resize.py
+60
-0
mmpretrain/configs/_base_/datasets/imagenet_bs64_pil_resize_autoaug.py
...nfigs/_base_/datasets/imagenet_bs64_pil_resize_autoaug.py
+78
-0
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_224.py
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_224.py
+89
-0
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_256.py
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_256.py
+89
-0
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_384.py
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_384.py
+64
-0
mmpretrain/configs/_base_/default_runtime.py
mmpretrain/configs/_base_/default_runtime.py
+61
-0
mmpretrain/configs/_base_/models/convnext_base.py
mmpretrain/configs/_base_/models/convnext_base.py
+25
-0
mmpretrain/configs/_base_/models/mae_hivit_base_p16.py
mmpretrain/configs/_base_/models/mae_hivit_base_p16.py
+28
-0
mmpretrain/configs/_base_/models/mae_vit_base_p16.py
mmpretrain/configs/_base_/models/mae_vit_base_p16.py
+28
-0
mmpretrain/configs/_base_/models/mobilenet_v2_1x.py
mmpretrain/configs/_base_/models/mobilenet_v2_1x.py
+17
-0
mmpretrain/configs/_base_/models/mobilenet_v3_small.py
mmpretrain/configs/_base_/models/mobilenet_v3_small.py
+25
-0
mmpretrain/configs/_base_/models/resnet18.py
mmpretrain/configs/_base_/models/resnet18.py
+22
-0
mmpretrain/configs/_base_/models/swin_transformer_base.py
mmpretrain/configs/_base_/models/swin_transformer_base.py
+20
-0
mmpretrain/configs/_base_/models/swin_transformer_v2_base.py
mmpretrain/configs/_base_/models/swin_transformer_v2_base.py
+19
-0
mmpretrain/configs/_base_/models/vit_base_p16.py
mmpretrain/configs/_base_/models/vit_base_p16.py
+31
-0
mmpretrain/configs/_base_/schedules/cifar10_bs128.py
mmpretrain/configs/_base_/schedules/cifar10_bs128.py
+20
-0
mmpretrain/configs/_base_/schedules/cub_bs64.py
mmpretrain/configs/_base_/schedules/cub_bs64.py
+39
-0
mmpretrain/configs/_base_/schedules/imagenet_bs1024_adamw_swin.py
...in/configs/_base_/schedules/imagenet_bs1024_adamw_swin.py
+46
-0
No files found.
mmpretrain/configs/_base_/datasets/imagenet_bs32_simclr.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmcv.transforms
import
(
LoadImageFromFile
,
RandomApply
,
RandomFlip
,
RandomGrayscale
)
from
mmengine.dataset
import
DefaultSampler
,
default_collate
from
mmpretrain.datasets
import
(
ColorJitter
,
GaussianBlur
,
ImageNet
,
MultiView
,
PackInputs
,
RandomResizedCrop
)
from
mmpretrain.models
import
SelfSupDataPreprocessor
# dataset settings
dataset_type
=
ImageNet
data_root
=
'data/imagenet/'
data_preprocessor
=
dict
(
type
=
SelfSupDataPreprocessor
,
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
view_pipeline
=
[
dict
(
type
=
RandomResizedCrop
,
scale
=
224
,
backend
=
'pillow'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
),
dict
(
type
=
RandomApply
,
transforms
=
[
dict
(
type
=
ColorJitter
,
brightness
=
0.8
,
contrast
=
0.8
,
saturation
=
0.8
,
hue
=
0.2
)
],
prob
=
0.8
),
dict
(
type
=
RandomGrayscale
,
prob
=
0.2
,
keep_channels
=
True
,
channel_weights
=
(
0.114
,
0.587
,
0.2989
)),
dict
(
type
=
GaussianBlur
,
magnitude_range
=
(
0.1
,
2.0
),
magnitude_std
=
'inf'
,
prob
=
0.5
),
]
train_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
MultiView
,
num_views
=
2
,
transforms
=
[
view_pipeline
]),
dict
(
type
=
PackInputs
)
]
train_dataloader
=
dict
(
batch_size
=
32
,
num_workers
=
4
,
persistent_workers
=
True
,
sampler
=
dict
(
type
=
DefaultSampler
,
shuffle
=
True
),
collate_fn
=
dict
(
type
=
default_collate
),
dataset
=
dict
(
type
=
ImageNet
,
data_root
=
data_root
,
ann_file
=
'meta/train.txt'
,
data_prefix
=
dict
(
img_path
=
'train/'
),
pipeline
=
train_pipeline
))
mmpretrain/configs/_base_/datasets/imagenet_bs512_mae.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmcv.transforms
import
LoadImageFromFile
,
RandomFlip
from
mmengine.dataset.sampler
import
DefaultSampler
from
mmpretrain.datasets
import
ImageNet
,
PackInputs
,
RandomResizedCrop
from
mmpretrain.models
import
SelfSupDataPreprocessor
# dataset settings
dataset_type
=
ImageNet
data_root
=
'data/imagenet/'
data_preprocessor
=
dict
(
type
=
SelfSupDataPreprocessor
,
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
train_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
RandomResizedCrop
,
scale
=
224
,
crop_ratio_range
=
(
0.2
,
1.0
),
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
),
dict
(
type
=
PackInputs
)
]
train_dataloader
=
dict
(
batch_size
=
512
,
num_workers
=
8
,
persistent_workers
=
True
,
sampler
=
dict
(
type
=
DefaultSampler
,
shuffle
=
True
),
collate_fn
=
dict
(
type
=
'default_collate'
),
dataset
=
dict
(
type
=
dataset_type
,
data_root
=
data_root
,
split
=
'train'
,
pipeline
=
train_pipeline
))
mmpretrain/configs/_base_/datasets/imagenet_bs64_pil_resize.py
0 → 100644
View file @
cbc25585
# 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
,
backend
=
'pillow'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
,
direction
=
'horizontal'
),
dict
(
type
=
PackInputs
),
]
test_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
ResizeEdge
,
scale
=
256
,
edge
=
'short'
,
backend
=
'pillow'
),
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
mmpretrain/configs/_base_/datasets/imagenet_bs64_pil_resize_autoaug.py
0 → 100644
View file @
cbc25585
# 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.datasets.transforms
import
AutoAugment
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
,
)
bgr_mean
=
data_preprocessor
[
'mean'
][::
-
1
]
bgr_std
=
data_preprocessor
[
'std'
][::
-
1
]
train_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
RandomResizedCrop
,
scale
=
224
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
,
direction
=
'horizontal'
),
dict
(
type
=
AutoAugment
,
policies
=
'imagenet'
,
hparams
=
dict
(
pad_val
=
[
round
(
x
)
for
x
in
bgr_mean
],
interpolation
=
'bicubic'
)),
dict
(
type
=
PackInputs
),
]
test_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
ResizeEdge
,
scale
=
256
,
edge
=
'short'
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
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
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_224.py
0 → 100644
View file @
cbc25585
# 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
,
RandAugment
,
RandomErasing
,
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
,
)
bgr_mean
=
data_preprocessor
[
'mean'
][::
-
1
]
bgr_std
=
data_preprocessor
[
'std'
][::
-
1
]
train_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
RandomResizedCrop
,
scale
=
224
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
,
direction
=
'horizontal'
),
dict
(
type
=
RandAugment
,
policies
=
'timm_increasing'
,
num_policies
=
2
,
total_level
=
10
,
magnitude_level
=
9
,
magnitude_std
=
0.5
,
hparams
=
dict
(
pad_val
=
[
round
(
x
)
for
x
in
bgr_mean
],
interpolation
=
'bicubic'
)),
dict
(
type
=
RandomErasing
,
erase_prob
=
0.25
,
mode
=
'rand'
,
min_area_ratio
=
0.02
,
max_area_ratio
=
1
/
3
,
fill_color
=
bgr_mean
,
fill_std
=
bgr_std
),
dict
(
type
=
PackInputs
),
]
test_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
ResizeEdge
,
scale
=
256
,
edge
=
'short'
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
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
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_256.py
0 → 100644
View file @
cbc25585
# 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
,
RandAugment
,
RandomErasing
,
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
,
)
bgr_mean
=
data_preprocessor
[
'mean'
][::
-
1
]
bgr_std
=
data_preprocessor
[
'std'
][::
-
1
]
train_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
RandomResizedCrop
,
scale
=
256
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
,
direction
=
'horizontal'
),
dict
(
type
=
RandAugment
,
policies
=
'timm_increasing'
,
num_policies
=
2
,
total_level
=
10
,
magnitude_level
=
9
,
magnitude_std
=
0.5
,
hparams
=
dict
(
pad_val
=
[
round
(
x
)
for
x
in
bgr_mean
],
interpolation
=
'bicubic'
)),
dict
(
type
=
RandomErasing
,
erase_prob
=
0.25
,
mode
=
'rand'
,
min_area_ratio
=
0.02
,
max_area_ratio
=
1
/
3
,
fill_color
=
bgr_mean
,
fill_std
=
bgr_std
),
dict
(
type
=
PackInputs
),
]
test_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
ResizeEdge
,
scale
=
292
,
# ( 256 / 224 * 256 )
edge
=
'short'
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
CenterCrop
,
crop_size
=
256
),
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
mmpretrain/configs/_base_/datasets/imagenet_bs64_swin_384.py
0 → 100644
View file @
cbc25585
# 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
(
ImageNet
,
LoadImageFromFile
,
PackInputs
,
RandomFlip
,
RandomResizedCrop
,
Resize
)
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
=
384
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
RandomFlip
,
prob
=
0.5
,
direction
=
'horizontal'
),
dict
(
type
=
PackInputs
),
]
test_pipeline
=
[
dict
(
type
=
LoadImageFromFile
),
dict
(
type
=
Resize
,
scale
=
384
,
backend
=
'pillow'
,
interpolation
=
'bicubic'
),
dict
(
type
=
PackInputs
),
]
train_dataloader
=
dict
(
batch_size
=
64
,
num_workers
=
5
,
dataset
=
dict
(
type
=
dataset_type
,
data_root
=
'data/imagenet'
,
ann_file
=
'meta/train.txt'
,
data_prefix
=
'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'
,
ann_file
=
'meta/val.txt'
,
data_prefix
=
'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
mmpretrain/configs/_base_/default_runtime.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmengine.hooks
import
(
CheckpointHook
,
DistSamplerSeedHook
,
IterTimerHook
,
LoggerHook
,
ParamSchedulerHook
)
from
mmengine.visualization
import
LocalVisBackend
from
mmpretrain.engine.hooks
import
VisualizationHook
from
mmpretrain.visualization
import
UniversalVisualizer
# configure default hooks
default_hooks
=
dict
(
# record the time of every iteration.
timer
=
dict
(
type
=
IterTimerHook
),
# print log every 100 iterations.
logger
=
dict
(
type
=
LoggerHook
,
interval
=
100
),
# enable the parameter scheduler.
param_scheduler
=
dict
(
type
=
ParamSchedulerHook
),
# save checkpoint per epoch.
checkpoint
=
dict
(
type
=
CheckpointHook
,
interval
=
1
),
# set sampler seed in distributed evrionment.
sampler_seed
=
dict
(
type
=
DistSamplerSeedHook
),
# validation results visualization, set True to enable it.
visualization
=
dict
(
type
=
VisualizationHook
,
enable
=
False
),
)
# configure environment
env_cfg
=
dict
(
# whether to enable cudnn benchmark
cudnn_benchmark
=
False
,
# set multi process parameters
mp_cfg
=
dict
(
mp_start_method
=
'fork'
,
opencv_num_threads
=
0
),
# set distributed parameters
dist_cfg
=
dict
(
backend
=
'nccl'
),
)
# set visualizer
vis_backends
=
[
dict
(
type
=
LocalVisBackend
)]
visualizer
=
dict
(
type
=
UniversalVisualizer
,
vis_backends
=
vis_backends
)
# set log level
log_level
=
'INFO'
# load from which checkpoint
load_from
=
None
# whether to resume training from the loaded checkpoint
resume
=
False
# Defaults to use random seed and disable `deterministic`
randomness
=
dict
(
seed
=
None
,
deterministic
=
False
)
# Do not need to specify default_scope with new config. Therefore set it to
# None to avoid BC-breaking.
default_scope
=
None
mmpretrain/configs/_base_/models/convnext_base.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmengine.model
import
TruncNormalInit
from
mmpretrain.models
import
(
ConvNeXt
,
CutMix
,
ImageClassifier
,
LabelSmoothLoss
,
LinearClsHead
,
Mixup
)
# Model settings
model
=
dict
(
type
=
ImageClassifier
,
backbone
=
dict
(
type
=
ConvNeXt
,
arch
=
'base'
,
drop_path_rate
=
0.5
),
head
=
dict
(
type
=
LinearClsHead
,
num_classes
=
1000
,
in_channels
=
1024
,
loss
=
dict
(
type
=
LabelSmoothLoss
,
label_smooth_val
=
0.1
,
mode
=
'original'
),
init_cfg
=
None
,
),
init_cfg
=
dict
(
type
=
TruncNormalInit
,
layer
=
[
'Conv2d'
,
'Linear'
],
std
=
.
02
,
bias
=
0.
),
train_cfg
=
dict
(
augments
=
[
dict
(
type
=
Mixup
,
alpha
=
0.8
),
dict
(
type
=
CutMix
,
alpha
=
1.0
),
]),
)
mmpretrain/configs/_base_/models/mae_hivit_base_p16.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmpretrain.models
import
(
MAE
,
MAEHiViT
,
MAEPretrainDecoder
,
MAEPretrainHead
,
PixelReconstructionLoss
)
# model settings
model
=
dict
(
type
=
MAE
,
backbone
=
dict
(
type
=
MAEHiViT
,
patch_size
=
16
,
arch
=
'base'
,
mask_ratio
=
0.75
),
neck
=
dict
(
type
=
MAEPretrainDecoder
,
patch_size
=
16
,
in_chans
=
3
,
embed_dim
=
512
,
decoder_embed_dim
=
512
,
decoder_depth
=
6
,
decoder_num_heads
=
16
,
mlp_ratio
=
4.
,
),
head
=
dict
(
type
=
MAEPretrainHead
,
norm_pix
=
True
,
patch_size
=
16
,
loss
=
dict
(
type
=
PixelReconstructionLoss
,
criterion
=
'L2'
)),
init_cfg
=
[
dict
(
type
=
'Xavier'
,
layer
=
'Linear'
,
distribution
=
'uniform'
),
dict
(
type
=
'Constant'
,
layer
=
'LayerNorm'
,
val
=
1.0
,
bias
=
0.0
)
])
mmpretrain/configs/_base_/models/mae_vit_base_p16.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmpretrain.models
import
(
MAE
,
MAEPretrainDecoder
,
MAEPretrainHead
,
MAEViT
,
PixelReconstructionLoss
)
# model settings
model
=
dict
(
type
=
MAE
,
backbone
=
dict
(
type
=
MAEViT
,
arch
=
'b'
,
patch_size
=
16
,
mask_ratio
=
0.75
),
neck
=
dict
(
type
=
MAEPretrainDecoder
,
patch_size
=
16
,
in_chans
=
3
,
embed_dim
=
768
,
decoder_embed_dim
=
512
,
decoder_depth
=
8
,
decoder_num_heads
=
16
,
mlp_ratio
=
4.
,
),
head
=
dict
(
type
=
MAEPretrainHead
,
norm_pix
=
True
,
patch_size
=
16
,
loss
=
dict
(
type
=
PixelReconstructionLoss
,
criterion
=
'L2'
)),
init_cfg
=
[
dict
(
type
=
'Xavier'
,
layer
=
'Linear'
,
distribution
=
'uniform'
),
dict
(
type
=
'Constant'
,
layer
=
'LayerNorm'
,
val
=
1.0
,
bias
=
0.0
)
])
mmpretrain/configs/_base_/models/mobilenet_v2_1x.py
0 → 100644
View file @
cbc25585
# 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
,
MobileNetV2
)
# model settings
model
=
dict
(
type
=
ImageClassifier
,
backbone
=
dict
(
type
=
MobileNetV2
,
widen_factor
=
1.0
),
neck
=
dict
(
type
=
GlobalAveragePooling
),
head
=
dict
(
type
=
LinearClsHead
,
num_classes
=
1000
,
in_channels
=
1280
,
loss
=
dict
(
type
=
CrossEntropyLoss
,
loss_weight
=
1.0
),
topk
=
(
1
,
5
),
))
mmpretrain/configs/_base_/models/mobilenet_v3_small.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmengine.model.weight_init
import
NormalInit
from
torch.nn.modules.activation
import
Hardswish
from
mmpretrain.models
import
(
CrossEntropyLoss
,
GlobalAveragePooling
,
ImageClassifier
,
MobileNetV3
,
StackedLinearClsHead
)
# model settings
model
=
dict
(
type
=
ImageClassifier
,
backbone
=
dict
(
type
=
MobileNetV3
,
arch
=
'small'
),
neck
=
dict
(
type
=
GlobalAveragePooling
),
head
=
dict
(
type
=
StackedLinearClsHead
,
num_classes
=
1000
,
in_channels
=
576
,
mid_channels
=
[
1024
],
dropout_rate
=
0.2
,
act_cfg
=
dict
(
type
=
Hardswish
),
loss
=
dict
(
type
=
CrossEntropyLoss
,
loss_weight
=
1.0
),
init_cfg
=
dict
(
type
=
NormalInit
,
layer
=
'Linear'
,
mean
=
0.
,
std
=
0.01
,
bias
=
0.
),
topk
=
(
1
,
5
)))
mmpretrain/configs/_base_/models/resnet18.py
0 → 100644
View file @
cbc25585
# 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
=
18
,
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
),
))
mmpretrain/configs/_base_/models/swin_transformer_base.py
0 → 100644
View file @
cbc25585
# 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
,
SwinTransformer
)
# model settings
model
=
dict
(
type
=
ImageClassifier
,
backbone
=
dict
(
type
=
SwinTransformer
,
arch
=
'base'
,
img_size
=
384
,
stage_cfgs
=
dict
(
block_cfgs
=
dict
(
window_size
=
12
))),
neck
=
dict
(
type
=
GlobalAveragePooling
),
head
=
dict
(
type
=
LinearClsHead
,
num_classes
=
1000
,
in_channels
=
1024
,
loss
=
dict
(
type
=
CrossEntropyLoss
,
loss_weight
=
1.0
),
topk
=
(
1
,
5
)))
mmpretrain/configs/_base_/models/swin_transformer_v2_base.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmpretrain.models
import
(
GlobalAveragePooling
,
ImageClassifier
,
LabelSmoothLoss
,
LinearClsHead
,
SwinTransformerV2
)
# model settings
model
=
dict
(
type
=
ImageClassifier
,
backbone
=
dict
(
type
=
SwinTransformerV2
,
arch
=
'base'
,
img_size
=
384
,
drop_path_rate
=
0.2
),
neck
=
dict
(
type
=
GlobalAveragePooling
),
head
=
dict
(
type
=
LinearClsHead
,
num_classes
=
1000
,
in_channels
=
1024
,
init_cfg
=
None
,
# suppress the default init_cfg of LinearClsHead.
loss
=
dict
(
type
=
LabelSmoothLoss
,
label_smooth_val
=
0.1
,
mode
=
'original'
),
cal_acc
=
False
))
mmpretrain/configs/_base_/models/vit_base_p16.py
0 → 100644
View file @
cbc25585
# Copyright (c) OpenMMLab. All rights reserved.
# This is a BETA new format config file, and the usage may change recently.
from
mmengine.model.weight_init
import
KaimingInit
from
mmpretrain.models
import
(
ImageClassifier
,
LabelSmoothLoss
,
VisionTransformer
,
VisionTransformerClsHead
)
# model settings
model
=
dict
(
type
=
ImageClassifier
,
backbone
=
dict
(
type
=
VisionTransformer
,
arch
=
'b'
,
img_size
=
224
,
patch_size
=
16
,
drop_rate
=
0.1
,
init_cfg
=
[
dict
(
type
=
KaimingInit
,
layer
=
'Conv2d'
,
mode
=
'fan_in'
,
nonlinearity
=
'linear'
)
]),
neck
=
None
,
head
=
dict
(
type
=
VisionTransformerClsHead
,
num_classes
=
1000
,
in_channels
=
768
,
loss
=
dict
(
type
=
LabelSmoothLoss
,
label_smooth_val
=
0.1
,
mode
=
'classy_vision'
),
))
mmpretrain/configs/_base_/schedules/cifar10_bs128.py
0 → 100644
View file @
cbc25585
# 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
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
=
MultiStepLR
,
by_epoch
=
True
,
milestones
=
[
100
,
150
],
gamma
=
0.1
)
# train, val, test setting
train_cfg
=
dict
(
by_epoch
=
True
,
max_epochs
=
200
,
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
=
128
)
mmpretrain/configs/_base_/schedules/cub_bs64.py
0 → 100644
View file @
cbc25585
# 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
,
LinearLR
from
torch.optim
import
SGD
# optimizer
optim_wrapper
=
dict
(
optimizer
=
dict
(
type
=
SGD
,
lr
=
0.01
,
momentum
=
0.9
,
weight_decay
=
0.0005
,
nesterov
=
True
))
# learning policy
param_scheduler
=
[
# warm up learning rate scheduler
dict
(
type
=
LinearLR
,
start_factor
=
0.01
,
by_epoch
=
True
,
begin
=
0
,
end
=
5
,
# update by iter
convert_to_iter_based
=
True
),
# main learning rate scheduler
dict
(
type
=
CosineAnnealingLR
,
T_max
=
95
,
by_epoch
=
True
,
begin
=
5
,
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
=
64
)
mmpretrain/configs/_base_/schedules/imagenet_bs1024_adamw_swin.py
0 → 100644
View file @
cbc25585
# 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
,
LinearLR
from
torch.optim
import
AdamW
# for batch in each gpu is 128, 8 gpu
# lr = 5e-4 * 128 * 8 / 512 = 0.001
optim_wrapper
=
dict
(
optimizer
=
dict
(
type
=
AdamW
,
lr
=
5e-4
*
1024
/
512
,
weight_decay
=
0.05
,
eps
=
1e-8
,
betas
=
(
0.9
,
0.999
)),
paramwise_cfg
=
dict
(
norm_decay_mult
=
0.0
,
bias_decay_mult
=
0.0
,
flat_decay_mult
=
0.0
,
custom_keys
=
{
'.absolute_pos_embed'
:
dict
(
decay_mult
=
0.0
),
'.relative_position_bias_table'
:
dict
(
decay_mult
=
0.0
)
}),
)
# learning policy
param_scheduler
=
[
# warm up learning rate scheduler
dict
(
type
=
LinearLR
,
start_factor
=
1e-3
,
by_epoch
=
True
,
end
=
20
,
# update by iter
convert_to_iter_based
=
True
),
# main learning rate scheduler
dict
(
type
=
CosineAnnealingLR
,
eta_min
=
1e-5
,
by_epoch
=
True
,
begin
=
20
)
]
# train, val, test setting
train_cfg
=
dict
(
by_epoch
=
True
,
max_epochs
=
300
,
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
=
1024
)
Prev
1
2
3
4
5
6
…
23
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment