Skip to content

Commit

Permalink
Align indices in nuImages and nuScenes-lidarseg (#440)
Browse files Browse the repository at this point in the history
* Order colormap

* Do not assume any ordering in colormap
  • Loading branch information
whyekit-motional authored Jul 29, 2020
1 parent db6805f commit db5ef4d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions python-sdk/nuscenes/nuscenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def __init__(self,
self.lidarseg_idx2name_mapping[lidarseg_category['index']] = lidarseg_category['name']
self.lidarseg_name2idx_mapping[lidarseg_category['name']] = lidarseg_category['index']

# Sort the colormap to ensure that it is ordered according to the indices in self.category.
self.colormap = dict({c['name']: self.colormap[c['name']]
for c in sorted(self.category, key=lambda k: k['index'])})

# If available, also load the image_annotations table created by export_2d_annotations_as_json().
if osp.exists(osp.join(self.table_root, 'image_annotations.json')):
self.image_annotations = self.__load_table__('image_annotations')
Expand Down
28 changes: 14 additions & 14 deletions python-sdk/nuscenes/utils/color_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@ def get_colormap() -> Dict[str, Iterable[int]]:

classname_to_color = { # RGB.
"noise": [0, 0, 0], # Black.
"animal": [70, 130, 180], # Steelblue
"human.pedestrian.adult": [0, 0, 230], # Blue
"human.pedestrian.child": [135, 206, 235], # Skyblue,
"human.pedestrian.wheelchair": [138, 43, 226], # Blueviolet
"human.pedestrian.stroller": [240, 128, 128], # Lightcoral
"human.pedestrian.construction_worker": [100, 149, 237], # Cornflowerblue
"human.pedestrian.personal_mobility": [219, 112, 147], # Palevioletred
"human.pedestrian.police_officer": [0, 0, 128], # Navy,
"human.pedestrian.construction_worker": [100, 149, 237], # Cornflowerblue
"animal": [70, 130, 180], # Steelblue
"vehicle.car": [255, 158, 0], # Orange
"vehicle.motorcycle": [255, 61, 99], # Red
"human.pedestrian.stroller": [240, 128, 128], # Lightcoral
"human.pedestrian.wheelchair": [138, 43, 226], # Blueviolet
"movable_object.barrier": [112, 128, 144], # Slategrey
"movable_object.debris": [210, 105, 30], # Chocolate
"movable_object.pushable_pullable": [105, 105, 105], # Dimgrey
"movable_object.trafficcone": [47, 79, 79], # Darkslategrey
"static_object.bicycle_rack": [188, 143, 143], # Rosybrown
"vehicle.bicycle": [220, 20, 60], # Crimson
"vehicle.bus.bendy": [255, 127, 80], # Coral
"vehicle.bus.rigid": [255, 69, 0], # Orangered
"vehicle.truck": [255, 99, 71], # Tomato
"vehicle.car": [255, 158, 0], # Orange
"vehicle.construction": [233, 150, 70], # Darksalmon
"vehicle.emergency.ambulance": [255, 83, 0],
"vehicle.emergency.police": [255, 215, 0], # Gold
"vehicle.motorcycle": [255, 61, 99], # Red
"vehicle.trailer": [255, 140, 0], # Darkorange
"movable_object.barrier": [112, 128, 144], # Slategrey
"movable_object.trafficcone": [47, 79, 79], # Darkslategrey
"movable_object.pushable_pullable": [105, 105, 105], # Dimgrey
"movable_object.debris": [210, 105, 30], # Chocolate
"static_object.bicycle_rack": [188, 143, 143], # Rosybrown
"vehicle.truck": [255, 99, 71], # Tomato
"flat.driveable_surface": [0, 207, 191], # nuTonomy green
"flat.other": [175, 0, 75],
"flat.sidewalk": [75, 0, 75],
"flat.terrain": [112, 180, 60],
"flat.other": [175, 0, 75],
"static.manmade": [222, 184, 135], # Burlywood
"static.vegetation": [0, 175, 0], # Green
"static.other": [255, 228, 196], # Bisque
"static.vegetation": [0, 175, 0], # Green
"vehicle.ego": [255, 240, 245]
}

Expand Down

0 comments on commit db5ef4d

Please sign in to comment.