Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
SOLOv2-pytorch
Commits
450cfb73
Commit
450cfb73
authored
Dec 12, 2018
by
yhcao6
Browse files
support VOC dataset
parent
40325555
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
273 additions
and
8 deletions
+273
-8
configs/ssd300_coco.py
configs/ssd300_coco.py
+3
-3
configs/ssd300_voc.py
configs/ssd300_voc.py
+132
-0
configs/ssd512_coco.py
configs/ssd512_coco.py
+3
-3
configs/ssd512_voc.py
configs/ssd512_voc.py
+129
-0
mmdet/models/single_stage_heads/ssd_head.py
mmdet/models/single_stage_heads/ssd_head.py
+6
-2
No files found.
configs/ssd300_coco.py
View file @
450cfb73
...
...
@@ -46,8 +46,8 @@ dataset_type = 'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
1
,
1
,
1
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
4
,
workers_per_gpu
=
2
,
imgs_per_gpu
=
8
,
workers_per_gpu
=
3
,
train
=
dict
(
type
=
'RepeatDataset'
,
dataset
=
dict
(
...
...
@@ -101,7 +101,7 @@ data = dict(
test_mode
=
True
,
resize_keep_ratio
=
False
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
1
e-3
,
momentum
=
0.9
,
weight_decay
=
5e-4
)
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
2
e-3
,
momentum
=
0.9
,
weight_decay
=
5e-4
)
optimizer_config
=
dict
()
# learning policy
lr_config
=
dict
(
...
...
configs/ssd300_voc.py
0 → 100644
View file @
450cfb73
# model settings
model
=
dict
(
type
=
'SingleStageDetector'
,
pretrained
=
'data/vgg_backbone.pth'
,
backbone
=
dict
(
type
=
'SSDVGG'
,
input_size
=
300
,
depth
=
16
,
with_last_pool
=
False
,
ceil_mode
=
True
,
out_indices
=
(
3
,
4
),
out_feature_indices
=
(
22
,
34
),
l2_norm_scale
=
20
),
neck
=
None
,
bbox_head
=
dict
(
type
=
'SSDHead'
,
input_size
=
300
,
in_channels
=
(
512
,
1024
,
512
,
256
,
256
,
256
),
num_classes
=
21
,
anchor_strides
=
(
8
,
16
,
32
,
64
,
100
,
300
),
basesize_ratio_range
=
(
0.2
,
0.9
),
anchor_ratios
=
([
2
],
[
2
,
3
],
[
2
,
3
],
[
2
,
3
],
[
2
],
[
2
]),
target_means
=
(.
0
,
.
0
,
.
0
,
.
0
),
target_stds
=
(
0.1
,
0.1
,
0.2
,
0.2
)))
train_cfg
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.
,
ignore_iof_thr
=-
1
,
gt_max_assign_all
=
False
),
smoothl1_beta
=
1.
,
allowed_border
=-
1
,
pos_weight
=-
1
,
neg_pos_ratio
=
3
,
debug
=
False
)
test_cfg
=
dict
(
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.45
),
min_bbox_size
=
0
,
score_thr
=
0.02
,
max_per_img
=
200
)
# model training and testing settings
# dataset settings
dataset_type
=
'VOCDataset'
data_root
=
'data/VOCdevkit/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
1
,
1
,
1
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
8
,
workers_per_gpu
=
3
,
train
=
dict
(
type
=
'RepeatDataset'
,
dataset
=
dict
(
type
=
dataset_type
,
ann_file
=
[
data_root
+
'VOC2007/ImageSets/Main/trainval.txt'
,
data_root
+
'VOC2012/ImageSets/Main/trainval.txt'
],
img_prefix
=
[
data_root
+
'VOC2007/'
,
data_root
+
'VOC2012/'
],
img_scale
=
(
300
,
300
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
None
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
True
,
test_mode
=
False
,
extra_aug
=
dict
(
photo_metric_distortion
=
dict
(
brightness_delta
=
32
,
contrast_range
=
(
0.5
,
1.5
),
saturation_range
=
(
0.5
,
1.5
),
hue_delta
=
18
),
expand
=
dict
(
mean
=
img_norm_cfg
[
'mean'
],
to_rgb
=
img_norm_cfg
[
'to_rgb'
],
ratio_range
=
(
1
,
4
)),
random_crop
=
dict
(
min_ious
=
(
0.1
,
0.3
,
0.5
,
0.7
,
0.9
),
min_crop_size
=
0.3
)),
resize_keep_ratio
=
False
),
times
=
20
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'VOC2007/ImageSets/Main/test.txt'
,
img_prefix
=
data_root
+
'VOC2007/'
,
img_scale
=
(
300
,
300
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
None
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
,
resize_keep_ratio
=
False
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'VOC2007/ImageSets/Main/test.txt'
,
img_prefix
=
data_root
+
'VOC2007/'
,
img_scale
=
(
300
,
300
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
None
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
,
resize_keep_ratio
=
False
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
2e-3
,
momentum
=
0.9
,
weight_decay
=
5e-4
)
optimizer_config
=
dict
()
# learning policy
lr_config
=
dict
(
policy
=
'step'
,
warmup
=
'linear'
,
warmup_iters
=
500
,
warmup_ratio
=
1.0
/
3
,
step
=
[
8
,
11
])
checkpoint_config
=
dict
(
interval
=
1
)
# yapf:disable
log_config
=
dict
(
interval
=
50
,
hooks
=
[
dict
(
type
=
'TextLoggerHook'
),
# dict(type='TensorboardLoggerHook')
])
# yapf:enable
# runtime settings
total_epochs
=
12
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/ssd300_voc'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/ssd512_coco.py
View file @
450cfb73
...
...
@@ -46,8 +46,8 @@ dataset_type = 'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
1
,
1
,
1
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
4
,
workers_per_gpu
=
2
,
imgs_per_gpu
=
8
,
workers_per_gpu
=
3
,
train
=
dict
(
type
=
'RepeatDataset'
,
dataset
=
dict
(
...
...
@@ -101,7 +101,7 @@ data = dict(
test_mode
=
True
,
resize_keep_ratio
=
False
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
1
e-3
,
momentum
=
0.9
,
weight_decay
=
5e-4
)
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
2
e-3
,
momentum
=
0.9
,
weight_decay
=
5e-4
)
optimizer_config
=
dict
()
# learning policy
lr_config
=
dict
(
...
...
configs/ssd512_voc.py
0 → 100644
View file @
450cfb73
# model settings
model
=
dict
(
type
=
'SingleStageDetector'
,
pretrained
=
'data/vgg_backbone.pth'
,
backbone
=
dict
(
type
=
'SSDVGG'
,
input_size
=
512
,
depth
=
16
,
with_last_pool
=
False
,
ceil_mode
=
True
,
out_indices
=
(
3
,
4
),
out_feature_indices
=
(
22
,
34
),
l2_norm_scale
=
20
),
neck
=
None
,
bbox_head
=
dict
(
type
=
'SSDHead'
,
input_size
=
512
,
in_channels
=
(
512
,
1024
,
512
,
256
,
256
,
256
,
256
),
num_classes
=
81
,
anchor_strides
=
(
8
,
16
,
32
,
64
,
128
,
256
,
512
),
basesize_ratio_range
=
(
0.1
,
0.9
),
anchor_ratios
=
([
2
],
[
2
,
3
],
[
2
,
3
],
[
2
,
3
],
[
2
,
3
],
[
2
],
[
2
]),
target_means
=
(.
0
,
.
0
,
.
0
,
.
0
),
target_stds
=
(
0.1
,
0.1
,
0.2
,
0.2
)))
train_cfg
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.
,
ignore_iof_thr
=-
1
,
gt_max_assign_all
=
False
),
smoothl1_beta
=
1.
,
allowed_border
=-
1
,
pos_weight
=-
1
,
neg_pos_ratio
=
3
,
debug
=
False
)
test_cfg
=
dict
(
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.45
),
min_bbox_size
=
0
,
score_thr
=
0.02
,
max_per_img
=
200
)
# model training and testing settings
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
1
,
1
,
1
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
8
,
workers_per_gpu
=
3
,
train
=
dict
(
type
=
'RepeatDataset'
,
dataset
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
512
,
512
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
None
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
True
,
test_mode
=
False
,
extra_aug
=
dict
(
photo_metric_distortion
=
dict
(
brightness_delta
=
32
,
contrast_range
=
(
0.5
,
1.5
),
saturation_range
=
(
0.5
,
1.5
),
hue_delta
=
18
),
expand
=
dict
(
mean
=
img_norm_cfg
[
'mean'
],
to_rgb
=
img_norm_cfg
[
'to_rgb'
],
ratio_range
=
(
1
,
4
)),
random_crop
=
dict
(
min_ious
=
(
0.1
,
0.3
,
0.5
,
0.7
,
0.9
),
min_crop_size
=
0.3
)),
resize_keep_ratio
=
False
),
times
=
10
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
512
,
512
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
None
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
,
resize_keep_ratio
=
False
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
512
,
512
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
None
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
,
resize_keep_ratio
=
False
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
2e-3
,
momentum
=
0.9
,
weight_decay
=
5e-4
)
optimizer_config
=
dict
()
# learning policy
lr_config
=
dict
(
policy
=
'step'
,
warmup
=
'linear'
,
warmup_iters
=
500
,
warmup_ratio
=
1.0
/
3
,
step
=
[
8
,
11
])
checkpoint_config
=
dict
(
interval
=
1
)
# yapf:disable
log_config
=
dict
(
interval
=
50
,
hooks
=
[
dict
(
type
=
'TextLoggerHook'
),
# dict(type='TensorboardLoggerHook')
])
# yapf:enable
# runtime settings
total_epochs
=
12
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/ssd512_voc'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
mmdet/models/single_stage_heads/ssd_head.py
View file @
450cfb73
...
...
@@ -55,8 +55,12 @@ class SSDHead(nn.Module):
min_sizes
.
append
(
int
(
input_size
*
r
/
100
))
max_sizes
.
append
(
int
(
input_size
*
(
r
+
step
)
/
100
))
if
input_size
==
300
:
min_sizes
.
insert
(
0
,
int
(
input_size
*
7
/
100
))
max_sizes
.
insert
(
0
,
int
(
input_size
*
15
/
100
))
if
basesize_ratio_range
[
0
]
==
0.15
:
min_sizes
.
insert
(
0
,
int
(
input_size
*
7
/
100
))
max_sizes
.
insert
(
0
,
int
(
input_size
*
15
/
100
))
elif
basesize_ratio_range
[
0
]
==
0.2
:
min_sizes
.
insert
(
0
,
int
(
input_size
*
10
/
100
))
max_sizes
.
insert
(
0
,
int
(
input_size
*
20
/
100
))
elif
input_size
==
512
:
min_sizes
.
insert
(
0
,
int
(
input_size
*
4
/
100
))
max_sizes
.
insert
(
0
,
int
(
input_size
*
10
/
100
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment