3
3
4
4
import numpy as np
5
5
6
- from mmdet3d .datasets import SemanticKITTIDataset
6
+ from mmdet3d .datasets import SemanticKittiDataset
7
7
from mmdet3d .utils import register_all_modules
8
8
9
9
10
10
def _generate_semantickitti_dataset_config ():
11
11
data_root = './tests/data/semantickitti/'
12
12
ann_file = 'semantickitti_infos.pkl'
13
- classes = ('unlabeled' , 'car' , 'bicycle' , 'motorcycle' , 'truck' , 'bus' ,
14
- 'person' , 'bicyclist' , 'motorcyclist' , 'road' , 'parking' ,
15
- 'sidewalk' , 'other-ground' , 'building' , 'fence' , 'vegetation' ,
16
- 'trunck' , 'terrian' , 'pole' , 'traffic-sign' )
17
- palette = [
18
- [174 , 199 , 232 ],
19
- [152 , 223 , 138 ],
20
- [31 , 119 , 180 ],
21
- [255 , 187 , 120 ],
22
- [188 , 189 , 34 ],
23
- [140 , 86 , 75 ],
24
- [255 , 152 , 150 ],
25
- [214 , 39 , 40 ],
26
- [197 , 176 , 213 ],
27
- [148 , 103 , 189 ],
28
- [196 , 156 , 148 ],
29
- [23 , 190 , 207 ],
30
- [247 , 182 , 210 ],
31
- [219 , 219 , 141 ],
32
- [255 , 127 , 14 ],
33
- [158 , 218 , 229 ],
34
- [44 , 160 , 44 ],
35
- [112 , 128 , 144 ],
36
- [227 , 119 , 194 ],
37
- [82 , 84 , 163 ],
38
- ]
13
+ classes = ('car' , 'bicycle' , 'motorcycle' , 'truck' , 'bus' , 'person' ,
14
+ 'bicyclist' , 'motorcyclist' , 'road' , 'parking' , 'sidewalk' ,
15
+ 'other-ground' , 'building' , 'fence' , 'vegetation' , 'trunck' ,
16
+ 'terrian' , 'pole' , 'traffic-sign' )
39
17
40
18
seg_label_mapping = {
41
- 0 : 0 , # "unlabeled"
42
- 1 : 0 , # "outlier" mapped to "unlabeled" --------------mapped
43
- 10 : 1 , # "car"
44
- 11 : 2 , # "bicycle"
45
- 13 : 5 , # "bus" mapped to "other-vehicle" --------------mapped
46
- 15 : 3 , # "motorcycle"
47
- 16 : 5 , # "on-rails" mapped to "other-vehicle" ---------mapped
48
- 18 : 4 , # "truck"
49
- 20 : 5 , # "other-vehicle"
50
- 30 : 6 , # "person"
51
- 31 : 7 , # "bicyclist"
52
- 32 : 8 , # "motorcyclist"
53
- 40 : 9 , # "road"
54
- 44 : 10 , # "parking"
55
- 48 : 11 , # "sidewalk"
56
- 49 : 12 , # "other-ground"
57
- 50 : 13 , # "building"
58
- 51 : 14 , # "fence"
59
- 52 : 0 , # "other-structure" mapped to "unlabeled" ------mapped
60
- 60 : 9 , # "lane-marking" to "road" ---------------------mapped
61
- 70 : 15 , # "vegetation"
62
- 71 : 16 , # "trunk"
63
- 72 : 17 , # "terrain"
64
- 80 : 18 , # "pole"
65
- 81 : 19 , # "traffic-sign"
66
- 99 : 0 , # "other-object" to "unlabeled" ----------------mapped
67
- 252 : 1 , # "moving-car" to "car" ------------------------mapped
68
- 253 : 7 , # "moving-bicyclist" to "bicyclist" ------------mapped
69
- 254 : 6 , # "moving-person" to "person" ------------------mapped
70
- 255 : 8 , # "moving-motorcyclist" to "motorcyclist" ------mapped
71
- 256 : 5 , # "moving-on-rails" mapped to "other-vehic------mapped
72
- 257 : 5 , # "moving-bus" mapped to "other-vehicle" -------mapped
73
- 258 : 4 , # "moving-truck" to "truck" --------------------mapped
74
- 259 : 5 # "moving-other"-vehicle to "other-vehicle"-----mapped
19
+ 0 : 19 , # "unlabeled"
20
+ 1 : 19 , # "outlier" mapped to "unlabeled" --------------mapped
21
+ 10 : 0 , # "car"
22
+ 11 : 1 , # "bicycle"
23
+ 13 : 4 , # "bus" mapped to "other-vehicle" --------------mapped
24
+ 15 : 2 , # "motorcycle"
25
+ 16 : 4 , # "on-rails" mapped to "other-vehicle" ---------mapped
26
+ 18 : 3 , # "truck"
27
+ 20 : 4 , # "other-vehicle"
28
+ 30 : 5 , # "person"
29
+ 31 : 6 , # "bicyclist"
30
+ 32 : 7 , # "motorcyclist"
31
+ 40 : 8 , # "road"
32
+ 44 : 9 , # "parking"
33
+ 48 : 10 , # "sidewalk"
34
+ 49 : 11 , # "other-ground"
35
+ 50 : 12 , # "building"
36
+ 51 : 13 , # "fence"
37
+ 52 : 19 , # "other-structure" mapped to "unlabeled" ------mapped
38
+ 60 : 8 , # "lane-marking" to "road" ---------------------mapped
39
+ 70 : 14 , # "vegetation"
40
+ 71 : 15 , # "trunk"
41
+ 72 : 16 , # "terrain"
42
+ 80 : 17 , # "pole"
43
+ 81 : 18 , # "traffic-sign"
44
+ 99 : 19 , # "other-object" to "unlabeled" ----------------mapped
45
+ 252 : 0 , # "moving-car" to "car" ------------------------mapped
46
+ 253 : 6 , # "moving-bicyclist" to "bicyclist" ------------mapped
47
+ 254 : 5 , # "moving-person" to "person" ------------------mapped
48
+ 255 : 7 , # "moving-motorcyclist" to "motorcyclist" ------mapped
49
+ 256 : 4 , # "moving-on-rails" mapped to "other-vehic------mapped
50
+ 257 : 4 , # "moving-bus" mapped to "other-vehicle" -------mapped
51
+ 258 : 3 , # "moving-truck" to "truck" --------------------mapped
52
+ 259 : 4 # "moving-other"-vehicle to "other-vehicle"-----mapped
75
53
}
76
54
max_label = 259
77
55
modality = dict (use_lidar = True , use_camera = False )
@@ -96,25 +74,24 @@ def _generate_semantickitti_dataset_config():
96
74
data_prefix = dict (
97
75
pts = 'sequences/00/velodyne' , pts_semantic_mask = 'sequences/00/labels' )
98
76
99
- return (data_root , ann_file , classes , palette , data_prefix , pipeline ,
100
- modality , seg_label_mapping , max_label )
77
+ return (data_root , ann_file , classes , data_prefix , pipeline , modality ,
78
+ seg_label_mapping , max_label )
101
79
102
80
103
- class TestSemanticKITTIDataset (unittest .TestCase ):
81
+ class TestSemanticKittiDataset (unittest .TestCase ):
104
82
105
83
def test_semantickitti (self ):
106
- (data_root , ann_file , classes , palette , data_prefix , pipeline ,
107
- modality , seg_label_mapping ,
84
+ (data_root , ann_file , classes , data_prefix , pipeline , modality ,
85
+ seg_label_mapping ,
108
86
max_label ) = _generate_semantickitti_dataset_config ()
109
87
110
88
register_all_modules ()
111
89
np .random .seed (0 )
112
- semantickitti_dataset = SemanticKITTIDataset (
90
+ semantickitti_dataset = SemanticKittiDataset (
113
91
data_root ,
114
92
ann_file ,
115
93
metainfo = dict (
116
94
classes = classes ,
117
- palette = palette ,
118
95
seg_label_mapping = seg_label_mapping ,
119
96
max_label = max_label ),
120
97
data_prefix = data_prefix ,
@@ -129,10 +106,9 @@ def test_semantickitti(self):
129
106
self .assertEqual (points .shape [0 ], pts_semantic_mask .shape [0 ])
130
107
131
108
expected_pts_semantic_mask = np .array ([
132
- 13. , 13. , 13. , 15. , 15. , 13. , 0. , 13. , 15. , 13. , 13. , 15. , 16. , 0. ,
133
- 15. , 13. , 13. , 13. , 13. , 0. , 13. , 13. , 13. , 13. , 13. , 15. , 13. ,
134
- 16. , 13. , 15. , 15. , 18. , 13. , 15. , 15. , 15. , 16. , 15. , 13. , 13. ,
135
- 15. , 13. , 18. , 15. , 13. , 15. , 13. , 15. , 15. , 13.
109
+ 12 , 12 , 12 , 14 , 14 , 12 , 19 , 12 , 14 , 12 , 12 , 14 , 15 , 19 , 14 , 12 , 12 ,
110
+ 12 , 12 , 19 , 12 , 12 , 12 , 12 , 12 , 14 , 12 , 15 , 12 , 14 , 14 , 17 , 12 , 14 ,
111
+ 14 , 14 , 15 , 14 , 12 , 12 , 14 , 12 , 17 , 14 , 12 , 14 , 12 , 14 , 14 , 12
136
112
])
137
113
138
114
self .assertTrue (
0 commit comments