def test_can_write_and_parse_dataset_meta_file(self): src_label_map = VOC.make_voc_label_map() src_label_map['qq'] = [None, ['part1', 'part2'], ['act1', 'act2']] src_label_map['ww'] = [(10, 20, 30), [], ['act3']] with TestDir() as test_dir: VOC.write_meta_file(test_dir, src_label_map) dst_label_map = VOC.parse_meta_file(test_dir) self.assertEqual(src_label_map, dst_label_map)
def test_can_write_and_parse_labelmap(self): src_label_map = VOC.make_voc_label_map() src_label_map['qq'] = [None, ['part1', 'part2'], ['act1', 'act2']] with TestDir() as test_dir: file_path = osp.join(test_dir, 'test.txt') VOC.write_label_map(file_path, src_label_map) dst_label_map = VOC.parse_label_map(file_path) self.assertEqual(src_label_map, dst_label_map)
def categories(self): label_map = VOC.make_voc_label_map() label_map['non_voc_label'] = [None, [], []] for label_desc in label_map.values(): label_desc[0] = None # rebuild colormap return VOC.make_voc_categories(label_map)