Skip to content

Commit 2c2f800

Browse files
authored
Add files via upload
1 parent 4bab079 commit 2c2f800

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

BenchmarkScripts/convert2panoptic.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
from PIL import Image
1717

1818
EVAL_LABELS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28, 33, 34, 36, 39]
19+
EVAL_LABEL_NAMES = ["wall", "floor", "cabinet", "bed", "chair", "sofa", "table", "door", "window", "bookshelf", "picture", "counter", "desk", "curtain", "refrigerator", "shower curtain", "toilet", "sink", "bathtub", "otherfurniture"]
20+
EVAL_LABEL_CATS = ["indoor", "indoor", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "furniture", "appliance", "furniture", "furniture", "appliance", "furniture", "furniture"]
21+
EVAL_LABEL_COLORS = [(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)]
1922

2023
def splitall(path):
2124
allparts = []
@@ -60,6 +63,19 @@ def convert2panoptic(scannetPath, outputFolder=None):
6063
os.mkdir(panopticFolder)
6164
print("Corresponding segmentations in .png format will be saved in {}".format(panopticFolder))
6265

66+
categories = []
67+
for idx in range(len(EVAL_LABELS)):
68+
label = EVAL_LABELS[idx]
69+
name = EVAL_LABEL_NAMES[idx]
70+
cat = EVAL_LABEL_CATS[idx]
71+
color = EVAL_LABEL_COLORS[idx]
72+
isthing = label > 2
73+
categories.append({'id': int(label),
74+
'name': name,
75+
'color': color,
76+
'supercategory': cat,
77+
'isthing': isthing})
78+
6379
images = []
6480
annotations = []
6581
for progress, f in enumerate(files):
@@ -136,7 +152,7 @@ def main():
136152
parser = argparse.ArgumentParser()
137153
parser.add_argument("--dataset-folder",
138154
dest="scannetPath",
139-
help="path to the ScanNet data 'scenes_all' folder",
155+
help="path to the ScanNet data 'scannet_frames_25k' folder",
140156
required=True,
141157
type=str)
142158
parser.add_argument("--output-folder",

0 commit comments

Comments
 (0)