def convert_back(raw_im, image_mean=None, idx=0):
 raw_im = np.copy(raw_im)
 if (image_mean is not None):
  raw_im += image_mean[idx, :, 8:120, 29:141].squeeze()
 raw_im = raw_im[::(-1), :, :]
 im = np.array(np.swapaxes(np.swapaxes(raw_im, 1, 0), 2, 1), np.uint8)
 return im

def convert_back ( raw_im , image_mean = None , idx = 0 ) : raw_im = np . copy ( raw_im ) if ( image_mean is not None ) : raw_im += image_mean [ idx , : , 8 : 120 , 29 : 141 ] . squeeze ( ) raw_im = raw_im [ : : ( - 1 ) , : , : ] im = np . array ( np . swapaxes ( np . swapaxes ( raw_im , 1 , 0 ) , 2 , 1 ) , np . uint8 ) return im
converts a caffe format image back to the standard format .