forked from Turoad/lanedet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resnet18_tusimple.py
112 lines (96 loc) · 2.26 KB
/
resnet18_tusimple.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
net = dict(
type='Detector',
)
backbone = dict(
type='ResNetWrapper',
resnet='resnet18',
pretrained=True,
replace_stride_with_dilation=[False, False, False],
out_conv=False,
)
featuremap_out_channel = 512
griding_num = 100
num_classes = 6
heads = dict(type='LaneCls',
dim = (griding_num + 1, 56, num_classes))
trainer = dict(
type='LaneCls'
)
evaluator = dict(
type='Tusimple',
)
import math
scheduler = dict(
type = 'LambdaLR',
lr_lambda = lambda _iter : math.pow(1 - _iter/total_iter, 0.9)
)
optimizer = dict(
type = 'SGD',
lr = 0.025,
weight_decay = 1e-4,
momentum = 0.9
)
epochs = 150
batch_size = 4
total_iter = (3616 // batch_size + 1) * epochs
import math
scheduler = dict(
type = 'LambdaLR',
lr_lambda = lambda _iter : math.pow(1 - _iter/total_iter, 0.9)
)
img_norm = dict(
mean=[103.939, 116.779, 123.68],
std=[1., 1., 1.]
)
ori_img_h = 720
ori_img_w = 1280
img_h = 288
img_w = 800
cut_height=0
sample_y = range(710, 150, -10)
dataset_type = 'TuSimple'
dataset_path = './data/tusimple'
row_anchor = 'tusimple_row_anchor'
train_process = [
dict(type='RandomRotation', degree=(-6, 6)),
dict(type='RandomUDoffsetLABEL', max_offset=100),
dict(type='RandomLROffsetLABEL', max_offset=200),
dict(type='GenerateLaneCls', row_anchor=row_anchor,
num_cols=griding_num, num_classes=num_classes),
dict(type='Resize', size=(img_w, img_h)),
dict(type='Normalize', img_norm=img_norm),
dict(type='ToTensor', keys=['img', 'cls_label']),
]
val_process = [
dict(type='Resize', size=(img_w, img_h)),
dict(type='Normalize', img_norm=img_norm),
dict(type='ToTensor', keys=['img']),
]
dataset = dict(
train=dict(
type=dataset_type,
data_root=dataset_path,
split='trainval',
processes=train_process,
),
val=dict(
type=dataset_type,
data_root=dataset_path,
split='test',
processes=val_process,
),
test=dict(
type=dataset_type,
data_root=dataset_path,
split='test',
processes=val_process,
)
)
workers = 12
ignore_label = 255
log_interval = 100
eval_ep = 1
save_ep = epochs
row_anchor='tusimple_row_anchor'
test_json_file='data/tusimple/test_label.json'
lr_update_by_epoch = False