-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathretinanet_mobilemamba_b1_fpn_1x_coco.py
68 lines (63 loc) · 2.03 KB
/
retinanet_mobilemamba_b1_fpn_1x_coco.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
59
60
61
62
63
64
65
66
67
68
_base_ = [
'../_base_/models/retinanet_efficientvit_fpn.py',
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py',
'./retinanet_tta.py'
]
model = dict(
backbone=dict(
_delete_=True,
type='MobileMamba',
img_size=224,
in_chans=3,
num_classes=80,
stages=['s', 's', 's'],
embed_dim=[200, 376, 448],
global_ratio=[0.8, 0.7, 0.6],
local_ratio=[0.2, 0.2, 0.3],
depth=[2, 3, 2],
kernels=[7, 5, 3],
down_ops=[['subsample', 2], ['subsample', 2], ['']],
distillation=False, drop_path=0.03, ssm_ratio=2, forward_type="v052d",
sync_bn=False, out_indices=(1, 2, 3),
pretrained='../../weights/MobileMamba_B1/mobilemamba_b1.pth',
frozen_stages=-1, norm_eval=True, ),
neck=dict(
type='EfficientViTFPN',
in_channels=[200, 376, 448],
out_channels=256,
start_level=0,
num_outs=5,
num_extra_trans_convs=1,
),
)
ratio = 1
bs_ratio = 2 # 0.0002 for 2 * 8
# optimizer
optim_wrapper = dict(
type='OptimWrapper',
optimizer=dict(_delete_=True, type='AdamW', lr=0.0002 * ratio, betas=(0.9, 0.999), weight_decay=0.05),
paramwise_cfg=dict(custom_keys={'absolute_pos_embed': dict(decay_mult=0.),
'relative_position_bias_table': dict(decay_mult=0.),
'norm': dict(decay_mult=0.)}),
clip_grad=dict(max_norm=0.1, norm_type=2), )
max_epochs = 12
param_scheduler = [
dict(
type='LinearLR', start_factor=1.0e-5, by_epoch=False, begin=0, end=500),
dict(
type='CosineAnnealingLR',
begin=max_epochs // 2,
T_max=max_epochs // 2,
end=max_epochs,
by_epoch=True,
eta_min=0)
]
train_dataloader = dict(
batch_size=2 * bs_ratio * ratio,
num_workers=min(2 * bs_ratio * ratio, 8),
)
val_dataloader = dict(
batch_size=1,
num_workers=2,)
test_dataloader = val_dataloader