-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretinanet_r50v1d_fpn_dota.py
133 lines (127 loc) · 3.57 KB
/
retinanet_r50v1d_fpn_dota.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
model = dict(
type = "RetinaNet",
backbone = dict(
type = "Resnet50_v1d",
return_stages = ["layer1","layer2","layer3","layer4"],
pretrained = True,
),
neck = dict(
type= "FPN",
in_channels= [256,512,1024,2048],
out_channels= 256,
start_level= 1,
add_extra_convs= "on_output",
num_outs= 5,
upsample_cfg = dict(
mode= "bilinear",
tf_mode= True),
upsample_div_factor= 2,
relu_before_extra_convs= True),
rpn_net = dict(
type= "RetinaHead",
n_class= 15,
in_channels= 256,
stacked_convs= 4,
mode= "R",
score_threshold= 0.05,
nms_iou_threshold= 0.3,
max_dets= 10000,
roi_beta= 1 / 9.,
cls_loss_weight= 1.,
loc_loss_weight= 0.2,
anchor_generator = dict(
type= "AnchorGeneratorRotated",
strides= [8, 16, 32, 64, 128],
ratios= [1, 0.5, 2.0, 0.3333333333333333, 3.0, 5.0, 0.2],
scales= [1, 1.2599210498948732, 1.5874010519681994],
base_sizes= [32, 64, 128, 256, 512],
angles= [-90, -75, -60, -45, -30, -15],
mode= "H")),
)
dataset = dict(
val=dict(
type="DOTADataset",
dataset_dir="/home/cxjyxx_me/workspace/JAD/datasets/processed_DOTA/trainval_600_150_1.0",
transforms=[
dict(
type="RotatedResize",
min_size=800,
max_size=800
),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False,)
],
batch_size=4,
num_workers=4,
shuffle=False
),
train=dict(
type="DOTADataset",
dataset_dir="/home/cxjyxx_me/workspace/JAD/datasets/processed_DOTA/trainval_600_150_1.0",
transforms=[
dict(
type="RotatedResize",
min_size=800,
max_size=800
),
dict(
type='RotatedRandomFlip',
prob=0.5,
direction='horizontal'),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False,)
],
batch_size=3,
num_workers=4,
shuffle= True
),
test = dict(
type= "ImageDataset",
images_dir= "/mnt/disk/flowey/dataset/processed_DOTA/test_600_150_1.0/images",
transforms= [
dict(
type= "RotatedResize",
min_size= 800,
max_size= 800),
dict(
type= "Normalize",
mean= [123.675, 116.28, 103.53],
std= [58.395, 57.12, 57.375],
to_bgr= False)
],
num_workers= 4,
batch_size= 32))
optimizer = dict(
type='GradMutilpySGD',
lr=3 * 5e-4,
momentum=0.9,
weight_decay=1e-4,
grad_clip=dict(
max_norm=30., # 10*batch_size
norm_type=2))
scheduler = dict(
type= "StepLR",
warmup= "linear",
warmup_iters= 14000,
warmup_ratio= 0.1,
milestones= [27])
logger = dict(
type= "RunLogger")
max_epoch = 30
eval_interval = 1
log_interval = 50
checkpoint_interval = 1
pretrained_weights="weights/yx_init_pretrained.pk_jt.pk"
merge_nms_threshold_type = 1
parameter_groups_generator = dict(
type = "YangXuePrameterGroupsGenerator",
conv_bias_grad_muyilpy = 2.0,
conv_bias_weight_decay = 0.,
freeze_prefix=['backbone.C1']
)