Unverified Commit e943e84d authored by Sun Jiahao's avatar Sun Jiahao Committed by GitHub
Browse files

[Enhance] Format semantickitti label mapping (#2323)

* fix polarmix UT

* format

* rename SemanticKittiDataset

* add platte & fix data info bug

* fix ut

* fix semantic_kitti ut

* fix ut label_map

* fix ut label_map

* add indication

* add indication

* fix typo
parent 0b42e351
# dataset settings # For SemanticKitti we usually do 19-class segmentation.
dataset_type = 'SemanticKITTIDataset' # For labels_map we follow the uniform format of MMDetection & MMSegmentation
# i.e. we consider the unlabeled class as the last one, which is different
# from the original implementation of some methods e.g. Cylinder3D.
dataset_type = 'SemanticKittiDataset'
data_root = 'data/semantickitti/' data_root = 'data/semantickitti/'
class_names = [ class_names = [
'unlabeled', 'car', 'bicycle', 'motorcycle', 'truck', 'bus', 'person', 'car', 'bicycle', 'motorcycle', 'truck', 'bus', 'person', 'bicyclist',
'bicyclist', 'motorcyclist', 'road', 'parking', 'sidewalk', 'other-ground', 'motorcyclist', 'road', 'parking', 'sidewalk', 'other-ground', 'building',
'building', 'fence', 'vegetation', 'trunck', 'terrian', 'pole', 'fence', 'vegetation', 'trunck', 'terrian', 'pole', 'traffic-sign'
'traffic-sign'
] ]
palette = [
[174, 199, 232],
[152, 223, 138],
[31, 119, 180],
[255, 187, 120],
[188, 189, 34],
[140, 86, 75],
[255, 152, 150],
[214, 39, 40],
[197, 176, 213],
[148, 103, 189],
[196, 156, 148],
[23, 190, 207],
[247, 182, 210],
[219, 219, 141],
[255, 127, 14],
[158, 218, 229],
[44, 160, 44],
[112, 128, 144],
[227, 119, 194],
[82, 84, 163],
]
labels_map = { labels_map = {
0: 0, # "unlabeled" 0: 19, # "unlabeled"
1: 0, # "outlier" mapped to "unlabeled" --------------mapped 1: 19, # "outlier" mapped to "unlabeled" --------------mapped
10: 1, # "car" 10: 0, # "car"
11: 2, # "bicycle" 11: 1, # "bicycle"
13: 5, # "bus" mapped to "other-vehicle" --------------mapped 13: 4, # "bus" mapped to "other-vehicle" --------------mapped
15: 3, # "motorcycle" 15: 2, # "motorcycle"
16: 5, # "on-rails" mapped to "other-vehicle" ---------mapped 16: 4, # "on-rails" mapped to "other-vehicle" ---------mapped
18: 4, # "truck" 18: 3, # "truck"
20: 5, # "other-vehicle" 20: 4, # "other-vehicle"
30: 6, # "person" 30: 5, # "person"
31: 7, # "bicyclist" 31: 6, # "bicyclist"
32: 8, # "motorcyclist" 32: 7, # "motorcyclist"
40: 9, # "road" 40: 8, # "road"
44: 10, # "parking" 44: 9, # "parking"
48: 11, # "sidewalk" 48: 10, # "sidewalk"
49: 12, # "other-ground" 49: 11, # "other-ground"
50: 13, # "building" 50: 12, # "building"
51: 14, # "fence" 51: 13, # "fence"
52: 0, # "other-structure" mapped to "unlabeled" ------mapped 52: 19, # "other-structure" mapped to "unlabeled" ------mapped
60: 9, # "lane-marking" to "road" ---------------------mapped 60: 8, # "lane-marking" to "road" ---------------------mapped
70: 15, # "vegetation" 70: 14, # "vegetation"
71: 16, # "trunk" 71: 15, # "trunk"
72: 17, # "terrain" 72: 16, # "terrain"
80: 18, # "pole" 80: 17, # "pole"
81: 19, # "traffic-sign" 81: 18, # "traffic-sign"
99: 0, # "other-object" to "unlabeled" ----------------mapped 99: 19, # "other-object" to "unlabeled" ----------------mapped
252: 1, # "moving-car" to "car" ------------------------mapped 252: 0, # "moving-car" to "car" ------------------------mapped
253: 7, # "moving-bicyclist" to "bicyclist" ------------mapped 253: 6, # "moving-bicyclist" to "bicyclist" ------------mapped
254: 6, # "moving-person" to "person" ------------------mapped 254: 5, # "moving-person" to "person" ------------------mapped
255: 8, # "moving-motorcyclist" to "motorcyclist" ------mapped 255: 7, # "moving-motorcyclist" to "motorcyclist" ------mapped
256: 5, # "moving-on-rails" mapped to "other-vehic------mapped 256: 4, # "moving-on-rails" mapped to "other-vehic------mapped
257: 5, # "moving-bus" mapped to "other-vehicle" -------mapped 257: 4, # "moving-bus" mapped to "other-vehicle" -------mapped
258: 4, # "moving-truck" to "truck" --------------------mapped 258: 3, # "moving-truck" to "truck" --------------------mapped
259: 5 # "moving-other"-vehicle to "other-vehicle"-----mapped 259: 4 # "moving-other"-vehicle to "other-vehicle"-----mapped
} }
metainfo = dict( metainfo = dict(
classes=class_names, classes=class_names, seg_label_mapping=labels_map, max_label=259)
palette=palette,
seg_label_mapping=labels_map,
max_label=259)
input_modality = dict(use_lidar=True, use_camera=False) input_modality = dict(use_lidar=True, use_camera=False)
...@@ -99,7 +75,10 @@ train_pipeline = [ ...@@ -99,7 +75,10 @@ train_pipeline = [
backend_args=backend_args), backend_args=backend_args),
dict( dict(
type='LoadAnnotations3D', type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True, with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16, seg_offset=2**16,
dataset_type='semantickitti', dataset_type='semantickitti',
backend_args=backend_args), backend_args=backend_args),
...@@ -126,7 +105,10 @@ test_pipeline = [ ...@@ -126,7 +105,10 @@ test_pipeline = [
backend_args=backend_args), backend_args=backend_args),
dict( dict(
type='LoadAnnotations3D', type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True, with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16, seg_offset=2**16,
dataset_type='semantickitti', dataset_type='semantickitti',
backend_args=backend_args), backend_args=backend_args),
...@@ -144,7 +126,10 @@ eval_pipeline = [ ...@@ -144,7 +126,10 @@ eval_pipeline = [
backend_args=backend_args), backend_args=backend_args),
dict( dict(
type='LoadAnnotations3D', type='LoadAnnotations3D',
with_bbox_3d=False,
with_label_3d=False,
with_seg_3d=True, with_seg_3d=True,
seg_3d_dtype='np.int32',
seg_offset=2**16, seg_offset=2**16,
dataset_type='semantickitti', dataset_type='semantickitti',
backend_args=backend_args), backend_args=backend_args),
...@@ -153,7 +138,7 @@ eval_pipeline = [ ...@@ -153,7 +138,7 @@ eval_pipeline = [
] ]
train_dataloader = dict( train_dataloader = dict(
batch_size=4, batch_size=2,
num_workers=4, num_workers=4,
sampler=dict(type='DefaultSampler', shuffle=True), sampler=dict(type='DefaultSampler', shuffle=True),
dataset=dict( dataset=dict(
...@@ -162,10 +147,11 @@ train_dataloader = dict( ...@@ -162,10 +147,11 @@ train_dataloader = dict(
dataset=dict( dataset=dict(
type=dataset_type, type=dataset_type,
data_root=data_root, data_root=data_root,
ann_file='train_infos.pkl', ann_file='semantickitti_infos_train.pkl',
pipeline=train_pipeline, pipeline=train_pipeline,
metainfo=metainfo, metainfo=metainfo,
modality=input_modality, modality=input_modality,
ignore_index=19,
backend_args=backend_args)), backend_args=backend_args)),
) )
...@@ -179,10 +165,11 @@ test_dataloader = dict( ...@@ -179,10 +165,11 @@ test_dataloader = dict(
dataset=dict( dataset=dict(
type=dataset_type, type=dataset_type,
data_root=data_root, data_root=data_root,
ann_file='valid_infos.pkl', ann_file='semantickitti_infos_val.pkl',
pipeline=test_pipeline, pipeline=test_pipeline,
metainfo=metainfo, metainfo=metainfo,
modality=input_modality, modality=input_modality,
ignore_index=19,
test_mode=True, test_mode=True,
backend_args=backend_args)), backend_args=backend_args)),
) )
...@@ -191,3 +178,7 @@ val_dataloader = test_dataloader ...@@ -191,3 +178,7 @@ val_dataloader = test_dataloader
val_evaluator = dict(type='SegMetric') val_evaluator = dict(type='SegMetric')
test_evaluator = val_evaluator test_evaluator = val_evaluator
vis_backends = [dict(type='LocalVisBackend')]
visualizer = dict(
type='Det3DLocalVisualizer', vis_backends=vis_backends, name='visualizer')
...@@ -9,7 +9,7 @@ from .s3dis_dataset import S3DISDataset, S3DISSegDataset ...@@ -9,7 +9,7 @@ from .s3dis_dataset import S3DISDataset, S3DISSegDataset
from .scannet_dataset import (ScanNetDataset, ScanNetInstanceSegDataset, from .scannet_dataset import (ScanNetDataset, ScanNetInstanceSegDataset,
ScanNetSegDataset) ScanNetSegDataset)
from .seg3d_dataset import Seg3DDataset from .seg3d_dataset import Seg3DDataset
from .semantickitti_dataset import SemanticKITTIDataset from .semantickitti_dataset import SemanticKittiDataset
from .sunrgbd_dataset import SUNRGBDDataset from .sunrgbd_dataset import SUNRGBDDataset
# yapf: disable # yapf: disable
from .transforms import (AffineResize, BackgroundPointsFilter, GlobalAlignment, from .transforms import (AffineResize, BackgroundPointsFilter, GlobalAlignment,
...@@ -33,7 +33,7 @@ __all__ = [ ...@@ -33,7 +33,7 @@ __all__ = [
'NormalizePointsColor', 'IndoorPatchPointSample', 'IndoorPointSample', 'NormalizePointsColor', 'IndoorPatchPointSample', 'IndoorPointSample',
'PointSample', 'LoadAnnotations3D', 'GlobalAlignment', 'SUNRGBDDataset', 'PointSample', 'LoadAnnotations3D', 'GlobalAlignment', 'SUNRGBDDataset',
'ScanNetDataset', 'ScanNetSegDataset', 'ScanNetInstanceSegDataset', 'ScanNetDataset', 'ScanNetSegDataset', 'ScanNetInstanceSegDataset',
'SemanticKITTIDataset', 'Det3DDataset', 'Seg3DDataset', 'SemanticKittiDataset', 'Det3DDataset', 'Seg3DDataset',
'LoadPointsFromMultiSweeps', 'WaymoDataset', 'BackgroundPointsFilter', 'LoadPointsFromMultiSweeps', 'WaymoDataset', 'BackgroundPointsFilter',
'VoxelBasedPointSampler', 'get_loading_pipeline', 'RandomDropPointsColor', 'VoxelBasedPointSampler', 'get_loading_pipeline', 'RandomDropPointsColor',
'RandomJitterPoints', 'ObjectNameFilter', 'AffineResize', 'RandomJitterPoints', 'ObjectNameFilter', 'AffineResize',
......
...@@ -256,6 +256,9 @@ class Seg3DDataset(BaseDataset): ...@@ -256,6 +256,9 @@ class Seg3DDataset(BaseDataset):
self.data_prefix.get('pts', ''), self.data_prefix.get('pts', ''),
info['lidar_points']['lidar_path']) info['lidar_points']['lidar_path'])
info['num_pts_feats'] = info['lidar_points']['num_pts_feats']
info['lidar_path'] = info['lidar_points']['lidar_path']
if self.modality['use_camera']: if self.modality['use_camera']:
for cam_id, img_info in info['images'].items(): for cam_id, img_info in info['images'].items():
if 'img_path' in img_info: if 'img_path' in img_info:
......
...@@ -8,8 +8,8 @@ from .seg3d_dataset import Seg3DDataset ...@@ -8,8 +8,8 @@ from .seg3d_dataset import Seg3DDataset
@DATASETS.register_module() @DATASETS.register_module()
class SemanticKITTIDataset(Seg3DDataset): class SemanticKittiDataset(Seg3DDataset):
r"""SemanticKITTI Dataset. r"""SemanticKitti Dataset.
This class serves as the API for experiments on the SemanticKITTI Dataset This class serves as the API for experiments on the SemanticKITTI Dataset
Please refer to <http://www.semantic-kitti.org/dataset.html>`_ Please refer to <http://www.semantic-kitti.org/dataset.html>`_
...@@ -44,14 +44,20 @@ class SemanticKITTIDataset(Seg3DDataset): ...@@ -44,14 +44,20 @@ class SemanticKITTIDataset(Seg3DDataset):
Defaults to False. Defaults to False.
""" """
METAINFO = { METAINFO = {
'classes': ('unlabeled', 'car', 'bicycle', 'motorcycle', 'truck', 'classes': ('car', 'bicycle', 'motorcycle', 'truck', 'bus', 'person',
'bus', 'person', 'bicyclist', 'motorcyclist', 'road', 'bicyclist', 'motorcyclist', 'road', 'parking', 'sidewalk',
'parking', 'sidewalk', 'other-ground', 'building', 'fence', 'other-ground', 'building', 'fence', 'vegetation',
'vegetation', 'trunck', 'terrian', 'pole', 'traffic-sign'), 'trunck', 'terrian', 'pole', 'traffic-sign'),
'palette': [[100, 150, 245], [100, 230, 245], [30, 60, 150],
[80, 30, 180], [100, 80, 250], [155, 30, 30],
[255, 40, 200], [150, 30, 90], [255, 0, 255],
[255, 150, 255], [75, 0, 75], [175, 0, 75], [255, 200, 0],
[255, 120, 50], [0, 175, 0], [135, 60, 0], [150, 240, 80],
[255, 240, 150], [255, 0, 0]],
'seg_valid_class_ids': 'seg_valid_class_ids':
tuple(range(20)), tuple(range(19)),
'seg_all_class_ids': 'seg_all_class_ids':
tuple(range(20)), tuple(range(19)),
} }
def __init__(self, def __init__(self,
...@@ -59,7 +65,7 @@ class SemanticKITTIDataset(Seg3DDataset): ...@@ -59,7 +65,7 @@ class SemanticKITTIDataset(Seg3DDataset):
ann_file: str = '', ann_file: str = '',
metainfo: Optional[dict] = None, metainfo: Optional[dict] = None,
data_prefix: dict = dict( data_prefix: dict = dict(
pts='points', pts='',
img='', img='',
pts_instance_mask='', pts_instance_mask='',
pts_semantic_mask=''), pts_semantic_mask=''),
...@@ -83,7 +89,7 @@ class SemanticKITTIDataset(Seg3DDataset): ...@@ -83,7 +89,7 @@ class SemanticKITTIDataset(Seg3DDataset):
**kwargs) **kwargs)
def get_seg_label_mapping(self, metainfo): def get_seg_label_mapping(self, metainfo):
seg_label_mapping = np.zeros(metainfo['max_label'] + 1) seg_label_mapping = np.zeros(metainfo['max_label'] + 1, dtype=np.int64)
for idx in metainfo['seg_label_mapping']: for idx in metainfo['seg_label_mapping']:
seg_label_mapping[idx] = metainfo['seg_label_mapping'][idx] seg_label_mapping[idx] = metainfo['seg_label_mapping'][idx]
return seg_label_mapping return seg_label_mapping
...@@ -3,75 +3,53 @@ import unittest ...@@ -3,75 +3,53 @@ import unittest
import numpy as np import numpy as np
from mmdet3d.datasets import SemanticKITTIDataset from mmdet3d.datasets import SemanticKittiDataset
from mmdet3d.utils import register_all_modules from mmdet3d.utils import register_all_modules
def _generate_semantickitti_dataset_config(): def _generate_semantickitti_dataset_config():
data_root = './tests/data/semantickitti/' data_root = './tests/data/semantickitti/'
ann_file = 'semantickitti_infos.pkl' ann_file = 'semantickitti_infos.pkl'
classes = ('unlabeled', 'car', 'bicycle', 'motorcycle', 'truck', 'bus', classes = ('car', 'bicycle', 'motorcycle', 'truck', 'bus', 'person',
'person', 'bicyclist', 'motorcyclist', 'road', 'parking', 'bicyclist', 'motorcyclist', 'road', 'parking', 'sidewalk',
'sidewalk', 'other-ground', 'building', 'fence', 'vegetation', 'other-ground', 'building', 'fence', 'vegetation', 'trunck',
'trunck', 'terrian', 'pole', 'traffic-sign') 'terrian', 'pole', 'traffic-sign')
palette = [
[174, 199, 232],
[152, 223, 138],
[31, 119, 180],
[255, 187, 120],
[188, 189, 34],
[140, 86, 75],
[255, 152, 150],
[214, 39, 40],
[197, 176, 213],
[148, 103, 189],
[196, 156, 148],
[23, 190, 207],
[247, 182, 210],
[219, 219, 141],
[255, 127, 14],
[158, 218, 229],
[44, 160, 44],
[112, 128, 144],
[227, 119, 194],
[82, 84, 163],
]
seg_label_mapping = { seg_label_mapping = {
0: 0, # "unlabeled" 0: 19, # "unlabeled"
1: 0, # "outlier" mapped to "unlabeled" --------------mapped 1: 19, # "outlier" mapped to "unlabeled" --------------mapped
10: 1, # "car" 10: 0, # "car"
11: 2, # "bicycle" 11: 1, # "bicycle"
13: 5, # "bus" mapped to "other-vehicle" --------------mapped 13: 4, # "bus" mapped to "other-vehicle" --------------mapped
15: 3, # "motorcycle" 15: 2, # "motorcycle"
16: 5, # "on-rails" mapped to "other-vehicle" ---------mapped 16: 4, # "on-rails" mapped to "other-vehicle" ---------mapped
18: 4, # "truck" 18: 3, # "truck"
20: 5, # "other-vehicle" 20: 4, # "other-vehicle"
30: 6, # "person" 30: 5, # "person"
31: 7, # "bicyclist" 31: 6, # "bicyclist"
32: 8, # "motorcyclist" 32: 7, # "motorcyclist"
40: 9, # "road" 40: 8, # "road"
44: 10, # "parking" 44: 9, # "parking"
48: 11, # "sidewalk" 48: 10, # "sidewalk"
49: 12, # "other-ground" 49: 11, # "other-ground"
50: 13, # "building" 50: 12, # "building"
51: 14, # "fence" 51: 13, # "fence"
52: 0, # "other-structure" mapped to "unlabeled" ------mapped 52: 19, # "other-structure" mapped to "unlabeled" ------mapped
60: 9, # "lane-marking" to "road" ---------------------mapped 60: 8, # "lane-marking" to "road" ---------------------mapped
70: 15, # "vegetation" 70: 14, # "vegetation"
71: 16, # "trunk" 71: 15, # "trunk"
72: 17, # "terrain" 72: 16, # "terrain"
80: 18, # "pole" 80: 17, # "pole"
81: 19, # "traffic-sign" 81: 18, # "traffic-sign"
99: 0, # "other-object" to "unlabeled" ----------------mapped 99: 19, # "other-object" to "unlabeled" ----------------mapped
252: 1, # "moving-car" to "car" ------------------------mapped 252: 0, # "moving-car" to "car" ------------------------mapped
253: 7, # "moving-bicyclist" to "bicyclist" ------------mapped 253: 6, # "moving-bicyclist" to "bicyclist" ------------mapped
254: 6, # "moving-person" to "person" ------------------mapped 254: 5, # "moving-person" to "person" ------------------mapped
255: 8, # "moving-motorcyclist" to "motorcyclist" ------mapped 255: 7, # "moving-motorcyclist" to "motorcyclist" ------mapped
256: 5, # "moving-on-rails" mapped to "other-vehic------mapped 256: 4, # "moving-on-rails" mapped to "other-vehic------mapped
257: 5, # "moving-bus" mapped to "other-vehicle" -------mapped 257: 4, # "moving-bus" mapped to "other-vehicle" -------mapped
258: 4, # "moving-truck" to "truck" --------------------mapped 258: 3, # "moving-truck" to "truck" --------------------mapped
259: 5 # "moving-other"-vehicle to "other-vehicle"-----mapped 259: 4 # "moving-other"-vehicle to "other-vehicle"-----mapped
} }
max_label = 259 max_label = 259
modality = dict(use_lidar=True, use_camera=False) modality = dict(use_lidar=True, use_camera=False)
...@@ -96,25 +74,24 @@ def _generate_semantickitti_dataset_config(): ...@@ -96,25 +74,24 @@ def _generate_semantickitti_dataset_config():
data_prefix = dict( data_prefix = dict(
pts='sequences/00/velodyne', pts_semantic_mask='sequences/00/labels') pts='sequences/00/velodyne', pts_semantic_mask='sequences/00/labels')
return (data_root, ann_file, classes, palette, data_prefix, pipeline, return (data_root, ann_file, classes, data_prefix, pipeline, modality,
modality, seg_label_mapping, max_label) seg_label_mapping, max_label)
class TestSemanticKITTIDataset(unittest.TestCase): class TestSemanticKittiDataset(unittest.TestCase):
def test_semantickitti(self): def test_semantickitti(self):
(data_root, ann_file, classes, palette, data_prefix, pipeline, (data_root, ann_file, classes, data_prefix, pipeline, modality,
modality, seg_label_mapping, seg_label_mapping,
max_label) = _generate_semantickitti_dataset_config() max_label) = _generate_semantickitti_dataset_config()
register_all_modules() register_all_modules()
np.random.seed(0) np.random.seed(0)
semantickitti_dataset = SemanticKITTIDataset( semantickitti_dataset = SemanticKittiDataset(
data_root, data_root,
ann_file, ann_file,
metainfo=dict( metainfo=dict(
classes=classes, classes=classes,
palette=palette,
seg_label_mapping=seg_label_mapping, seg_label_mapping=seg_label_mapping,
max_label=max_label), max_label=max_label),
data_prefix=data_prefix, data_prefix=data_prefix,
...@@ -129,10 +106,9 @@ class TestSemanticKITTIDataset(unittest.TestCase): ...@@ -129,10 +106,9 @@ class TestSemanticKITTIDataset(unittest.TestCase):
self.assertEqual(points.shape[0], pts_semantic_mask.shape[0]) self.assertEqual(points.shape[0], pts_semantic_mask.shape[0])
expected_pts_semantic_mask = np.array([ expected_pts_semantic_mask = np.array([
13., 13., 13., 15., 15., 13., 0., 13., 15., 13., 13., 15., 16., 0., 12, 12, 12, 14, 14, 12, 19, 12, 14, 12, 12, 14, 15, 19, 14, 12, 12,
15., 13., 13., 13., 13., 0., 13., 13., 13., 13., 13., 15., 13., 12, 12, 19, 12, 12, 12, 12, 12, 14, 12, 15, 12, 14, 14, 17, 12, 14,
16., 13., 15., 15., 18., 13., 15., 15., 15., 16., 15., 13., 13., 14, 14, 15, 14, 12, 12, 14, 12, 17, 14, 12, 14, 12, 14, 14, 12
15., 13., 18., 15., 13., 15., 13., 15., 15., 13.
]) ])
self.assertTrue( self.assertTrue(
......
...@@ -7,7 +7,7 @@ import torch ...@@ -7,7 +7,7 @@ import torch
from mmengine.testing import assert_allclose from mmengine.testing import assert_allclose
from mmdet3d.datasets import (GlobalAlignment, RandomFlip3D, from mmdet3d.datasets import (GlobalAlignment, RandomFlip3D,
SemanticKITTIDataset) SemanticKittiDataset)
from mmdet3d.datasets.transforms import GlobalRotScaleTrans, LaserMix, PolarMix from mmdet3d.datasets.transforms import GlobalRotScaleTrans, LaserMix, PolarMix
from mmdet3d.structures import LiDARPoints from mmdet3d.structures import LiDARPoints
from mmdet3d.testing import create_data_info_after_loading from mmdet3d.testing import create_data_info_after_loading
...@@ -124,32 +124,10 @@ class TestPolarMix(unittest.TestCase): ...@@ -124,32 +124,10 @@ class TestPolarMix(unittest.TestCase):
seg_3d_dtype='np.int32'), seg_3d_dtype='np.int32'),
dict(type='PointSegClassMapping'), dict(type='PointSegClassMapping'),
] ]
classes = ('unlabeled', 'car', 'bicycle', 'motorcycle', 'truck', 'bus', classes = ('car', 'bicycle', 'motorcycle', 'truck', 'bus', 'person',
'person', 'bicyclist', 'motorcyclist', 'road', 'parking', 'bicyclist', 'motorcyclist', 'road', 'parking', 'sidewalk',
'sidewalk', 'other-ground', 'building', 'fence', 'other-ground', 'building', 'fence', 'vegetation', 'trunck',
'vegetation', 'trunck', 'terrian', 'pole', 'traffic-sign') 'terrian', 'pole', 'traffic-sign')
palette = [
[174, 199, 232],
[152, 223, 138],
[31, 119, 180],
[255, 187, 120],
[188, 189, 34],
[140, 86, 75],
[255, 152, 150],
[214, 39, 40],
[197, 176, 213],
[148, 103, 189],
[196, 156, 148],
[23, 190, 207],
[247, 182, 210],
[219, 219, 141],
[255, 127, 14],
[158, 218, 229],
[44, 160, 44],
[112, 128, 144],
[227, 119, 194],
[82, 84, 163],
]
seg_label_mapping = { seg_label_mapping = {
0: 0, # "unlabeled" 0: 0, # "unlabeled"
1: 0, # "outlier" mapped to "unlabeled" --------------mapped 1: 0, # "outlier" mapped to "unlabeled" --------------mapped
...@@ -187,12 +165,11 @@ class TestPolarMix(unittest.TestCase): ...@@ -187,12 +165,11 @@ class TestPolarMix(unittest.TestCase):
259: 5 # "moving-other"-vehicle to "other-vehicle"-----mapped 259: 5 # "moving-other"-vehicle to "other-vehicle"-----mapped
} }
max_label = 259 max_label = 259
self.dataset = SemanticKITTIDataset( self.dataset = SemanticKittiDataset(
'./tests/data/semantickitti/', './tests/data/semantickitti/',
'semantickitti_infos.pkl', 'semantickitti_infos.pkl',
metainfo=dict( metainfo=dict(
classes=classes, classes=classes,
palette=palette,
seg_label_mapping=seg_label_mapping, seg_label_mapping=seg_label_mapping,
max_label=max_label), max_label=max_label),
data_prefix=dict( data_prefix=dict(
...@@ -242,32 +219,10 @@ class TestLaserMix(unittest.TestCase): ...@@ -242,32 +219,10 @@ class TestLaserMix(unittest.TestCase):
seg_3d_dtype='np.int32'), seg_3d_dtype='np.int32'),
dict(type='PointSegClassMapping'), dict(type='PointSegClassMapping'),
] ]
classes = ('unlabeled', 'car', 'bicycle', 'motorcycle', 'truck', 'bus', classes = ('car', 'bicycle', 'motorcycle', 'truck', 'bus', 'person',
'person', 'bicyclist', 'motorcyclist', 'road', 'parking', 'bicyclist', 'motorcyclist', 'road', 'parking', 'sidewalk',
'sidewalk', 'other-ground', 'building', 'fence', 'other-ground', 'building', 'fence', 'vegetation', 'trunck',
'vegetation', 'trunck', 'terrian', 'pole', 'traffic-sign') 'terrian', 'pole', 'traffic-sign')
palette = [
[174, 199, 232],
[152, 223, 138],
[31, 119, 180],
[255, 187, 120],
[188, 189, 34],
[140, 86, 75],
[255, 152, 150],
[214, 39, 40],
[197, 176, 213],
[148, 103, 189],
[196, 156, 148],
[23, 190, 207],
[247, 182, 210],
[219, 219, 141],
[255, 127, 14],
[158, 218, 229],
[44, 160, 44],
[112, 128, 144],
[227, 119, 194],
[82, 84, 163],
]
seg_label_mapping = { seg_label_mapping = {
0: 0, # "unlabeled" 0: 0, # "unlabeled"
1: 0, # "outlier" mapped to "unlabeled" --------------mapped 1: 0, # "outlier" mapped to "unlabeled" --------------mapped
...@@ -305,12 +260,11 @@ class TestLaserMix(unittest.TestCase): ...@@ -305,12 +260,11 @@ class TestLaserMix(unittest.TestCase):
259: 5 # "moving-other"-vehicle to "other-vehicle"-----mapped 259: 5 # "moving-other"-vehicle to "other-vehicle"-----mapped
} }
max_label = 259 max_label = 259
self.dataset = SemanticKITTIDataset( self.dataset = SemanticKittiDataset(
'./tests/data/semantickitti/', './tests/data/semantickitti/',
'semantickitti_infos.pkl', 'semantickitti_infos.pkl',
metainfo=dict( metainfo=dict(
classes=classes, classes=classes,
palette=palette,
seg_label_mapping=seg_label_mapping, seg_label_mapping=seg_label_mapping,
max_label=max_label), max_label=max_label),
data_prefix=dict( data_prefix=dict(
......
...@@ -62,7 +62,9 @@ def get_semantickitti_info(split): ...@@ -62,7 +62,9 @@ def get_semantickitti_info(split):
'lidar_path': 'lidar_path':
osp.join('sequences', osp.join('sequences',
str(i_folder).zfill(2), 'velodyne', str(i_folder).zfill(2), 'velodyne',
str(j).zfill(6) + '.bin') str(j).zfill(6) + '.bin'),
'num_pts_feats':
4
}, },
'pts_semantic_mask_path': 'pts_semantic_mask_path':
osp.join('sequences', osp.join('sequences',
......
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