-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcfg_search_faster_rcnn.py
139 lines (121 loc) · 3.88 KB
/
cfg_search_faster_rcnn.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
### model setting
_base_ = [
'../configs/_base_/models/faster_rcnn_r50_fpn.py',
'../configs/_base_/datasets/coco500_detection_augm.py',
'../configs/_base_/schedules/schedule_1x.py',
'../configs/_base_/default_runtime.py'
]
model = dict(
rpn_head=dict(
type='PAPLossRPNHead',
in_channels=256,
feat_channels=256,
anchor_generator=dict(
type='AnchorGenerator',
scales=[8],
ratios=[0.5, 1.0, 2.0],
strides=[4, 8, 16, 32, 64]),
bbox_coder=dict(
type='DeltaXYWHBBoxCoder',
target_means=[.0, .0, .0, .0],
target_stds=[0.1, 0.1, 0.2, 0.2]),
ctrl_points=[0.0],
reg_weight=1.0,
reg_input='giou'),
roi_head=dict(
bbox_head=dict(
type='PAPLossShared2FCBBoxHead',
in_channels=256,
fc_out_channels=1024,
ctrl_points=[0.0],
reg_weight=1.0,
roi_feat_size=7,
num_classes=80,
bbox_coder=dict(
type='DeltaXYWHBBoxCoder',
target_means=[0., 0., 0., 0.],
target_stds=[0.1, 0.1, 0.2, 0.2]),
reg_class_agnostic=False,
reg_decoded_bbox=True,
reg_input='giou',)))
train_cfg = dict(
rpn=dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.7,
neg_iou_thr=0.3,
min_pos_iou=0.3,
match_low_quality=True,
ignore_iof_thr=-1),
allowed_border=-1,
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
min_bbox_size=0),
rcnn=dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.5,
neg_iou_thr=0.5,
min_pos_iou=0.5,
match_low_quality=False,
ignore_iof_thr=-1),
sampler=dict(type='PseudoSampler'),
pos_weight=-1,
debug=False))
checkpoint_config = dict(interval=1000)
dist_params = dict(backend='nccl', port=25590)
data_root = 'data/coco/'
data = dict(
train=dict(ann_file=data_root + 'annotations/search_train2017.json'),
val=dict(ann_file=data_root + 'annotations/search_val2017.json',
img_prefix=data_root + 'train2017/'),
test=dict(ann_file=data_root + 'annotations/search_val2017.json',
img_prefix=data_root + 'train2017/'))
total_epochs = 1
optimizer = dict(type='SGD', lr=0.024, momentum=0.9, weight_decay=0.0001) # 0.012 for 4gpu * 8
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[])
### search process setting
# num of sample rounds
sample_times = 40
# num of sampled loss functions each round, should be multiple of world_size
num_samples = 8
# num of models on each gpu
num_models_per_gpu = 1
# eps for PPO
clip_eps = 0.1
# lr for updating mu
mu_lr = 0.01
# lr schedule for updating mu
update_per_sample = 100
### search function setting
func_types = ['H2', 'I2', 'I3', 'I1', 'H1'] # function order should correspond to paploss.py
fixed_func_types = []
fixed_ctrl_points = []
search_func_num = len(func_types) * 2 # different heads different losses
num_theta = 8 * search_func_num # one function 12 mu and sigma each, 4 control points
mu_ = [0.2, 0.2, 0.25, 0.25, 0.3333, 0.3333, 0.5, 0.5]
sigma_ = [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
constraint_index_ = [True, True, True, True, True, True, True, True]
mu = []
sigma = []
constraint_index = []
for i in range(search_func_num):
mu = mu + mu_
sigma = sigma + sigma_
constraint_index = constraint_index + constraint_index_
# two different gradient scales for two different heads
mu = mu + [0.5] + [0.5]
sigma = sigma + [0.2] + [0.2]
num_theta = num_theta + 2
constraint_index = constraint_index + [True]