From f21c8246368841d7edd9906287013e07cbdd9fed Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Mon, 8 Jun 2020 17:19:47 +0300 Subject: [PATCH] fix expression --- datumaro/datumaro/plugins/voc_format/extractor.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/datumaro/datumaro/plugins/voc_format/extractor.py b/datumaro/datumaro/plugins/voc_format/extractor.py index b8709ff60fcd..a14682958d3b 100644 --- a/datumaro/datumaro/plugins/voc_format/extractor.py +++ b/datumaro/datumaro/plugins/voc_format/extractor.py @@ -32,12 +32,15 @@ def __init__(self, path): super().__init__(subset=osp.splitext(osp.basename(path))[0]) self._categories = self._load_categories(self._dataset_dir) - log.debug("Loaded labels: %s", - ', '.join("'%s' (%s, %s, %s)" % \ - (l.name, *self._categories[AnnotationType.mask].colormap[idx]) - for idx, l in enumerate( - self._categories[AnnotationType.label].items)) - ) + + label_color = lambda label_idx: \ + self._categories[AnnotationType.mask].colormap.get(label_idx, None) + log.debug("Loaded labels: %s" % ', '.join( + "'%s' %s" % (l.name, ('(%s, %s, %s)' % c) if c else '') + for i, l, c in ((i, l, label_color(i)) for i, l in enumerate( + self._categories[AnnotationType.label].items + )) + )) self._items = self._load_subset_list(path) def categories(self):