'Load input image and preprocess for Caffe:
- cast to float
- switch channels RGB -> BGR
- subtract mean
- transpose to channel x height x width order'

def load_image(self, idx):

    im = Image.open('{}/JPEGImages/{}.jpg'.format(self.voc_dir, idx))
    in_ = np.array(im, dtype=np.float32)
    in_ = in_[:, :, ::(-1)]
    in_ -= self.mean
    in_ = in_.transpose((2, 0, 1))
    return in_
