sunrgbd-3d.py 3.74 KB
Newer Older
liyinhao's avatar
liyinhao committed
1
2
3
4
dataset_type = 'SUNRGBDDataset'
data_root = 'data/sunrgbd/'
class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser',
               'night_stand', 'bookshelf', 'bathtub')
zhangshilong's avatar
zhangshilong committed
5

6
metainfo = dict(classes=class_names)
zhangshilong's avatar
zhangshilong committed
7

8
9
10
11
12
13
# Example to use different file client
# Method 1: simply set the data root and let the file I/O module
# automatically infer from prefix (not support LMDB and Memcache yet)

# data_root = 's3://openmmlab/datasets/detection3d/sunrgbd/'

Jingwei Zhang's avatar
Jingwei Zhang committed
14
# Method 2: Use backend_args, file_client_args in versions before 1.1.0
15
# backend_args = dict(
16
17
#     backend='petrel',
#     path_mapping=dict({
18
19
20
21
#         './data/': 's3://openmmlab/datasets/detection3d/',
#          'data/': 's3://openmmlab/datasets/detection3d/'
#      }))
backend_args = None
22

liyinhao's avatar
liyinhao committed
23
24
25
train_pipeline = [
    dict(
        type='LoadPointsFromFile',
26
        coord_type='DEPTH',
liyinhao's avatar
liyinhao committed
27
28
        shift_height=True,
        load_dim=6,
29
30
        use_dim=[0, 1, 2],
        backend_args=backend_args),
liyinhao's avatar
liyinhao committed
31
32
    dict(type='LoadAnnotations3D'),
    dict(
wuyuefeng's avatar
wuyuefeng committed
33
34
35
36
37
38
39
40
41
        type='RandomFlip3D',
        sync_2d=False,
        flip_ratio_bev_horizontal=0.5,
    ),
    dict(
        type='GlobalRotScaleTrans',
        rot_range=[-0.523599, 0.523599],
        scale_ratio_range=[0.85, 1.15],
        shift_height=True),
42
    dict(type='PointSample', num_points=20000),
zhangshilong's avatar
zhangshilong committed
43
44
45
    dict(
        type='Pack3DDetInputs',
        keys=['points', 'gt_bboxes_3d', 'gt_labels_3d'])
liyinhao's avatar
liyinhao committed
46
47
48
49
]
test_pipeline = [
    dict(
        type='LoadPointsFromFile',
50
        coord_type='DEPTH',
liyinhao's avatar
liyinhao committed
51
52
        shift_height=True,
        load_dim=6,
53
54
        use_dim=[0, 1, 2],
        backend_args=backend_args),
zhangwenwei's avatar
zhangwenwei committed
55
56
57
58
59
60
61
62
63
64
65
    dict(
        type='MultiScaleFlipAug3D',
        img_scale=(1333, 800),
        pts_scale_ratio=1,
        flip=False,
        transforms=[
            dict(
                type='GlobalRotScaleTrans',
                rot_range=[0, 0],
                scale_ratio_range=[1., 1.],
                translation_std=[0, 0, 0]),
wuyuefeng's avatar
wuyuefeng committed
66
67
68
69
70
            dict(
                type='RandomFlip3D',
                sync_2d=False,
                flip_ratio_bev_horizontal=0.5,
            ),
zhangshilong's avatar
zhangshilong committed
71
72
73
            dict(type='PointSample', num_points=20000)
        ]),
    dict(type='Pack3DDetInputs', keys=['points'])
74
]
liyinhao's avatar
liyinhao committed
75

zhangshilong's avatar
zhangshilong committed
76
77
78
79
80
train_dataloader = dict(
    batch_size=16,
    num_workers=4,
    sampler=dict(type='DefaultSampler', shuffle=True),
    dataset=dict(
liyinhao's avatar
liyinhao committed
81
82
83
84
85
        type='RepeatDataset',
        times=5,
        dataset=dict(
            type=dataset_type,
            data_root=data_root,
zhangshilong's avatar
zhangshilong committed
86
            ann_file='sunrgbd_infos_train.pkl',
liyinhao's avatar
liyinhao committed
87
            pipeline=train_pipeline,
wuyuefeng's avatar
Demo  
wuyuefeng committed
88
            filter_empty_gt=False,
zhangshilong's avatar
zhangshilong committed
89
            metainfo=metainfo,
wuyuefeng's avatar
Demo  
wuyuefeng committed
90
91
            # we use box_type_3d='LiDAR' in kitti and nuscenes dataset
            # and box_type_3d='Depth' in sunrgbd and scannet dataset.
92
93
            box_type_3d='Depth',
            backend_args=backend_args)))
zhangshilong's avatar
zhangshilong committed
94
95
96
97
98
99

val_dataloader = dict(
    batch_size=1,
    num_workers=1,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
liyinhao's avatar
liyinhao committed
100
101
        type=dataset_type,
        data_root=data_root,
zhangshilong's avatar
zhangshilong committed
102
        ann_file='sunrgbd_infos_val.pkl',
liyinhao's avatar
liyinhao committed
103
        pipeline=test_pipeline,
zhangshilong's avatar
zhangshilong committed
104
        metainfo=metainfo,
wuyuefeng's avatar
Demo  
wuyuefeng committed
105
        test_mode=True,
106
107
        box_type_3d='Depth',
        backend_args=backend_args))
zhangshilong's avatar
zhangshilong committed
108
109
110
111
112
test_dataloader = dict(
    batch_size=1,
    num_workers=1,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
liyinhao's avatar
liyinhao committed
113
114
        type=dataset_type,
        data_root=data_root,
zhangshilong's avatar
zhangshilong committed
115
        ann_file='sunrgbd_infos_val.pkl',
liyinhao's avatar
liyinhao committed
116
        pipeline=test_pipeline,
zhangshilong's avatar
zhangshilong committed
117
        metainfo=metainfo,
wuyuefeng's avatar
Demo  
wuyuefeng committed
118
        test_mode=True,
119
120
        box_type_3d='Depth',
        backend_args=backend_args))
zhangshilong's avatar
zhangshilong committed
121
122
val_evaluator = dict(type='IndoorMetric')
test_evaluator = val_evaluator
123
124
125
126

vis_backends = [dict(type='LocalVisBackend')]
visualizer = dict(
    type='Det3DLocalVisualizer', vis_backends=vis_backends, name='visualizer')