Skip to content

Commit d0982c4

Browse files
Load Pascal palette from file
1 parent 4c29eec commit d0982c4

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

demos/segmentation_demo/python/segmentation_demo.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,14 @@
3939

4040

4141
class SegmentationVisualizer:
42-
pascal_voc_palette = [
43-
(0, 0, 0),
44-
(128, 0, 0),
45-
(0, 128, 0),
46-
(128, 128, 0),
47-
(0, 0, 128),
48-
(128, 0, 128),
49-
(0, 128, 128),
50-
(128, 128, 128),
51-
(64, 0, 0),
52-
(192, 0, 0),
53-
(64, 128, 0),
54-
(192, 128, 0),
55-
(64, 0, 128),
56-
(192, 0, 128),
57-
(64, 128, 128),
58-
(192, 128, 128),
59-
(0, 64, 0),
60-
(128, 64, 0),
61-
(0, 192, 0),
62-
(128, 192, 0),
63-
(0, 64, 128)
64-
]
65-
6642
def __init__(self, colors_path=None):
6743
if colors_path:
6844
self.color_palette = self.get_palette_from_file(colors_path)
6945
log.debug('The palette is loaded from {}'.format(colors_path))
7046
else:
71-
self.color_palette = self.pascal_voc_palette
47+
pascal_palette_path = Path(__file__).resolve().parents[3] /\
48+
'data/palettes/pascal_voc_21cl_colors.txt'
49+
self.color_palette = self.get_palette_from_file(pascal_palette_path)
7250
log.debug('The PASCAL VOC palette is used')
7351
log.debug('Get {} colors'.format(len(self.color_palette)))
7452
self.color_map = self.create_color_map()

0 commit comments

Comments
 (0)