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
76168f9c
Commit
76168f9c
authored
Dec 24, 2018
by
ThangVu
Browse files
resolve conflict GN-dev with master
parents
8a086f02
c5d8f002
Changes
83
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1582 additions
and
52 deletions
+1582
-52
configs/mask_rcnn_r101_fpn_1x.py
configs/mask_rcnn_r101_fpn_1x.py
+6
-6
configs/mask_rcnn_r50_fpn_1x.py
configs/mask_rcnn_r50_fpn_1x.py
+6
-6
configs/mask_rcnn_x101_32x4d_fpn_1x.py
configs/mask_rcnn_x101_32x4d_fpn_1x.py
+170
-0
configs/mask_rcnn_x101_64x4d_fpn_1x.py
configs/mask_rcnn_x101_64x4d_fpn_1x.py
+170
-0
configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.py
configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.py
+157
-0
configs/pascal_voc/ssd300_voc.py
configs/pascal_voc/ssd300_voc.py
+134
-0
configs/pascal_voc/ssd512_voc.py
configs/pascal_voc/ssd512_voc.py
+134
-0
configs/retinanet_r101_fpn_1x.py
configs/retinanet_r101_fpn_1x.py
+5
-1
configs/retinanet_r50_fpn_1x.py
configs/retinanet_r50_fpn_1x.py
+5
-1
configs/retinanet_x101_32x4d_fpn_1x.py
configs/retinanet_x101_32x4d_fpn_1x.py
+122
-0
configs/retinanet_x101_64x4d_fpn_1x.py
configs/retinanet_x101_64x4d_fpn_1x.py
+122
-0
configs/rpn_r101_fpn_1x.py
configs/rpn_r101_fpn_1x.py
+3
-3
configs/rpn_r50_fpn_1x.py
configs/rpn_r50_fpn_1x.py
+3
-3
configs/rpn_x101_32x4d_fpn_1x.py
configs/rpn_x101_32x4d_fpn_1x.py
+123
-0
configs/rpn_x101_64x4d_fpn_1x.py
configs/rpn_x101_64x4d_fpn_1x.py
+123
-0
configs/ssd300_coco.py
configs/ssd300_coco.py
+131
-0
configs/ssd512_coco.py
configs/ssd512_coco.py
+131
-0
mmdet/apis/train.py
mmdet/apis/train.py
+8
-4
mmdet/core/anchor/anchor_generator.py
mmdet/core/anchor/anchor_generator.py
+9
-8
mmdet/core/anchor/anchor_target.py
mmdet/core/anchor/anchor_target.py
+20
-20
No files found.
configs/mask_rcnn_r101_fpn_1x.py
View file @
76168f9c
...
@@ -54,34 +54,34 @@ model = dict(
...
@@ -54,34 +54,34 @@ model = dict(
train_cfg
=
dict
(
train_cfg
=
dict
(
rpn
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
),
sampler
=
dict
(
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
num
=
256
,
pos_fraction
=
0.5
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
,
add_gt_as_proposals
=
False
),
pos_balance_sampling
=
False
,
neg_balance_thr
=
0
),
allowed_border
=
0
,
allowed_border
=
0
,
pos_weight
=-
1
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
),
debug
=
False
),
rcnn
=
dict
(
rcnn
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.5
,
min_pos_iou
=
0.5
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
),
sampler
=
dict
(
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
512
,
num
=
512
,
pos_fraction
=
0.25
,
pos_fraction
=
0.25
,
neg_pos_ub
=-
1
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
,
add_gt_as_proposals
=
True
),
pos_balance_sampling
=
False
,
neg_balance_thr
=
0
),
mask_size
=
28
,
mask_size
=
28
,
pos_weight
=-
1
,
pos_weight
=-
1
,
debug
=
False
))
debug
=
False
))
...
...
configs/mask_rcnn_r50_fpn_1x.py
View file @
76168f9c
...
@@ -54,34 +54,34 @@ model = dict(
...
@@ -54,34 +54,34 @@ model = dict(
train_cfg
=
dict
(
train_cfg
=
dict
(
rpn
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
),
sampler
=
dict
(
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
num
=
256
,
pos_fraction
=
0.5
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
,
add_gt_as_proposals
=
False
),
pos_balance_sampling
=
False
,
neg_balance_thr
=
0
),
allowed_border
=
0
,
allowed_border
=
0
,
pos_weight
=-
1
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
),
debug
=
False
),
rcnn
=
dict
(
rcnn
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.5
,
min_pos_iou
=
0.5
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
),
sampler
=
dict
(
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
512
,
num
=
512
,
pos_fraction
=
0.25
,
pos_fraction
=
0.25
,
neg_pos_ub
=-
1
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
,
add_gt_as_proposals
=
True
),
pos_balance_sampling
=
False
,
neg_balance_thr
=
0
),
mask_size
=
28
,
mask_size
=
28
,
pos_weight
=-
1
,
pos_weight
=-
1
,
debug
=
False
))
debug
=
False
))
...
...
configs/mask_rcnn_x101_32x4d_fpn_1x.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'MaskRCNN'
,
pretrained
=
'open-mmlab://resnext101_32x4d'
,
backbone
=
dict
(
type
=
'ResNeXt'
,
depth
=
101
,
groups
=
32
,
base_width
=
4
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
num_outs
=
5
),
rpn_head
=
dict
(
type
=
'RPNHead'
,
in_channels
=
256
,
feat_channels
=
256
,
anchor_scales
=
[
8
],
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
4
,
8
,
16
,
32
,
64
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
],
use_sigmoid_cls
=
True
),
bbox_roi_extractor
=
dict
(
type
=
'SingleRoIExtractor'
,
roi_layer
=
dict
(
type
=
'RoIAlign'
,
out_size
=
7
,
sample_num
=
2
),
out_channels
=
256
,
featmap_strides
=
[
4
,
8
,
16
,
32
]),
bbox_head
=
dict
(
type
=
'SharedFCBBoxHead'
,
num_fcs
=
2
,
in_channels
=
256
,
fc_out_channels
=
1024
,
roi_feat_size
=
7
,
num_classes
=
81
,
target_means
=
[
0.
,
0.
,
0.
,
0.
],
target_stds
=
[
0.1
,
0.1
,
0.2
,
0.2
],
reg_class_agnostic
=
False
),
mask_roi_extractor
=
dict
(
type
=
'SingleRoIExtractor'
,
roi_layer
=
dict
(
type
=
'RoIAlign'
,
out_size
=
14
,
sample_num
=
2
),
out_channels
=
256
,
featmap_strides
=
[
4
,
8
,
16
,
32
]),
mask_head
=
dict
(
type
=
'FCNMaskHead'
,
num_convs
=
4
,
in_channels
=
256
,
conv_out_channels
=
256
,
num_classes
=
81
))
# model training and testing settings
train_cfg
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
),
allowed_border
=
0
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
),
rcnn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.5
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
512
,
pos_fraction
=
0.25
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
),
mask_size
=
28
,
pos_weight
=-
1
,
debug
=
False
))
test_cfg
=
dict
(
rpn
=
dict
(
nms_across_levels
=
False
,
nms_pre
=
2000
,
nms_post
=
2000
,
max_num
=
2000
,
nms_thr
=
0.7
,
min_bbox_size
=
0
),
rcnn
=
dict
(
score_thr
=
0.05
,
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.5
),
max_per_img
=
100
,
mask_thr_binary
=
0.5
))
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
True
,
with_crowd
=
True
,
with_label
=
True
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
True
,
with_crowd
=
True
,
with_label
=
True
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.02
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
# 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/mask_rcnn_r50_fpn_1x'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/mask_rcnn_x101_64x4d_fpn_1x.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'MaskRCNN'
,
pretrained
=
'open-mmlab://resnext101_64x4d'
,
backbone
=
dict
(
type
=
'ResNeXt'
,
depth
=
101
,
groups
=
64
,
base_width
=
4
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
num_outs
=
5
),
rpn_head
=
dict
(
type
=
'RPNHead'
,
in_channels
=
256
,
feat_channels
=
256
,
anchor_scales
=
[
8
],
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
4
,
8
,
16
,
32
,
64
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
],
use_sigmoid_cls
=
True
),
bbox_roi_extractor
=
dict
(
type
=
'SingleRoIExtractor'
,
roi_layer
=
dict
(
type
=
'RoIAlign'
,
out_size
=
7
,
sample_num
=
2
),
out_channels
=
256
,
featmap_strides
=
[
4
,
8
,
16
,
32
]),
bbox_head
=
dict
(
type
=
'SharedFCBBoxHead'
,
num_fcs
=
2
,
in_channels
=
256
,
fc_out_channels
=
1024
,
roi_feat_size
=
7
,
num_classes
=
81
,
target_means
=
[
0.
,
0.
,
0.
,
0.
],
target_stds
=
[
0.1
,
0.1
,
0.2
,
0.2
],
reg_class_agnostic
=
False
),
mask_roi_extractor
=
dict
(
type
=
'SingleRoIExtractor'
,
roi_layer
=
dict
(
type
=
'RoIAlign'
,
out_size
=
14
,
sample_num
=
2
),
out_channels
=
256
,
featmap_strides
=
[
4
,
8
,
16
,
32
]),
mask_head
=
dict
(
type
=
'FCNMaskHead'
,
num_convs
=
4
,
in_channels
=
256
,
conv_out_channels
=
256
,
num_classes
=
81
))
# model training and testing settings
train_cfg
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
),
allowed_border
=
0
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
),
rcnn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.5
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
512
,
pos_fraction
=
0.25
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
),
mask_size
=
28
,
pos_weight
=-
1
,
debug
=
False
))
test_cfg
=
dict
(
rpn
=
dict
(
nms_across_levels
=
False
,
nms_pre
=
2000
,
nms_post
=
2000
,
max_num
=
2000
,
nms_thr
=
0.7
,
min_bbox_size
=
0
),
rcnn
=
dict
(
score_thr
=
0.05
,
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.5
),
max_per_img
=
100
,
mask_thr_binary
=
0.5
))
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
True
,
with_crowd
=
True
,
with_label
=
True
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
True
,
with_crowd
=
True
,
with_label
=
True
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.02
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
# 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/mask_rcnn_r50_fpn_1x'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'FasterRCNN'
,
pretrained
=
'modelzoo://resnet50'
,
backbone
=
dict
(
type
=
'ResNet'
,
depth
=
50
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
num_outs
=
5
),
rpn_head
=
dict
(
type
=
'RPNHead'
,
in_channels
=
256
,
feat_channels
=
256
,
anchor_scales
=
[
8
],
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
4
,
8
,
16
,
32
,
64
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
],
use_sigmoid_cls
=
True
),
bbox_roi_extractor
=
dict
(
type
=
'SingleRoIExtractor'
,
roi_layer
=
dict
(
type
=
'RoIAlign'
,
out_size
=
7
,
sample_num
=
2
),
out_channels
=
256
,
featmap_strides
=
[
4
,
8
,
16
,
32
]),
bbox_head
=
dict
(
type
=
'SharedFCBBoxHead'
,
num_fcs
=
2
,
in_channels
=
256
,
fc_out_channels
=
1024
,
roi_feat_size
=
7
,
num_classes
=
21
,
target_means
=
[
0.
,
0.
,
0.
,
0.
],
target_stds
=
[
0.1
,
0.1
,
0.2
,
0.2
],
reg_class_agnostic
=
False
))
# model training and testing settings
train_cfg
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
),
allowed_border
=
0
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
),
rcnn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.5
,
min_pos_iou
=
0.5
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
512
,
pos_fraction
=
0.25
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
),
pos_weight
=-
1
,
debug
=
False
))
test_cfg
=
dict
(
rpn
=
dict
(
nms_across_levels
=
False
,
nms_pre
=
2000
,
nms_post
=
2000
,
max_num
=
2000
,
nms_thr
=
0.7
,
min_bbox_size
=
0
),
rcnn
=
dict
(
score_thr
=
0.05
,
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.5
),
max_per_img
=
100
)
# soft-nms is also supported for rcnn testing
# e.g., nms=dict(type='soft_nms', iou_thr=0.5, min_score=0.05)
)
# dataset settings
dataset_type
=
'VOCDataset'
data_root
=
'data/VOCdevkit/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
'RepeatDataset'
,
# to avoid reloading datasets frequently
times
=
3
,
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
=
(
1000
,
600
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
True
,
with_label
=
True
)),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'VOC2007/ImageSets/Main/test.txt'
,
img_prefix
=
data_root
+
'VOC2007/'
,
img_scale
=
(
1000
,
600
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
True
,
with_label
=
True
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'VOC2007/ImageSets/Main/test.txt'
,
img_prefix
=
data_root
+
'VOC2007/'
,
img_scale
=
(
1000
,
600
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.01
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
# learning policy
lr_config
=
dict
(
policy
=
'step'
,
step
=
[
3
])
# actual epoch = 3 * 3 = 9
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
=
4
# actual epoch = 4 * 3 = 12
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/faster_rcnn_r50_fpn_1x_voc0712'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/pascal_voc/ssd300_voc.py
0 → 100644
View file @
76168f9c
# model settings
input_size
=
300
model
=
dict
(
type
=
'SingleStageDetector'
,
pretrained
=
'open-mmlab://vgg16_caffe'
,
backbone
=
dict
(
type
=
'SSDVGG'
,
input_size
=
input_size
,
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
=
input_size
,
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
)))
cudnn_benchmark
=
True
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
=
4
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
'RepeatDataset'
,
times
=
10
,
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
)),
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
=
1e-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
=
[
16
,
20
])
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
=
24
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/ssd300_voc'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/pascal_voc/ssd512_voc.py
0 → 100644
View file @
76168f9c
# model settings
input_size
=
512
model
=
dict
(
type
=
'SingleStageDetector'
,
pretrained
=
'open-mmlab://vgg16_caffe'
,
backbone
=
dict
(
type
=
'SSDVGG'
,
input_size
=
input_size
,
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
=
input_size
,
in_channels
=
(
512
,
1024
,
512
,
256
,
256
,
256
,
256
),
num_classes
=
21
,
anchor_strides
=
(
8
,
16
,
32
,
64
,
128
,
256
,
512
),
basesize_ratio_range
=
(
0.15
,
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
)))
cudnn_benchmark
=
True
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
=
4
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
'RepeatDataset'
,
times
=
10
,
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
=
(
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
)),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'VOC2007/ImageSets/Main/test.txt'
,
img_prefix
=
data_root
+
'VOC2007/'
,
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
+
'VOC2007/ImageSets/Main/test.txt'
,
img_prefix
=
data_root
+
'VOC2007/'
,
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
=
1e-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
=
[
16
,
20
])
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
=
24
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/ssd512_voc'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/retinanet_r101_fpn_1x.py
View file @
76168f9c
...
@@ -31,7 +31,11 @@ model = dict(
...
@@ -31,7 +31,11 @@ model = dict(
# training and testing settings
# training and testing settings
train_cfg
=
dict
(
train_cfg
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.4
,
min_pos_iou
=
0
,
ignore_iof_thr
=-
1
),
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.4
,
min_pos_iou
=
0
,
ignore_iof_thr
=-
1
),
smoothl1_beta
=
0.11
,
smoothl1_beta
=
0.11
,
gamma
=
2.0
,
gamma
=
2.0
,
alpha
=
0.25
,
alpha
=
0.25
,
...
...
configs/retinanet_r50_fpn_1x.py
View file @
76168f9c
...
@@ -31,7 +31,11 @@ model = dict(
...
@@ -31,7 +31,11 @@ model = dict(
# training and testing settings
# training and testing settings
train_cfg
=
dict
(
train_cfg
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.4
,
min_pos_iou
=
0
,
ignore_iof_thr
=-
1
),
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.4
,
min_pos_iou
=
0
,
ignore_iof_thr
=-
1
),
smoothl1_beta
=
0.11
,
smoothl1_beta
=
0.11
,
gamma
=
2.0
,
gamma
=
2.0
,
alpha
=
0.25
,
alpha
=
0.25
,
...
...
configs/retinanet_x101_32x4d_fpn_1x.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'RetinaNet'
,
pretrained
=
'open-mmlab://resnext101_32x4d'
,
backbone
=
dict
(
type
=
'ResNeXt'
,
depth
=
101
,
groups
=
32
,
base_width
=
4
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
start_level
=
1
,
add_extra_convs
=
True
,
num_outs
=
5
),
bbox_head
=
dict
(
type
=
'RetinaHead'
,
num_classes
=
81
,
in_channels
=
256
,
stacked_convs
=
4
,
feat_channels
=
256
,
octave_base_scale
=
4
,
scales_per_octave
=
3
,
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
8
,
16
,
32
,
64
,
128
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
]))
# training and testing settings
train_cfg
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.4
,
min_pos_iou
=
0
,
ignore_iof_thr
=-
1
),
smoothl1_beta
=
0.11
,
gamma
=
2.0
,
alpha
=
0.25
,
allowed_border
=-
1
,
pos_weight
=-
1
,
debug
=
False
)
test_cfg
=
dict
(
nms_pre
=
1000
,
min_bbox_size
=
0
,
score_thr
=
0.05
,
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.5
),
max_per_img
=
100
)
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
True
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
True
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.01
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
# 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
device_ids
=
range
(
8
)
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/retinanet_r50_fpn_1x'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/retinanet_x101_64x4d_fpn_1x.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'RetinaNet'
,
pretrained
=
'open-mmlab://resnext101_64x4d'
,
backbone
=
dict
(
type
=
'ResNeXt'
,
depth
=
101
,
groups
=
64
,
base_width
=
4
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
start_level
=
1
,
add_extra_convs
=
True
,
num_outs
=
5
),
bbox_head
=
dict
(
type
=
'RetinaHead'
,
num_classes
=
81
,
in_channels
=
256
,
stacked_convs
=
4
,
feat_channels
=
256
,
octave_base_scale
=
4
,
scales_per_octave
=
3
,
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
8
,
16
,
32
,
64
,
128
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
]))
# training and testing settings
train_cfg
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.5
,
neg_iou_thr
=
0.4
,
min_pos_iou
=
0
,
ignore_iof_thr
=-
1
),
smoothl1_beta
=
0.11
,
gamma
=
2.0
,
alpha
=
0.25
,
allowed_border
=-
1
,
pos_weight
=-
1
,
debug
=
False
)
test_cfg
=
dict
(
nms_pre
=
1000
,
min_bbox_size
=
0
,
score_thr
=
0.05
,
nms
=
dict
(
type
=
'nms'
,
iou_thr
=
0.5
),
max_per_img
=
100
)
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
True
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
True
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.01
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
# 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
device_ids
=
range
(
8
)
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/retinanet_r50_fpn_1x'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/rpn_r101_fpn_1x.py
View file @
76168f9c
...
@@ -28,17 +28,17 @@ model = dict(
...
@@ -28,17 +28,17 @@ model = dict(
train_cfg
=
dict
(
train_cfg
=
dict
(
rpn
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
),
sampler
=
dict
(
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
num
=
256
,
pos_fraction
=
0.5
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
,
add_gt_as_proposals
=
False
),
pos_balance_sampling
=
False
,
neg_balance_thr
=
0
),
allowed_border
=
0
,
allowed_border
=
0
,
pos_weight
=-
1
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
smoothl1_beta
=
1
/
9.0
,
...
...
configs/rpn_r50_fpn_1x.py
View file @
76168f9c
...
@@ -28,17 +28,17 @@ model = dict(
...
@@ -28,17 +28,17 @@ model = dict(
train_cfg
=
dict
(
train_cfg
=
dict
(
rpn
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
),
sampler
=
dict
(
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
num
=
256
,
pos_fraction
=
0.5
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
,
add_gt_as_proposals
=
False
),
pos_balance_sampling
=
False
,
neg_balance_thr
=
0
),
allowed_border
=
0
,
allowed_border
=
0
,
pos_weight
=-
1
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
smoothl1_beta
=
1
/
9.0
,
...
...
configs/rpn_x101_32x4d_fpn_1x.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'RPN'
,
pretrained
=
'open-mmlab://resnext101_32x4d'
,
backbone
=
dict
(
type
=
'ResNeXt'
,
depth
=
101
,
groups
=
32
,
base_width
=
4
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
num_outs
=
5
),
rpn_head
=
dict
(
type
=
'RPNHead'
,
in_channels
=
256
,
feat_channels
=
256
,
anchor_scales
=
[
8
],
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
4
,
8
,
16
,
32
,
64
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
],
use_sigmoid_cls
=
True
))
# model training and testing settings
train_cfg
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
),
allowed_border
=
0
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
))
test_cfg
=
dict
(
rpn
=
dict
(
nms_across_levels
=
False
,
nms_pre
=
2000
,
nms_post
=
2000
,
max_num
=
2000
,
nms_thr
=
0.7
,
min_bbox_size
=
0
))
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
False
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
False
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.02
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
# runner configs
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
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/rpn_r101_fpn_1x'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/rpn_x101_64x4d_fpn_1x.py
0 → 100644
View file @
76168f9c
# model settings
model
=
dict
(
type
=
'RPN'
,
pretrained
=
'open-mmlab://resnext101_64x4d'
,
backbone
=
dict
(
type
=
'ResNeXt'
,
depth
=
101
,
groups
=
64
,
base_width
=
4
,
num_stages
=
4
,
out_indices
=
(
0
,
1
,
2
,
3
),
frozen_stages
=
1
,
style
=
'pytorch'
),
neck
=
dict
(
type
=
'FPN'
,
in_channels
=
[
256
,
512
,
1024
,
2048
],
out_channels
=
256
,
num_outs
=
5
),
rpn_head
=
dict
(
type
=
'RPNHead'
,
in_channels
=
256
,
feat_channels
=
256
,
anchor_scales
=
[
8
],
anchor_ratios
=
[
0.5
,
1.0
,
2.0
],
anchor_strides
=
[
4
,
8
,
16
,
32
,
64
],
target_means
=
[.
0
,
.
0
,
.
0
,
.
0
],
target_stds
=
[
1.0
,
1.0
,
1.0
,
1.0
],
use_sigmoid_cls
=
True
))
# model training and testing settings
train_cfg
=
dict
(
rpn
=
dict
(
assigner
=
dict
(
type
=
'MaxIoUAssigner'
,
pos_iou_thr
=
0.7
,
neg_iou_thr
=
0.3
,
min_pos_iou
=
0.3
,
ignore_iof_thr
=-
1
),
sampler
=
dict
(
type
=
'RandomSampler'
,
num
=
256
,
pos_fraction
=
0.5
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
False
),
allowed_border
=
0
,
pos_weight
=-
1
,
smoothl1_beta
=
1
/
9.0
,
debug
=
False
))
test_cfg
=
dict
(
rpn
=
dict
(
nms_across_levels
=
False
,
nms_pre
=
2000
,
nms_post
=
2000
,
max_num
=
2000
,
nms_thr
=
0.7
,
min_bbox_size
=
0
))
# dataset settings
dataset_type
=
'CocoDataset'
data_root
=
'data/coco/'
img_norm_cfg
=
dict
(
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.12
,
57.375
],
to_rgb
=
True
)
data
=
dict
(
imgs_per_gpu
=
2
,
workers_per_gpu
=
2
,
train
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0.5
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
False
),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_crowd
=
False
,
with_label
=
False
),
test
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
img_scale
=
(
1333
,
800
),
img_norm_cfg
=
img_norm_cfg
,
size_divisor
=
32
,
flip_ratio
=
0
,
with_mask
=
False
,
with_label
=
False
,
test_mode
=
True
))
# optimizer
optimizer
=
dict
(
type
=
'SGD'
,
lr
=
0.02
,
momentum
=
0.9
,
weight_decay
=
0.0001
)
# runner configs
optimizer_config
=
dict
(
grad_clip
=
dict
(
max_norm
=
35
,
norm_type
=
2
))
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/rpn_r101_fpn_1x'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/ssd300_coco.py
0 → 100644
View file @
76168f9c
# model settings
input_size
=
300
model
=
dict
(
type
=
'SingleStageDetector'
,
pretrained
=
'open-mmlab://vgg16_caffe'
,
backbone
=
dict
(
type
=
'SSDVGG'
,
input_size
=
input_size
,
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
=
input_size
,
in_channels
=
(
512
,
1024
,
512
,
256
,
256
,
256
),
num_classes
=
81
,
anchor_strides
=
(
8
,
16
,
32
,
64
,
100
,
300
),
basesize_ratio_range
=
(
0.15
,
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
)))
cudnn_benchmark
=
True
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'
,
times
=
5
,
dataset
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_train2017.json'
,
img_prefix
=
data_root
+
'train2017/'
,
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
)),
val
=
dict
(
type
=
dataset_type
,
ann_file
=
data_root
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
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
+
'annotations/instances_val2017.json'
,
img_prefix
=
data_root
+
'val2017/'
,
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
=
[
16
,
22
])
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
=
24
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/ssd300_coco'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
configs/ssd512_coco.py
0 → 100644
View file @
76168f9c
# model settings
input_size
=
512
model
=
dict
(
type
=
'SingleStageDetector'
,
pretrained
=
'open-mmlab://vgg16_caffe'
,
backbone
=
dict
(
type
=
'SSDVGG'
,
input_size
=
input_size
,
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
=
input_size
,
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
)))
cudnn_benchmark
=
True
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'
,
times
=
5
,
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
)),
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
=
[
16
,
22
])
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
=
24
dist_params
=
dict
(
backend
=
'nccl'
)
log_level
=
'INFO'
work_dir
=
'./work_dirs/ssd512_coco'
load_from
=
None
resume_from
=
None
workflow
=
[(
'train'
,
1
)]
mmdet/apis/train.py
View file @
76168f9c
...
@@ -6,8 +6,8 @@ import torch
...
@@ -6,8 +6,8 @@ import torch
from
mmcv.runner
import
Runner
,
DistSamplerSeedHook
from
mmcv.runner
import
Runner
,
DistSamplerSeedHook
from
mmcv.parallel
import
MMDataParallel
,
MMDistributedDataParallel
from
mmcv.parallel
import
MMDataParallel
,
MMDistributedDataParallel
from
mmdet.core
import
(
DistOptimizerHook
,
Coco
DistEval
Recall
Hook
,
from
mmdet.core
import
(
DistOptimizerHook
,
DistEval
mAP
Hook
,
CocoDistEvalmAPHook
)
CocoDistEvalRecallHook
,
CocoDistEvalmAPHook
)
from
mmdet.datasets
import
build_dataloader
from
mmdet.datasets
import
build_dataloader
from
mmdet.models
import
RPN
from
mmdet.models
import
RPN
from
.env
import
get_root_logger
from
.env
import
get_root_logger
...
@@ -81,9 +81,13 @@ def _dist_train(model, dataset, cfg, validate=False):
...
@@ -81,9 +81,13 @@ def _dist_train(model, dataset, cfg, validate=False):
# register eval hooks
# register eval hooks
if
validate
:
if
validate
:
if
isinstance
(
model
.
module
,
RPN
):
if
isinstance
(
model
.
module
,
RPN
):
# TODO: implement recall hooks for other datasets
runner
.
register_hook
(
CocoDistEvalRecallHook
(
cfg
.
data
.
val
))
runner
.
register_hook
(
CocoDistEvalRecallHook
(
cfg
.
data
.
val
))
elif
cfg
.
data
.
val
.
type
==
'CocoDataset'
:
else
:
if
cfg
.
data
.
val
.
type
==
'CocoDataset'
:
runner
.
register_hook
(
CocoDistEvalmAPHook
(
cfg
.
data
.
val
))
runner
.
register_hook
(
CocoDistEvalmAPHook
(
cfg
.
data
.
val
))
else
:
runner
.
register_hook
(
DistEvalmAPHook
(
cfg
.
data
.
val
))
if
cfg
.
resume_from
:
if
cfg
.
resume_from
:
runner
.
resume
(
cfg
.
resume_from
)
runner
.
resume
(
cfg
.
resume_from
)
...
...
mmdet/core/anchor/anchor_generator.py
View file @
76168f9c
...
@@ -3,11 +3,12 @@ import torch
...
@@ -3,11 +3,12 @@ import torch
class
AnchorGenerator
(
object
):
class
AnchorGenerator
(
object
):
def
__init__
(
self
,
base_size
,
scales
,
ratios
,
scale_major
=
True
):
def
__init__
(
self
,
base_size
,
scales
,
ratios
,
scale_major
=
True
,
ctr
=
None
):
self
.
base_size
=
base_size
self
.
base_size
=
base_size
self
.
scales
=
torch
.
Tensor
(
scales
)
self
.
scales
=
torch
.
Tensor
(
scales
)
self
.
ratios
=
torch
.
Tensor
(
ratios
)
self
.
ratios
=
torch
.
Tensor
(
ratios
)
self
.
scale_major
=
scale_major
self
.
scale_major
=
scale_major
self
.
ctr
=
ctr
self
.
base_anchors
=
self
.
gen_base_anchors
()
self
.
base_anchors
=
self
.
gen_base_anchors
()
@
property
@
property
...
@@ -15,13 +16,13 @@ class AnchorGenerator(object):
...
@@ -15,13 +16,13 @@ class AnchorGenerator(object):
return
self
.
base_anchors
.
size
(
0
)
return
self
.
base_anchors
.
size
(
0
)
def
gen_base_anchors
(
self
):
def
gen_base_anchors
(
self
):
base_anchor
=
torch
.
Tensor
(
w
=
self
.
base_size
[
0
,
0
,
self
.
base_size
-
1
,
self
.
base_size
-
1
])
h
=
self
.
base_size
if
self
.
ctr
is
None
:
w
=
base_anchor
[
2
]
-
base_anchor
[
0
]
+
1
x_ctr
=
0.5
*
(
w
-
1
)
h
=
base_anchor
[
3
]
-
base_anchor
[
1
]
+
1
y_ctr
=
0.5
*
(
h
-
1
)
x_ctr
=
base_anchor
[
0
]
+
0.5
*
(
w
-
1
)
else
:
y_ctr
=
base_anchor
[
1
]
+
0.5
*
(
h
-
1
)
x_ctr
,
y_ctr
=
self
.
ctr
h_ratios
=
torch
.
sqrt
(
self
.
ratios
)
h_ratios
=
torch
.
sqrt
(
self
.
ratios
)
w_ratios
=
1
/
h_ratios
w_ratios
=
1
/
h_ratios
...
...
mmdet/core/anchor/anchor_target.py
View file @
76168f9c
import
torch
import
torch
from
..bbox
import
assign_and_sample
,
BBoxA
ssigner
,
SamplingResult
,
bbox2delta
from
..bbox
import
assign_and_sample
,
build_a
ssigner
,
PseudoSampler
,
bbox2delta
from
..utils
import
multi_apply
from
..utils
import
multi_apply
...
@@ -13,7 +13,8 @@ def anchor_target(anchor_list,
...
@@ -13,7 +13,8 @@ def anchor_target(anchor_list,
cfg
,
cfg
,
gt_labels_list
=
None
,
gt_labels_list
=
None
,
cls_out_channels
=
1
,
cls_out_channels
=
1
,
sampling
=
True
):
sampling
=
True
,
unmap_outputs
=
True
):
"""Compute regression and classification targets for anchors.
"""Compute regression and classification targets for anchors.
Args:
Args:
...
@@ -54,7 +55,8 @@ def anchor_target(anchor_list,
...
@@ -54,7 +55,8 @@ def anchor_target(anchor_list,
target_stds
=
target_stds
,
target_stds
=
target_stds
,
cfg
=
cfg
,
cfg
=
cfg
,
cls_out_channels
=
cls_out_channels
,
cls_out_channels
=
cls_out_channels
,
sampling
=
sampling
)
sampling
=
sampling
,
unmap_outputs
=
unmap_outputs
)
# no valid anchors
# no valid anchors
if
any
([
labels
is
None
for
labels
in
all_labels
]):
if
any
([
labels
is
None
for
labels
in
all_labels
]):
return
None
return
None
...
@@ -94,7 +96,8 @@ def anchor_target_single(flat_anchors,
...
@@ -94,7 +96,8 @@ def anchor_target_single(flat_anchors,
target_stds
,
target_stds
,
cfg
,
cfg
,
cls_out_channels
=
1
,
cls_out_channels
=
1
,
sampling
=
True
):
sampling
=
True
,
unmap_outputs
=
True
):
inside_flags
=
anchor_inside_flags
(
flat_anchors
,
valid_flags
,
inside_flags
=
anchor_inside_flags
(
flat_anchors
,
valid_flags
,
img_meta
[
'img_shape'
][:
2
],
img_meta
[
'img_shape'
][:
2
],
cfg
.
allowed_border
)
cfg
.
allowed_border
)
...
@@ -107,16 +110,12 @@ def anchor_target_single(flat_anchors,
...
@@ -107,16 +110,12 @@ def anchor_target_single(flat_anchors,
assign_result
,
sampling_result
=
assign_and_sample
(
assign_result
,
sampling_result
=
assign_and_sample
(
anchors
,
gt_bboxes
,
None
,
None
,
cfg
)
anchors
,
gt_bboxes
,
None
,
None
,
cfg
)
else
:
else
:
bbox_assigner
=
BBoxA
ssigner
(
**
cfg
.
assigner
)
bbox_assigner
=
build_a
ssigner
(
cfg
.
assigner
)
assign_result
=
bbox_assigner
.
assign
(
anchors
,
gt_bboxes
,
None
,
assign_result
=
bbox_assigner
.
assign
(
anchors
,
gt_bboxes
,
None
,
gt_labels
)
gt_labels
)
pos_inds
=
torch
.
nonzero
(
bbox_sampler
=
PseudoSampler
()
assign_result
.
gt_inds
>
0
).
squeeze
(
-
1
).
unique
()
sampling_result
=
bbox_sampler
.
sample
(
assign_result
,
anchors
,
neg_inds
=
torch
.
nonzero
(
gt_bboxes
)
assign_result
.
gt_inds
==
0
).
squeeze
(
-
1
).
unique
()
gt_flags
=
anchors
.
new_zeros
(
anchors
.
shape
[
0
],
dtype
=
torch
.
uint8
)
sampling_result
=
SamplingResult
(
pos_inds
,
neg_inds
,
anchors
,
gt_bboxes
,
assign_result
,
gt_flags
)
num_valid_anchors
=
anchors
.
shape
[
0
]
num_valid_anchors
=
anchors
.
shape
[
0
]
bbox_targets
=
torch
.
zeros_like
(
anchors
)
bbox_targets
=
torch
.
zeros_like
(
anchors
)
...
@@ -144,6 +143,7 @@ def anchor_target_single(flat_anchors,
...
@@ -144,6 +143,7 @@ def anchor_target_single(flat_anchors,
label_weights
[
neg_inds
]
=
1.0
label_weights
[
neg_inds
]
=
1.0
# map up to original set of anchors
# map up to original set of anchors
if
unmap_outputs
:
num_total_anchors
=
flat_anchors
.
size
(
0
)
num_total_anchors
=
flat_anchors
.
size
(
0
)
labels
=
unmap
(
labels
,
num_total_anchors
,
inside_flags
)
labels
=
unmap
(
labels
,
num_total_anchors
,
inside_flags
)
label_weights
=
unmap
(
label_weights
,
num_total_anchors
,
inside_flags
)
label_weights
=
unmap
(
label_weights
,
num_total_anchors
,
inside_flags
)
...
...
Prev
1
2
3
4
5
Next
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