improved to load RGB image as grayscale image
authortishibas67 <t_ishibas67@yahoo.co.jp>
Tue, 17 Mar 2015 15:11:01 +0000 (00:11 +0900)
committertishibas67 <t_ishibas67@yahoo.co.jp>
Tue, 17 Mar 2015 15:11:01 +0000 (00:11 +0900)
python/caffe/io.py

index 6ae2cf1..acd8a14 100644 (file)
@@ -285,7 +285,7 @@ def load_image(filename, color=True):
         of size (H x W x 3) in RGB or
         of size (H x W x 1) in grayscale.
     """
-    img = skimage.img_as_float(skimage.io.imread(filename)).astype(np.float32)
+    img = skimage.img_as_float(skimage.io.imread(filename, as_grey=not color)).astype(np.float32)
     if img.ndim == 2:
         img = img[:, :, np.newaxis]
         if color: