-
Notifications
You must be signed in to change notification settings - Fork 14
/
in21k-swin-b_vpt5_bs4_lr5e-2_1-shot_chest_adamw.py
58 lines (51 loc) · 1.4 KB
/
in21k-swin-b_vpt5_bs4_lr5e-2_1-shot_chest_adamw.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
_base_ = [
'../_base_/datasets/chest.py',
'../_base_/schedules/imagenet_bs1024_adamw_swin.py',
'../_base_/default_runtime.py',
'../_base_/custom_imports.py',
]
lr = 5e-2
n = 1
vpl = 5
dataset = 'chest'
exp_num = 1
nshot = 1
run_name = f'in21k-swin-b_vpt-{vpl}_bs4_lr{lr}_{nshot}-shot_{dataset}'
model = dict(
type='ImageClassifier',
backbone=dict(
type='PromptedSwinTransformer',
prompt_length=vpl,
arch='base',
img_size=384,
stage_cfgs=dict(block_cfgs=dict(window_size=12))),
neck=None,
head=dict(
type='MultiLabelLinearClsHead',
num_classes=19,
in_channels=1024,
))
data = dict(
samples_per_gpu=4, # use 2 gpus, total 128
train=dict(
ann_file=
f'data/MedFMC/{dataset}/{dataset}_{nshot}-shot_train_exp{exp_num}.txt'
),
val=dict(
ann_file=
f'data/MedFMC/{dataset}/{dataset}_{nshot}-shot_val_exp{exp_num}.txt'),
test=dict(ann_file=f'data/MedFMC/{dataset}/test_WithLabel.txt'))
optimizer = dict(lr=lr)
log_config = dict(
interval=10, hooks=[
dict(type='TextLoggerHook'),
])
load_from = 'work_dirs/swin_base_patch4_window12_384_22kto1k-d59b0d1d.pth'
work_dir = f'work_dirs/exp{exp_num}/{run_name}'
runner = dict(type='EpochBasedRunner', max_epochs=20)
# yapf:disable
log_config = dict(
interval=10,
hooks=[
dict(type='TextLoggerHook'),
])