generation/data/pickle_dataset.py [119:146]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        return input_dict

    def __len__(self):
        return len(self.pickle_file) // self.opt.batchSize * self.opt.batchSize

    def name(self):
        return 'AlignedDataset'

    def crop_person(self, img, bbox):
        # Image crop
        return img.crop((int(bbox[0]), int(bbox[1]), int(bbox[2]), int(bbox[3]))) # left, upper, right, lower

    def remove_background(self, img, label):
        img = np.array(img)
        mask = np.array(label)
        img[mask==0] = 0
        return Image.fromarray(img)

    def pil_rgb2lab(self, img):
        img = np.array(img)
        lab_img = cv2.cvtColor(img,cv2.COLOR_RGB2LAB)
        return Image.fromarray(lab_img)

    def pil_lab2rgb(self, img):
        img = np.array(img)
        print('lab2rgb', np.max(img[:,:,0]), np.max(img[:,:,1]), np.max(img[:,:,2]))
        rgb_img = cv2.cvtColor(img,cv2.COLOR_LAB2RGB)
        return Image.fromarray(rgb_img)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



separate_vae/data/pickle_dataset.py [46:73]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        return input_dict

    def __len__(self):
        return len(self.pickle_file) // self.opt.batchSize * self.opt.batchSize

    def name(self):
        return 'AlignedDataset'

    def crop_person(self, img, bbox):
        # Image crop
        return img.crop((int(bbox[0]), int(bbox[1]), int(bbox[2]), int(bbox[3]))) # left, upper, right, lower

    def remove_background(self, img, label):
        img = np.array(img)
        mask = np.array(label)
        img[mask==0] = 0
        return Image.fromarray(img)

    def pil_rgb2lab(self, img):
        img = np.array(img)
        lab_img = cv2.cvtColor(img,cv2.COLOR_RGB2LAB)
        return Image.fromarray(lab_img)

    def pil_lab2rgb(self, img):
        img = np.array(img)
        print('lab2rgb', np.max(img[:,:,0]), np.max(img[:,:,1]), np.max(img[:,:,2]))
        rgb_img = cv2.cvtColor(img,cv2.COLOR_LAB2RGB)
        return Image.fromarray(rgb_img)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



