-
Notifications
You must be signed in to change notification settings - Fork 12
/
pgd_gfl_r101_r50_1x.py
142 lines (139 loc) · 6.42 KB
/
pgd_gfl_r101_r50_1x.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
_base_ = "base/1x_setting.py"
temperature = 0.8
alpha = 0.04
delta = 0.0008
beta = alpha * 0.5
gamma = alpha * 1.6
distiller = dict(
type='PredictionGuidedDistiller',
teacher_pretrained = 'work_dirs/gfl_r101_3x_ms/epoch_36.pth',
init_student = True,
distill_cfg=[dict(student_module='bbox_head.cls_identities.0',
teacher_module='bbox_head.cls_identities.0',
output_hook=True,
methods=[dict(type='PGDClsLoss',
name='loss_kd_cls_0',
temp_s=temperature,
temp_c=temperature,
loss_weight=1.0,
alpha=alpha,
beta=beta,
delta=delta,
)
]
),
dict(student_module='bbox_head.cls_identities.1',
teacher_module='bbox_head.cls_identities.1',
output_hook=True,
methods=[dict(type='PGDClsLoss',
name='loss_kd_cls_1',
temp_s=temperature,
temp_c=temperature,
loss_weight=1.25,
alpha=alpha,
beta=beta,
delta=delta,
)
]
),
dict(student_module='bbox_head.cls_identities.2',
teacher_module='bbox_head.cls_identities.2',
output_hook=True,
methods=[dict(type='PGDClsLoss',
name='loss_kd_cls_2',
temp_s=temperature,
temp_c=temperature,
loss_weight=1.5,
alpha=alpha,
beta=beta,
delta=delta,
)
]
),
dict(student_module='bbox_head.cls_identities.3',
teacher_module='bbox_head.cls_identities.3',
output_hook=True,
methods=[dict(type='PGDClsLoss',
name='loss_kd_cls_3',
temp_s=temperature,
temp_c=temperature,
loss_weight=1.75,
alpha=alpha,
beta=beta,
delta=delta,
)
]
),
dict(student_module='bbox_head.cls_identities.4',
teacher_module='bbox_head.cls_identities.4',
output_hook=True,
methods=[dict(type='PGDClsLoss',
name='loss_kd_cls_4',
temp_s=temperature,
temp_c=temperature,
loss_weight=2.0,
alpha=alpha,
beta=beta,
delta=delta,
)
]
),
dict(student_module='bbox_head.reg_identities.0',
teacher_module='bbox_head.reg_identities.0',
output_hook=True,
methods=[dict(type='PGDRegLoss',
name='loss_kd_reg_0',
temp=temperature,
gamma=gamma,
delta=delta,
)
]
),
dict(student_module='bbox_head.reg_identities.1',
teacher_module='bbox_head.reg_identities.1',
output_hook=True,
methods=[dict(type='PGDRegLoss',
name='loss_kd_reg_1',
temp=temperature,
gamma=gamma,
delta=delta,
)
]
),
dict(student_module='bbox_head.reg_identities.2',
teacher_module='bbox_head.reg_identities.2',
output_hook=True,
methods=[dict(type='PGDRegLoss',
name='loss_kd_reg_2',
temp=temperature,
gamma=gamma,
delta=delta,
)
]
),
dict(student_module='bbox_head.reg_identities.3',
teacher_module='bbox_head.reg_identities.3',
output_hook=True,
methods=[dict(type='PGDRegLoss',
name='loss_kd_reg_3',
temp=temperature,
gamma=gamma,
delta=delta,
)
]
),
dict(student_module='bbox_head.reg_identities.4',
teacher_module='bbox_head.reg_identities.4',
output_hook=True,
methods=[dict(type='PGDRegLoss',
name='loss_kd_reg_4',
temp=temperature,
gamma=gamma,
delta=delta,
)
]
),
]
)
student_cfg = 'work_configs/detectors/gfl_r50_distill_head.py'
teacher_cfg = 'work_configs/detectors/gfl_r101_3x_ms.py'