Ejemplo n.º 1
0
def save_annotation_indexed(label,
                    save_dir,
                    filename,
                    colormap_type=get_dataset_colormap.get_pascal_name()):
  # Add colormap for visualizing the prediction.
  colormap = get_dataset_colormap.create_label_colormap(colormap_type)
  # add color black as unlabeled
  colormap = np.vstack((colormap, [0, 0, 0]))
  colormap = colormap.flatten().tolist()
  pil_image = img.fromarray(label.astype(dtype=np.uint8))
  pil_image.putpalette(colormap)
  with tf.gfile.Open('%s/%s.png' % (save_dir, filename), mode='w') as f:
    pil_image.save(f, 'PNG')
Ejemplo n.º 2
0
 def testGetColormapForUnsupportedDataset(self):
     with self.assertRaises(ValueError):
         get_dataset_colormap.create_label_colormap('unsupported_dataset')
 def testGetColormapForUnsupportedDataset(self):
   with self.assertRaises(ValueError):
     get_dataset_colormap.create_label_colormap('unsupported_dataset')