Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* deit3 deit3 lint * add tools and test * deit3 * deit3 * fix preprocess * lint * Update config names and checkpoint paths * Update convert tools to use mmengine, and fix docstring. Co-authored-by: mzr1996 <mzr1996@163.com>
- Loading branch information
Showing
30 changed files
with
1,546 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,3 +133,6 @@ venv.bak/ | |
*.pvti-journal | ||
/cache_engine | ||
/report | ||
|
||
# slurm | ||
*.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# dataset settings | ||
dataset_type = 'ImageNet' | ||
data_preprocessor = dict( | ||
# 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='PackClsInputs'), | ||
] | ||
|
||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='ResizeEdge', | ||
scale=224, | ||
edge='short', | ||
backend='pillow', | ||
interpolation='bicubic'), | ||
dict(type='CenterCrop', crop_size=224), | ||
dict(type='PackClsInputs'), | ||
] | ||
|
||
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), | ||
persistent_workers=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), | ||
persistent_workers=True, | ||
) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# dataset settings | ||
dataset_type = 'ImageNet' | ||
data_preprocessor = dict( | ||
# 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='PackClsInputs'), | ||
] | ||
|
||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='ResizeEdge', | ||
scale=384, | ||
edge='short', | ||
backend='pillow', | ||
interpolation='bicubic'), | ||
dict(type='CenterCrop', crop_size=384), | ||
dict(type='PackClsInputs'), | ||
] | ||
|
||
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), | ||
persistent_workers=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), | ||
persistent_workers=True, | ||
) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='b', | ||
img_size=224, | ||
patch_size=16, | ||
drop_path_rate=0.2), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=768, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='b', | ||
img_size=384, | ||
patch_size=16, | ||
drop_path_rate=0.15), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=768, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='h', | ||
img_size=224, | ||
patch_size=14, | ||
drop_path_rate=0.55), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=1280, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='l', | ||
img_size=224, | ||
patch_size=16, | ||
drop_path_rate=0.45), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=1024, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='l', | ||
img_size=384, | ||
patch_size=16, | ||
drop_path_rate=0.4), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=1024, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='m', | ||
img_size=224, | ||
patch_size=16, | ||
drop_path_rate=0.2), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=512, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='s', | ||
img_size=224, | ||
patch_size=16, | ||
drop_path_rate=0.05), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=384, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
model = dict( | ||
type='ImageClassifier', | ||
backbone=dict( | ||
type='DeiT3', | ||
arch='s', | ||
img_size=384, | ||
patch_size=16, | ||
drop_path_rate=0.0), | ||
neck=None, | ||
head=dict( | ||
type='VisionTransformerClsHead', | ||
num_classes=1000, | ||
in_channels=384, | ||
loss=dict( | ||
type='LabelSmoothLoss', label_smooth_val=0.1, mode='original'), | ||
), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer='Linear', std=.02), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
], | ||
train_cfg=dict(augments=[ | ||
dict(type='Mixup', alpha=0.8, num_classes=1000), | ||
dict(type='CutMix', alpha=1.0, num_classes=1000) | ||
])) |
Oops, something went wrong.