MCPcopy Create free account
hub / github.com/IRMVLab/SemGauss-SLAM / decode_segmap

Function decode_segmap

utils/eval_utils.py:552–592  ·  view source on GitHub ↗
(image, nc=25)

Source from the content-addressed store, hash-verified

550 plt.close()
551
552def decode_segmap(image, nc=25):
553 #viz the semantic result
554
555 label_colors = np.array([(0, 0, 0), # 0=background
556 (174, 199, 232), (152, 223, 138), (31, 119, 180), (255, 187, 120), (188, 189, 34),
557 (140, 86, 75), (255, 152, 150), (214, 39, 40), (197, 176, 213), (148, 103, 189),
558 (196, 156, 148), (23, 190, 207), (178, 76, 76), (247, 182, 210), (66, 188, 102),
559 (219, 219, 141), (140, 57, 197), (202, 185, 52), (51, 176, 203), (200, 54, 131),
560 (92, 193, 61), (78, 71, 183), (172, 114, 82), (255, 127, 14), (91, 163, 138),
561 (153, 98, 156), (140, 153, 101), (158, 218, 229), (100, 125, 154), (178, 127, 135),
562 (120, 185, 128), (146, 111, 194), (44, 160, 44), (112, 128, 144), (96, 207, 209),
563 (227, 119, 194), (213, 92, 176), (94, 106, 211), (82, 84, 163), (100, 85, 144),
564 (100, 218, 200),
565 (255, 179, 0), (144, 238, 144), (135, 206, 235), (255, 105, 180), (106, 90, 205),
566 (255, 165, 0), (72, 209, 204), (199, 21, 133), (70, 130, 180), (255, 99, 71),
567 (147, 112, 219), (60, 179, 113), (220, 20, 60)
568 ])
569 """
570
571 label_colors = np.array([(0, 0, 0), # 0=background
572 (174, 199, 232), (152, 223, 138), (31, 119, 180), (255, 187, 120), (188, 189, 34),
573 (140, 86, 75), (255, 152, 150), (214, 39, 40), (197, 176, 213), (148, 103, 189),
574 (196, 156, 148), (23, 190, 207), (178, 76, 76), (247, 182, 210), (66, 188, 102),
575 (219, 219, 141), (140, 57, 197), (202, 185, 52), (51, 176, 203), (200, 54, 131),
576 (92, 193, 61), (78, 71, 183), (172, 114, 82), (255, 127, 14), (91, 163, 138),
577 (153, 98, 156), (140, 153, 101), (158, 218, 229), (100, 125, 154), (178, 127, 135),
578 (120, 185, 128), (146, 111, 194), (44, 160, 44), (112, 128, 144), (96, 207, 209),
579 (227, 119, 194), (213, 92, 176), (94, 106, 211), (82, 84, 163), (100, 85, 144),
580 (100, 218, 200)])
581 """
582 r = np.zeros_like(image).astype(np.uint8)
583 g = np.zeros_like(image).astype(np.uint8)
584 b = np.zeros_like(image).astype(np.uint8)
585
586 for l in range(0, nc):
587 idx = image == l
588 r[idx] = label_colors[l, 0]
589 g[idx] = label_colors[l, 1]
590 b[idx] = label_colors[l, 2]
591 rgb = np.stack([r, g, b], axis=2)
592 return rgb.astype(np.float32) / 255.0

Callers 2

get_lossFunction · 0.90
evalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected