code: def load_image(self, idx):
          
          im = Image.open('{}/data/images/img_{}.png'.format(self.nyud_dir, idx))
          in_ = np.array(im, dtype=np.float32)
          in_ = in_[:,:,::-1]
          in_ -= self.mean_bgr
          in_ = in_.transpose((2,0,1))
          return in_
docs: Load input image and preprocess for Caffe:
          - cast to float
          - switch channels RGB -> BGR
          - subtract mean
          - transpose to channel x height x width order