def caffe_load_image(filename, color=True, as_uint=False):
 with WithTimer('imread', quiet=True):
  if as_uint:
   img = skimage.io.imread(filename)
  else:
   img = skimage.img_as_float(skimage.io.imread(filename)).astype(np.float32)
 if (img.ndim == 2):
  img = img[:, :, np.newaxis]
  if color:
   img = np.tile(img, (1, 1, 3))
 elif (img.shape[2] == 4):
  img = img[:, :, :3]
 return img

def caffe_load_image ( filename , color = True , as_uint = False ) : with WithTimer ( 'imread' , quiet = True ) : if as_uint : img = skimage . io . imread ( filename ) else : img = skimage . img_as_float ( skimage . io . imread ( filename ) ) . astype ( np . float32 ) if ( img . ndim == 2 ) : img = img [ : , : , np . newaxis ] if color : img = np . tile ( img , ( 1 , 1 , 3 ) ) elif ( img . shape [ 2 ] == 4 ) : img = img [ : , : , : 3 ] return img
copied from caffe to simplify potential import problems .