scannet-3d.py 4.27 KB
Newer Older
liyinhao's avatar
liyinhao committed
1
2
# dataset settings
dataset_type = 'ScanNetDataset'
ChaimZhu's avatar
ChaimZhu committed
3
data_root = 'data/scannet/'
jshilong's avatar
jshilong committed
4
5

metainfo = dict(
6
    classes=('cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window',
jshilong's avatar
jshilong committed
7
8
9
             'bookshelf', 'picture', 'counter', 'desk', 'curtain',
             'refrigerator', 'showercurtrain', 'toilet', 'sink', 'bathtub',
             'garbagebin'))
10

11
12
13
14
15
16
17
18
# 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/scannet/'

# Method 2: Use backend_args, file_client_args in versions before 1.1.0rc4
# backend_args = dict(
19
20
#     backend='petrel',
#     path_mapping=dict({
21
22
23
24
#         './data/': 's3://openmmlab/datasets/detection3d/',
#          'data/': 's3://openmmlab/datasets/detection3d/'
#      }))
backend_args = None
25

liyinhao's avatar
liyinhao committed
26
27
28
train_pipeline = [
    dict(
        type='LoadPointsFromFile',
29
        coord_type='DEPTH',
liyinhao's avatar
liyinhao committed
30
31
        shift_height=True,
        load_dim=6,
32
33
        use_dim=[0, 1, 2],
        backend_args=backend_args),
liyinhao's avatar
liyinhao committed
34
35
36
37
38
    dict(
        type='LoadAnnotations3D',
        with_bbox_3d=True,
        with_label_3d=True,
        with_mask_3d=True,
39
40
        with_seg_3d=True,
        backend_args=backend_args),
41
    dict(type='GlobalAlignment', rotation_axis=2),
42
    dict(type='PointSegClassMapping'),
43
    dict(type='PointSample', num_points=40000),
liyinhao's avatar
liyinhao committed
44
    dict(
wuyuefeng's avatar
wuyuefeng committed
45
46
47
48
49
50
51
52
53
        type='RandomFlip3D',
        sync_2d=False,
        flip_ratio_bev_horizontal=0.5,
        flip_ratio_bev_vertical=0.5),
    dict(
        type='GlobalRotScaleTrans',
        rot_range=[-0.087266, 0.087266],
        scale_ratio_range=[1.0, 1.0],
        shift_height=True),
liyinhao's avatar
liyinhao committed
54
    dict(
jshilong's avatar
jshilong committed
55
        type='Pack3DDetInputs',
liyinhao's avatar
liyinhao committed
56
57
58
59
60
61
62
63
        keys=[
            'points', 'gt_bboxes_3d', 'gt_labels_3d', 'pts_semantic_mask',
            'pts_instance_mask'
        ])
]
test_pipeline = [
    dict(
        type='LoadPointsFromFile',
64
        coord_type='DEPTH',
liyinhao's avatar
liyinhao committed
65
66
        shift_height=True,
        load_dim=6,
67
68
        use_dim=[0, 1, 2],
        backend_args=backend_args),
69
    dict(type='GlobalAlignment', rotation_axis=2),
zhangwenwei's avatar
zhangwenwei committed
70
71
72
73
74
75
76
77
78
79
80
    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
81
82
83
84
85
            dict(
                type='RandomFlip3D',
                sync_2d=False,
                flip_ratio_bev_horizontal=0.5,
                flip_ratio_bev_vertical=0.5),
86
            dict(type='PointSample', num_points=40000),
jshilong's avatar
jshilong committed
87
88
        ]),
    dict(type='Pack3DDetInputs', keys=['points'])
89
]
liyinhao's avatar
liyinhao committed
90

jshilong's avatar
jshilong committed
91
92
93
94
95
train_dataloader = dict(
    batch_size=8,
    num_workers=4,
    sampler=dict(type='DefaultSampler', shuffle=True),
    dataset=dict(
liyinhao's avatar
liyinhao committed
96
97
98
99
100
        type='RepeatDataset',
        times=5,
        dataset=dict(
            type=dataset_type,
            data_root=data_root,
jshilong's avatar
jshilong committed
101
            ann_file='scannet_infos_train.pkl',
liyinhao's avatar
liyinhao committed
102
103
            pipeline=train_pipeline,
            filter_empty_gt=False,
jshilong's avatar
jshilong committed
104
            metainfo=metainfo,
wuyuefeng's avatar
Demo  
wuyuefeng committed
105
106
            # we use box_type_3d='LiDAR' in kitti and nuscenes dataset
            # and box_type_3d='Depth' in sunrgbd and scannet dataset.
107
108
            box_type_3d='Depth',
            backend_args=backend_args)))
jshilong's avatar
jshilong committed
109
110
111
112
113
114

val_dataloader = dict(
    batch_size=1,
    num_workers=1,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
liyinhao's avatar
liyinhao committed
115
116
        type=dataset_type,
        data_root=data_root,
jshilong's avatar
jshilong committed
117
        ann_file='scannet_infos_val.pkl',
liyinhao's avatar
liyinhao committed
118
        pipeline=test_pipeline,
jshilong's avatar
jshilong committed
119
        metainfo=metainfo,
wuyuefeng's avatar
Demo  
wuyuefeng committed
120
        test_mode=True,
121
122
        box_type_3d='Depth',
        backend_args=backend_args))
jshilong's avatar
jshilong committed
123
124
125
126
127
test_dataloader = dict(
    batch_size=1,
    num_workers=1,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
liyinhao's avatar
liyinhao committed
128
129
        type=dataset_type,
        data_root=data_root,
jshilong's avatar
jshilong committed
130
        ann_file='scannet_infos_val.pkl',
liyinhao's avatar
liyinhao committed
131
        pipeline=test_pipeline,
jshilong's avatar
jshilong committed
132
        metainfo=metainfo,
wuyuefeng's avatar
Demo  
wuyuefeng committed
133
        test_mode=True,
134
135
        box_type_3d='Depth',
        backend_args=backend_args))
jshilong's avatar
jshilong committed
136
137
val_evaluator = dict(type='IndoorMetric')
test_evaluator = val_evaluator
138
139
140
141

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