Download s3d_preprocess/sem_seg_utils.py from Egrt/HEAT: direct link, hf CLI and curl.
- Browser
- Download file 2.42 kB
-
https://huggingface.co/spaces/Egrt/HEAT/resolve/main/s3d_preprocess/sem_seg_utils.py
- Command line
-
hf download hf://spaces/Egrt/HEAT/s3d_preprocess/sem_seg_utils.py
-
curl -L -o sem_seg_utils.py https://huggingface.co/spaces/Egrt/HEAT/resolve/main/s3d_preprocess/sem_seg_utils.py
2.42 kB
| import numpy as np | |
| wall_type = 1 | |
| floor_type = 2 | |
| ceil_type = 22 | |
| SCANNET_COLORMAP = [ | |
| [0., 0., 0.], | |
| [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.], | |
| [66., 188., 102.], | |
| [219., 219., 141.], | |
| [140., 57., 197.], | |
| [202., 185., 52.], | |
| [51., 176., 203.], | |
| [200., 54., 131.], | |
| [92., 193., 61.], | |
| [78., 71., 183.], | |
| [172., 114., 82.], | |
| [255., 127., 14.], | |
| [91., 163., 138.], | |
| [153., 98., 156.], | |
| [140., 153., 101.], | |
| [158., 218., 229.], | |
| [100., 125., 154.], | |
| [178., 127., 135.], | |
| [146., 111., 194.], | |
| [44., 160., 44.], | |
| [112., 128., 144.], | |
| [96., 207., 209.], | |
| [227., 119., 194.], | |
| [213., 92., 176.], | |
| [94., 106., 211.], | |
| [82., 84., 163.], | |
| [100., 85., 144.]] | |
| SCANNET_COLORMAP = np.asarray(SCANNET_COLORMAP) / 255. | |
| class_names = [] | |
| class_name_to_id = {} | |
| for i, line in enumerate(open("label_names.txt").readlines()): | |
| class_id = i # starts with -1 | |
| class_name = line.strip() | |
| class_name_to_id[class_name] = class_id | |
| class_names.append(class_name) | |
| class_names = tuple(class_names) | |
| # color palette for nyu40 labels | |
| def create_color_palette(): | |
| return [ | |
| (0, 0, 0), | |
| (174, 199, 232), # wall | |
| (152, 223, 138), # floor | |
| (31, 119, 180), # cabinet | |
| (255, 187, 120), # bed | |
| (188, 189, 34), # chair | |
| (140, 86, 75), # sofa | |
| (255, 152, 150), # table | |
| (214, 39, 40), # door | |
| (197, 176, 213), # window | |
| (148, 103, 189), # bookshelf | |
| (196, 156, 148), # picture | |
| (23, 190, 207), # counter | |
| (178, 76, 76), | |
| (247, 182, 210), # desk | |
| (66, 188, 102), | |
| (219, 219, 141), # curtain | |
| (140, 57, 197), | |
| (202, 185, 52), | |
| (51, 176, 203), | |
| (200, 54, 131), | |
| (92, 193, 61), | |
| (78, 71, 183), | |
| (172, 114, 82), | |
| (255, 127, 14), # refrigerator | |
| (91, 163, 138), | |
| (153, 98, 156), | |
| (140, 153, 101), | |
| (158, 218, 229), # shower curtain | |
| (100, 125, 154), | |
| (178, 127, 135), | |
| (120, 185, 128), | |
| (146, 111, 194), | |
| (44, 160, 44), # toilet | |
| (112, 128, 144), # sink | |
| (96, 207, 209), | |
| (227, 119, 194), # bathtub | |
| (213, 92, 176), | |
| (94, 106, 211), | |
| (82, 84, 163), # otherfurn | |
| (100, 85, 144) | |
| ] |