Unverified Commit a481f5a8 authored by xiliu8006's avatar xiliu8006 Committed by GitHub
Browse files

[Enhance] Move train_cfg test_cfg to model (#307)

* Move train_cfg/test_cfg to model

* Move train_cfg/test_cfg to model

* Move train_cfg/test_cfg to model

* Move train_cfg/test_cfg to model

* Move train_cfg/test_cfg to model

* Move train_cfg/test_cfg to model

* Move train_cfg/test_cfg to model

* Move train_cfg and test_cfg into model

* modify centerpoint configs

* Modify docs

* modify build_detector

* modify test_config_build_detector

* modify build_detector parameters

* Adopt the same strategy in build_detector
parent a347ac75
_base_ = ['./centerpoint_0075voxel_second_secfpn_4x8_cyclic_20e_nus.py']
test_cfg = dict(pts=dict(nms_type='circle'))
model = dict(test_cfg=dict(pts=dict(nms_type='circle')))
......@@ -12,6 +12,5 @@ model = dict(
padding=1,
groups=4),
init_bias=-2.19,
final_kernel=3)))
test_cfg = dict(pts=dict(nms_type='circle'))
final_kernel=3)),
test_cfg=dict(pts=dict(nms_type='circle')))
......@@ -15,10 +15,10 @@ class_names = [
model = dict(
pts_voxel_layer=dict(point_cloud_range=point_cloud_range),
pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2])))
# model training and testing settings
train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range))
test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2]))
pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2])),
# model training and testing settings
train_cfg=dict(pts=dict(point_cloud_range=point_cloud_range)),
test_cfg=dict(pts=dict(pc_range=point_cloud_range[:2])))
dataset_type = 'NuScenesDataset'
data_root = 'data/nuscenes/'
......
_base_ = ['./centerpoint_01voxel_second_secfpn_4x8_cyclic_20e_nus.py']
test_cfg = dict(pts=dict(nms_type='circle'))
model = dict(test_cfg=dict(pts=dict(nms_type='circle')))
......@@ -12,6 +12,5 @@ model = dict(
padding=1,
groups=4),
init_bias=-2.19,
final_kernel=3)))
test_cfg = dict(pts=dict(nms_type='circle'))
final_kernel=3)),
test_cfg=dict(pts=dict(nms_type='circle')))
......@@ -16,10 +16,10 @@ class_names = [
model = dict(
pts_voxel_layer=dict(point_cloud_range=point_cloud_range),
pts_voxel_encoder=dict(point_cloud_range=point_cloud_range),
pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2])))
# model training and testing settings
train_cfg = dict(pts=dict(point_cloud_range=point_cloud_range))
test_cfg = dict(pts=dict(pc_range=point_cloud_range[:2]))
pts_bbox_head=dict(bbox_coder=dict(pc_range=point_cloud_range[:2])),
# model training and testing settings
train_cfg=dict(pts=dict(point_cloud_range=point_cloud_range)),
test_cfg=dict(pts=dict(pc_range=point_cloud_range[:2])))
dataset_type = 'NuScenesDataset'
data_root = 'data/nuscenes/'
......
_base_ = ['./centerpoint_02pillar_second_secfpn_4x8_cyclic_20e_nus.py']
test_cfg = dict(pts=dict(nms_type='circle'))
model = dict(test_cfg=dict(pts=dict(nms_type='circle')))
......@@ -12,6 +12,5 @@ model = dict(
padding=1,
groups=4),
init_bias=-2.19,
final_kernel=3)))
test_cfg = dict(pts=dict(nms_type='circle'))
final_kernel=3)),
test_cfg=dict(pts=dict(nms_type='circle')))
......@@ -70,10 +70,10 @@ model = dict(
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=0.8),
loss_dir=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)))
# model training and testing settings
train_cfg = dict(
pts=dict(code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.25, 0.25]))
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)),
# model training and testing settings
train_cfg = dict(
pts=dict(code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.25, 0.25])))
```
## Results
......
......@@ -42,7 +42,7 @@ model = dict(
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=0.8),
loss_dir=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)))
# model training and testing settings
train_cfg = dict(
pts=dict(code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.25, 0.25]))
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)),
# model training and testing settings
train_cfg=dict(
pts=dict(code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.25, 0.25])))
......@@ -87,9 +87,9 @@ model = dict(
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=2.0),
loss_dir=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)))
# model training and testing settings
train_cfg = dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)),
# model training and testing settings
train_cfg=dict(
pts=dict(
assigner=[
dict( # for Pedestrian
......@@ -116,8 +116,8 @@ train_cfg = dict(
],
allowed_border=0,
pos_weight=-1,
debug=False))
test_cfg = dict(
debug=False)),
test_cfg=dict(
pts=dict(
use_rotate_nms=True,
nms_across_levels=False,
......@@ -125,7 +125,7 @@ test_cfg = dict(
score_thr=0.1,
min_bbox_size=0,
nms_pre=100,
max_num=50))
max_num=50)))
# dataset settings
dataset_type = 'KittiDataset'
......
......@@ -130,9 +130,9 @@ model = dict(
num_classes=10,
loss_mask=dict(
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))
]))
# model training and testing settings
train_cfg = dict(
]),
# model training and testing settings
train_cfg=dict(
rpn=dict(
assigner=dict(
type='MaxIoUAssigner',
......@@ -205,8 +205,8 @@ train_cfg = dict(
mask_size=28,
pos_weight=-1,
debug=False)
])
test_cfg = dict(
]),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
......@@ -218,4 +218,4 @@ test_cfg = dict(
score_thr=0.001,
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100,
mask_thr_binary=0.5))
mask_thr_binary=0.5)))
......@@ -112,9 +112,9 @@ model = dict(
type='CrossEntropyLoss',
use_sigmoid=True,
reduction='sum',
loss_weight=1.0))))
# model training and testing settings
train_cfg = dict(
loss_weight=1.0))),
# model training and testing settings
train_cfg=dict(
rpn=dict(
assigner=[
dict( # for Pedestrian
......@@ -153,21 +153,24 @@ train_cfg = dict(
assigner=[
dict( # for Pedestrian
type='MaxIoUAssigner',
iou_calculator=dict(type='BboxOverlaps3D', coordinate='lidar'),
iou_calculator=dict(
type='BboxOverlaps3D', coordinate='lidar'),
pos_iou_thr=0.55,
neg_iou_thr=0.55,
min_pos_iou=0.55,
ignore_iof_thr=-1),
dict( # for Cyclist
type='MaxIoUAssigner',
iou_calculator=dict(type='BboxOverlaps3D', coordinate='lidar'),
iou_calculator=dict(
type='BboxOverlaps3D', coordinate='lidar'),
pos_iou_thr=0.55,
neg_iou_thr=0.55,
min_pos_iou=0.55,
ignore_iof_thr=-1),
dict( # for Car
type='MaxIoUAssigner',
iou_calculator=dict(type='BboxOverlaps3D', coordinate='lidar'),
iou_calculator=dict(
type='BboxOverlaps3D', coordinate='lidar'),
pos_iou_thr=0.55,
neg_iou_thr=0.55,
min_pos_iou=0.55,
......@@ -183,8 +186,8 @@ train_cfg = dict(
add_gt_as_proposals=False,
return_iou=True),
cls_pos_thr=0.75,
cls_neg_thr=0.25))
test_cfg = dict(
cls_neg_thr=0.25)),
test_cfg=dict(
rpn=dict(
nms_pre=1024,
nms_post=100,
......@@ -193,7 +196,10 @@ test_cfg = dict(
score_thr=0,
use_rotate_nms=True),
rcnn=dict(
use_rotate_nms=True, use_raw_score=True, nms_thr=0.01, score_thr=0.1))
use_rotate_nms=True,
use_raw_score=True,
nms_thr=0.01,
score_thr=0.1)))
# dataset settings
dataset_type = 'KittiDataset'
......
......@@ -17,9 +17,9 @@ model = dict(
roi_head=dict(
num_classes=1,
semantic_head=dict(num_classes=1),
bbox_head=dict(num_classes=1)))
# model training and testing settings
train_cfg = dict(
bbox_head=dict(num_classes=1)),
# model training and testing settings
train_cfg=dict(
_delete_=True,
rpn=dict(
assigner=dict(
......@@ -57,8 +57,8 @@ train_cfg = dict(
add_gt_as_proposals=False,
return_iou=True),
cls_pos_thr=0.75,
cls_neg_thr=0.25))
test_cfg = dict(
cls_neg_thr=0.25)),
test_cfg=dict(
rpn=dict(
nms_pre=1024,
nms_post=100,
......@@ -67,7 +67,10 @@ test_cfg = dict(
score_thr=0,
use_rotate_nms=True),
rcnn=dict(
use_rotate_nms=True, use_raw_score=True, nms_thr=0.01, score_thr=0.1))
use_rotate_nms=True,
use_raw_score=True,
nms_thr=0.01,
score_thr=0.1)))
# dataset settings
dataset_type = 'KittiDataset'
......
......@@ -12,9 +12,9 @@ model = dict(
ranges=[[0, -39.68, -1.78, 69.12, 39.68, -1.78]],
sizes=[[1.6, 3.9, 1.56]],
rotations=[0, 1.57],
reshape_out=True)))
# model training and testing settings
train_cfg = dict(
reshape_out=True)),
# model training and testing settings
train_cfg=dict(
_delete_=True,
assigner=dict(
type='MaxIoUAssigner',
......@@ -25,7 +25,7 @@ train_cfg = dict(
ignore_iof_thr=-1),
allowed_border=0,
pos_weight=-1,
debug=False)
debug=False))
# dataset settings
dataset_type = 'KittiDataset'
......
......@@ -19,10 +19,9 @@ model = dict(
ranges=[[-74.88, -74.88, -0.0345, 74.88, 74.88, -0.0345]],
sizes=[[2.08, 4.73, 1.77]],
rotations=[0, 1.57],
reshape_out=True)))
# model training and testing settings
train_cfg = dict(
reshape_out=True)),
# model training and testing settings
train_cfg=dict(
_delete_=True,
pts=dict(
assigner=dict(
......@@ -35,4 +34,4 @@ train_cfg = dict(
allowed_border=0,
code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
pos_weight=-1,
debug=False))
debug=False)))
......@@ -16,10 +16,9 @@ model = dict(
ranges=[[-74.88, -74.88, -0.0345, 74.88, 74.88, -0.0345]],
sizes=[[2.08, 4.73, 1.77]],
rotations=[0, 1.57],
reshape_out=True)))
# model training and testing settings
train_cfg = dict(
reshape_out=True)),
# model training and testing settings
train_cfg=dict(
_delete_=True,
pts=dict(
assigner=dict(
......@@ -32,4 +31,4 @@ train_cfg = dict(
allowed_border=0,
code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
pos_weight=-1,
debug=False))
debug=False)))
......@@ -14,9 +14,9 @@ model = dict(
ranges=[[0, -40.0, -1.78, 70.4, 40.0, -1.78]],
sizes=[[1.6, 3.9, 1.56]],
rotations=[0, 1.57],
reshape_out=True)))
# model training and testing settings
train_cfg = dict(
reshape_out=True)),
# model training and testing settings
train_cfg=dict(
_delete_=True,
assigner=dict(
type='MaxIoUAssigner',
......@@ -27,4 +27,4 @@ train_cfg = dict(
ignore_iof_thr=-1),
allowed_border=0,
pos_weight=-1,
debug=False)
debug=False))
......@@ -155,10 +155,9 @@ model = dict(
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0),
loss_dir=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)))
# model training and testing settings
train_cfg = dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.2)),
# model training and testing settings
train_cfg=dict(
_delete_=True,
pts=dict(
assigner=[
......@@ -236,4 +235,4 @@ train_cfg = dict(
allowed_border=0,
code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2],
pos_weight=-1,
debug=False))
debug=False)))
......@@ -44,6 +44,32 @@ For `1x`/`2x`, initial learning rate decays by a factor of 10 at the 8/16th and
For `20e`, initial learning rate decays by a factor of 10 at the 16th and 19th epochs.
- `{dataset}`: dataset like `nus-3d`, `kitti-3d`, `lyft-3d`, `scannet-3d`, `sunrgbd-3d`. We also indicate the number of classes we are using if there exist multiple settings, e.g., `kitti-3d-3class` and `kitti-3d-car` means training on KITTI dataset with 3 classes and single class, respectively.
## Deprecated train_cfg/test_cfg
Following MMDetection, the `train_cfg` and `test_cfg` are deprecated in config file, please specify them in the model config. The original config structure is as below.
```python
# deprecated
model = dict(
type=...,
...
)
train_cfg=dict(...)
test_cfg=dict(...)
```
The migration example is as below.
```python
# recommended
model = dict(
type=...,
...
train_cfg=dict(...),
test_cfg=dict(...)
)
```
## An example of VoteNet
```python
......@@ -144,16 +170,16 @@ model = dict(
semantic_loss=dict( # Config to semantic loss
type='CrossEntropyLoss', # Type of loss
reduction='sum', # Specifies the reduction to apply to the output
loss_weight=1.0))) # Loss weight of the semantic loss
train_cfg = dict( # Config of training hyperparameters for votenet
loss_weight=1.0)), # Loss weight of the semantic loss
train_cfg = dict( # Config of training hyperparameters for votenet
pos_distance_thr=0.3, # distance >= threshold 0.3 will be taken as positive samples
neg_distance_thr=0.6, # distance < threshold 0.6 will be taken as positive samples
sample_mod='vote') # Mode of the sampling method
test_cfg = dict( # Config of testing hyperparameters for votenet
sample_mod='vote'), # Mode of the sampling method
test_cfg = dict( # Config of testing hyperparameters for votenet
sample_mod='seed', # Mode of the sampling method
nms_thr=0.25, # The threshold to be used during NMS
score_thr=0.8, # Threshold to filter out boxes
per_class_proposal=False) # Whether to use per_class_proposal
per_class_proposal=False)) # Whether to use per_class_proposal
dataset_type = 'ScanNetDataset' # Type of the dataset
data_root = './data/scannet/' # Root path of the data
class_names = ('cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment