-
Notifications
You must be signed in to change notification settings - Fork 118
/
baseline_conv4_1xb64_tiered-imagenet_5way-1shot.py
48 lines (44 loc) · 1.58 KB
/
baseline_conv4_1xb64_tiered-imagenet_5way-1shot.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
_base_ = [
'../../_base_/meta_test/tiered-imagenet_meta-test_5way-1shot.py',
'../../_base_/runtime/epoch_based_runtime.py',
'../../_base_/schedules/sgd_100epoch.py'
]
img_size = 84
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromBytes'),
dict(type='RandomResizedCrop', size=img_size),
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_label']),
dict(type='Collect', keys=['img', 'gt_label'])
]
meta_finetune_cfg = dict(
num_steps=150,
optimizer=dict(
type='SGD', lr=0.01, momentum=0.9, dampening=0.9, weight_decay=0.001))
data = dict(
samples_per_gpu=64,
workers_per_gpu=8,
train=dict(
type='TieredImageNetDataset',
data_prefix='data/tiered_imagenet',
subset='train',
pipeline=train_pipeline),
val=dict(
meta_test_cfg=dict(
support=dict(
batch_size=4, drop_last=True, train=meta_finetune_cfg))),
test=dict(
meta_test_cfg=dict(
fast_test=True,
support=dict(
batch_size=4, drop_last=True, train=meta_finetune_cfg))))
model = dict(
type='Baseline',
backbone=dict(type='Conv4'),
head=dict(type='LinearHead', num_classes=351, in_channels=1600),
meta_test_head=dict(type='LinearHead', num_classes=5, in_channels=1600))