Эх сурвалжийг харах

Raise ValueError in lblsave for labels that cannot be saved

Kentaro Wada 6 жил өмнө
parent
commit
8c259ee329
1 өөрчлөгдсөн 3 нэмэгдсэн , 4 устгасан
  1. 3 4
      labelme/utils/_io.py

+ 3 - 4
labelme/utils/_io.py

@@ -3,7 +3,6 @@ import os.path as osp
 import numpy as np
 import PIL.Image
 
-from labelme.logger import logger
 from labelme.utils.draw import label_colormap
 
 
@@ -18,7 +17,7 @@ def lblsave(filename, lbl):
         lbl_pil.putpalette((colormap * 255).astype(np.uint8).flatten())
         lbl_pil.save(filename)
     else:
-        logger.warn(
-            '[%s] Cannot save the pixel-wise class label as PNG, '
-            'so please use the npy file.' % filename
+        raise ValueError(
+            '[%s] Cannot save the pixel-wise class label as PNG. '
+            'Please consider using the .npy format.' % filename
         )