示例#1
0
    def __init__(self,
                 args,
                 images_root_2015=None,
                 images_root_2012=None,
                 photometric_augmentations=False,
                 preprocessing_crop=True):

        self._args = args
        self.preprocessing_crop = preprocessing_crop

        list_of_indices_2012 = []
        list_of_indices_2015 = []

        # ----------------------------------------------------------
        # KITTI 2015
        # ----------------------------------------------------------
        if images_root_2015 is not None:

            if not os.path.isdir(images_root_2015):
                raise ValueError("Image directory '%s' not found!")

            all_img1_2015_filenames = sorted(
                glob(os.path.join(images_root_2015, "*_10.png")))
            all_img2_2015_filenames = sorted(
                glob(os.path.join(images_root_2015, "*_11.png")))
            assert len(all_img1_2015_filenames) != 0
            assert len(all_img2_2015_filenames) == len(all_img1_2015_filenames)
            list_of_indices_2015 = range(len(all_img1_2015_filenames))

        # ----------------------------------------------------------
        # KITTI 2012
        # ----------------------------------------------------------
        if images_root_2012 is not None:

            if not os.path.isdir(images_root_2012):
                raise ValueError("Image directory '%s' not found!")

            all_img1_2012_filenames = sorted(
                glob(os.path.join(images_root_2012, "*_10.png")))
            all_img2_2012_filenames = sorted(
                glob(os.path.join(images_root_2012, "*_11.png")))
            assert len(all_img1_2012_filenames) != 0
            assert len(all_img2_2012_filenames) == len(all_img1_2012_filenames)
            list_of_indices_2012 = range(len(all_img1_2012_filenames))

        # ----------------------------------------------------------
        # Save list of actual filenames for inputs and flows
        # ----------------------------------------------------------
        self._image_list = []
        self._flow_list = []

        for ii in list_of_indices_2015:

            im1 = all_img1_2015_filenames[ii]
            im2 = all_img2_2015_filenames[ii]
            idx1 = os.path.splitext(os.path.basename(im1))[0][:-3]
            idx2 = os.path.splitext(os.path.basename(im2))[0][:-3]
            assert idx1 == idx2

            if not os.path.isfile(im1) or not os.path.isfile(im2):
                continue

            self._image_list += [[im1, im2]]

        for ii in list_of_indices_2012:

            im1 = all_img1_2012_filenames[ii]
            im2 = all_img2_2012_filenames[ii]
            idx1 = os.path.splitext(os.path.basename(im1))[0][:-3]
            idx2 = os.path.splitext(os.path.basename(im2))[0][:-3]
            assert idx1 == idx2

            if not os.path.isfile(im1) or not os.path.isfile(im2):
                continue

            self._image_list += [[im1, im2]]

        self._size = len(self._image_list)

        assert len(self._image_list) != 0

        # ----------------------------------------------------------
        # photometric_augmentations
        # ----------------------------------------------------------
        if photometric_augmentations:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> PIL
                    vision_transforms.ToPILImage(),
                    # PIL -> PIL : random hsv and contrast
                    vision_transforms.ColorJitter(
                        brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5),
                    # PIL -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                    transforms.RandomGamma(
                        min_gamma=0.7, max_gamma=1.5, clip_image=True),
                ],
                from_numpy=True,
                to_numpy=False)

        else:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                ],
                from_numpy=True,
                to_numpy=False)
示例#2
0
    def __init__(self,
                 args,
                 images_root_2015=None,
                 flow_root_2015=None,
                 images_root_2012=None,
                 flow_root_2012=None,
                 photometric_augmentations=False,
                 preprocessing_crop=True,
                 dstype="full"):

        self._args = args
        self.preprocessing_crop = preprocessing_crop

        list_of_indices_2012 = []
        list_of_indices_2015 = []

        # ----------------------------------------------------------
        # KITTI 2015
        # ----------------------------------------------------------
        if images_root_2015 is not None and flow_root_2015 is not None:

            if not os.path.isdir(images_root_2015):
                raise ValueError("Image directory '%s' not found!")
            if not os.path.isdir(flow_root_2015):
                raise ValueError("Flow directory '%s' not found!")

            all_img1_2015_filenames = sorted(
                glob(os.path.join(images_root_2015, "*_10.png")))
            all_img2_2015_filenames = sorted(
                glob(os.path.join(images_root_2015, "*_11.png")))
            flow_f_2015_filenames = sorted(
                glob(os.path.join(flow_root_2015, "*_10.png")))
            assert len(all_img1_2015_filenames) != 0
            assert len(all_img2_2015_filenames) == len(all_img1_2015_filenames)
            assert len(flow_f_2015_filenames) == len(all_img1_2015_filenames)
            num_flows_2015 = len(flow_f_2015_filenames)
            validate_indices_2015 = [
                x for x in VALIDATE_INDICES_2015 if x in range(num_flows_2015)
            ]

            if dstype == "train":
                list_of_indices_2015 = [
                    x for x in range(num_flows_2015)
                    if x not in validate_indices_2015
                ]
            elif dstype == "valid":
                list_of_indices_2015 = validate_indices_2015
            elif dstype == "full":
                list_of_indices_2015 = range(len(all_img1_2015_filenames))
            else:
                raise ValueError("KITTI 2015: dstype '%s' unknown!", dstype)
            print("Found {} images for KITTI15 {}".format(
                len(list_of_indices_2015), dstype))

        # ----------------------------------------------------------
        # KITTI 2012
        # ----------------------------------------------------------
        if images_root_2012 is not None:

            if not os.path.isdir(images_root_2012):
                raise ValueError("Image directory '%s' not found!")
            if not os.path.isdir(flow_root_2012):
                raise ValueError("Flow directory '%s' not found!")

            all_img1_2012_filenames = sorted(
                glob(os.path.join(images_root_2012, "*_10.png")))
            all_img2_2012_filenames = sorted(
                glob(os.path.join(images_root_2012, "*_11.png")))
            flow_f_2012_filenames = sorted(
                glob(os.path.join(flow_root_2012, "*_10.png")))
            assert len(all_img1_2012_filenames) != 0
            assert len(all_img2_2012_filenames) == len(all_img1_2012_filenames)
            assert len(flow_f_2012_filenames) == len(all_img1_2012_filenames)
            num_flows_2012 = len(flow_f_2012_filenames)
            validate_indices_2012 = [
                x for x in VALIDATE_INDICES_2012 if x in range(num_flows_2012)
            ]

            if dstype == "train":
                list_of_indices_2012 = [
                    x for x in range(num_flows_2012)
                    if x not in validate_indices_2012
                ]
            elif dstype == "valid":
                list_of_indices_2012 = validate_indices_2012
            elif dstype == "full":
                list_of_indices_2012 = range(len(all_img1_2012_filenames))
            else:
                raise ValueError("KITTI 2012: dstype '%s' unknown!", dstype)
            print("Found {} images for KITTI12 {}".format(
                len(list_of_indices_2012), dstype))

        # ----------------------------------------------------------
        # Save list of actual filenames for inputs and flows
        # ----------------------------------------------------------
        self._image_list = []
        self._flow_list = []

        for ii in list_of_indices_2015:

            im1 = all_img1_2015_filenames[ii]
            im2 = all_img2_2015_filenames[ii]
            idx1 = os.path.splitext(os.path.basename(im1))[0][:-3]
            idx2 = os.path.splitext(os.path.basename(im2))[0][:-3]
            assert idx1 == idx2

            if not os.path.isfile(im1) or not os.path.isfile(im2):
                continue

            self._image_list += [[im1, im2]]

            if dstype is not "test":
                flo_f = flow_f_2015_filenames[ii]
                idx_f = os.path.splitext(os.path.basename(flo_f))[0][:-3]
                assert idx1 == idx_f
                if not os.path.isfile(flo_f):
                    continue
                self._flow_list += [[flo_f]]

        for ii in list_of_indices_2012:

            im1 = all_img1_2012_filenames[ii]
            im2 = all_img2_2012_filenames[ii]
            idx1 = os.path.splitext(os.path.basename(im1))[0][:-3]
            idx2 = os.path.splitext(os.path.basename(im2))[0][:-3]
            assert idx1 == idx2

            if not os.path.isfile(im1) or not os.path.isfile(im2):
                continue

            self._image_list += [[im1, im2]]

            if dstype is not "test":
                flo_f = flow_f_2012_filenames[ii]
                idx_f = os.path.splitext(os.path.basename(flo_f))[0][:-3]
                assert idx1 == idx_f
                if not os.path.isfile(flo_f):
                    continue
                self._flow_list += [[flo_f]]

        self._size = len(self._image_list)

        assert len(self._image_list) != 0
        if dstype is not "test":
            assert len(self._image_list) == len(self._flow_list)

        # ----------------------------------------------------------
        # photometric_augmentations
        # ----------------------------------------------------------
        if photometric_augmentations:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> PIL
                    vision_transforms.ToPILImage(),
                    # PIL -> PIL : random hsv and contrast
                    vision_transforms.ColorJitter(
                        brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5),
                    # PIL -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                    transforms.RandomGamma(
                        min_gamma=0.7, max_gamma=1.5, clip_image=True),
                ],
                from_numpy=True,
                to_numpy=False)

        else:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                ],
                from_numpy=True,
                to_numpy=False)
示例#3
0
    def __init__(self,
                 args,
                 images_root,
                 flow_root,
                 occ_root,
                 photometric_augmentations=False):

        self._args = args
        if not os.path.isdir(images_root):
            raise ValueError("Image directory '%s' not found!")
        if flow_root is not None and not os.path.isdir(flow_root):
            raise ValueError("Flow directory '%s' not found!")
        if occ_root is not None and not os.path.isdir(occ_root):
            raise ValueError("Occ directory '%s' not found!")

        if flow_root is not None:
            flow_f_filenames = sorted(
                glob(os.path.join(flow_root, "into_future/*.flo")))
            flow_b_filenames = sorted(
                glob(os.path.join(flow_root, "into_past/*.flo")))

        if occ_root is not None:
            occ1_filenames = sorted(
                glob(os.path.join(occ_root, "into_future/*.png")))
            occ2_filenames = sorted(
                glob(os.path.join(occ_root, "into_past/*.png")))

        all_img_filenames = sorted(glob(os.path.join(images_root, "*.png")))

        self._image_list = []
        self._flow_list = [] if flow_root is not None else None
        self._occ_list = [] if occ_root is not None else None

        assert len(all_img_filenames) != 0
        assert len(flow_f_filenames) != 0
        assert len(flow_b_filenames) != 0
        assert len(occ1_filenames) != 0
        assert len(occ2_filenames) != 0

        ## path definition
        path_flow_f = os.path.join(flow_root, "into_future")
        path_flow_b = os.path.join(flow_root, "into_past")
        path_occ_f = os.path.join(occ_root, "into_future")
        path_occ_b = os.path.join(occ_root, "into_past")

        # ----------------------------------------------------------
        # Save list of actual filenames for inputs and flows
        # ----------------------------------------------------------

        for ii in range(0, len(flow_f_filenames)):

            flo_f = flow_f_filenames[ii]

            idx_f = os.path.splitext(os.path.basename(flo_f))[0]
            idx_b = str(int(idx_f) + 1).zfill(7)

            flo_b = os.path.join(path_flow_b, idx_b + ".flo")

            im1 = os.path.join(images_root, idx_f + ".png")
            im2 = os.path.join(images_root, idx_b + ".png")
            occ1 = os.path.join(path_occ_f, idx_f + ".png")
            occ2 = os.path.join(path_occ_b, idx_b + ".png")

            if not os.path.isfile(flo_f) or not os.path.isfile(
                    flo_b) or not os.path.isfile(im1) or not os.path.isfile(
                        im2) or not os.path.isfile(occ1) or not os.path.isfile(
                            occ2):
                continue

            self._image_list += [[im1, im2]]
            self._flow_list += [[flo_f, flo_b]]
            self._occ_list += [[occ1, occ2]]

        self._size = len(self._image_list)

        assert len(self._image_list) == len(self._flow_list)
        assert len(self._occ_list) == len(self._flow_list)
        assert len(self._image_list) != 0

        # ----------------------------------------------------------
        # photometric_augmentations
        # ----------------------------------------------------------
        if photometric_augmentations:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> PIL
                    vision_transforms.ToPILImage(),
                    # PIL -> PIL : random hsv and contrast
                    vision_transforms.ColorJitter(
                        brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5),
                    # PIL -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                    transforms.RandomGamma(
                        min_gamma=0.7, max_gamma=1.5, clip_image=True),
                ],
                from_numpy=True,
                to_numpy=False)

        else:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                ],
                from_numpy=True,
                to_numpy=False)
示例#4
0
    def __init__(self,
                 args,
                 root,
                 photometric_augmentations=False,
                 dstype="train"):

        self._args = args

        # -------------------------------------------------------------
        # filenames for all input images and target flows
        # -------------------------------------------------------------
        image1_filenames = sorted(glob(os.path.join(root, "*_img1.png")))
        image2_filenames = sorted(glob(os.path.join(root, "*_img2.png")))
        occ1_filenames = sorted(glob(os.path.join(root, "*_occ1.png")))
        occ2_filenames = sorted(glob(os.path.join(root, "*_occ2.png")))
        flow_f_filenames = sorted(glob(os.path.join(root, "*_flow.flo")))
        flow_b_filenames = sorted(glob(os.path.join(root, "*_flow_b.flo")))
        assert (len(image1_filenames) == len(image2_filenames))
        assert (len(image2_filenames) == len(occ1_filenames))
        assert (len(occ1_filenames) == len(occ2_filenames))
        assert (len(occ2_filenames) == len(flow_f_filenames))
        assert (len(flow_f_filenames) == len(flow_b_filenames))

        num_flows = len(flow_f_filenames)

        # -------------------------------------------------------------
        # Remove invalid validation indices
        # -------------------------------------------------------------
        validate_indices = [
            x for x in VALIDATE_INDICES if x in range(num_flows)
        ]

        # ----------------------------------------------------------
        # Construct list of indices for training/validation
        # ----------------------------------------------------------
        list_of_indices = None
        if dstype == "train":
            list_of_indices = [
                x for x in range(num_flows) if x not in validate_indices
            ]
        elif dstype == "valid":
            list_of_indices = validate_indices
        elif dstype == "full":
            list_of_indices = range(num_flows)
        else:
            raise ValueError("FlyingChairs: dstype '%s' unknown!", dstype)

        # ----------------------------------------------------------
        # Save list of actual filenames for inputs and flows
        # ----------------------------------------------------------
        self._image_list = []
        self._flow_list = []
        self._occ_list = []
        for i in list_of_indices:
            flo_f = flow_f_filenames[i]
            flo_b = flow_b_filenames[i]
            im1 = image1_filenames[i]
            im2 = image2_filenames[i]
            occ1 = occ1_filenames[i]
            occ2 = occ2_filenames[i]
            self._image_list += [[im1, im2]]
            self._flow_list += [[flo_f, flo_b]]
            self._occ_list += [[occ1, occ2]]
        self._size = len(self._image_list)
        assert len(self._image_list) == len(self._flow_list)
        assert len(self._occ_list) == len(self._flow_list)

        # ----------------------------------------------------------
        # photometric_augmentations
        # ----------------------------------------------------------
        if photometric_augmentations:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> PIL
                    vision_transforms.ToPILImage(),
                    # PIL -> PIL : random hsv and contrast
                    vision_transforms.ColorJitter(
                        brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5),
                    # PIL -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                    transforms.RandomGamma(
                        min_gamma=0.7, max_gamma=1.5, clip_image=True),
                ],
                from_numpy=True,
                to_numpy=False)

        else:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                ],
                from_numpy=True,
                to_numpy=False)
示例#5
0
    def __init__(self,
                 args,
                 dir_root=None,
                 photometric_augmentations=False,
                 imgtype=None,
                 dstype=None):

        self._args = args
        self.show_aug = hasattr(args, 'show_aug') and args.show_aug
        images_root = os.path.join(dir_root, imgtype)
        if imgtype is "comb":
            images_root = os.path.join(dir_root, "clean")
        flow_root = os.path.join(dir_root, "flow")
        occ_root = os.path.join(dir_root, "occlusions")

        if not os.path.isdir(images_root):
            raise ValueError("Image directory '%s' not found!" % images_root)
        if flow_root is not None and not os.path.isdir(flow_root):
            raise ValueError("Flow directory '%s' not found!" % flow_root)
        if occ_root is not None and not os.path.isdir(occ_root):
            raise ValueError("Occ directory '%s' not found!" % occ_root)

        all_flo_filenames = sorted(glob(os.path.join(flow_root, "*/*.flo")))
        all_occ_filenames = sorted(glob(os.path.join(occ_root, "*/*.png")))
        all_img_filenames = sorted(glob(os.path.join(images_root, "*/*.png")))

        # Remember base for substraction at runtime
        # e.g. subtract_base = "/home/user/.../MPI-Sintel-Complete/training/clean"
        self._substract_base = tools.cd_dotdot(images_root)

        # ------------------------------------------------------------------------
        # Get unique basenames
        # ------------------------------------------------------------------------
        # e.g. base_folders = [alley_1", "alley_2", "ambush_2", ...]
        substract_full_base = tools.cd_dotdot(all_img_filenames[0])
        base_folders = sorted(
            list(
                set([
                    os.path.dirname(fn.replace(substract_full_base, ""))[1:]
                    for fn in all_img_filenames
                ])))

        self._image_list = []
        self._flow_list = []
        self._occ_list = []

        for base_folder in base_folders:
            scene = os.path.basename(base_folder)
            img_filenames = [x for x in all_img_filenames if scene in x]
            flo_filenames = [x for x in all_flo_filenames if scene in x]
            occ_filenames = [x for x in all_occ_filenames if scene in x]

            for i in range(len(img_filenames) - 1):

                im1 = img_filenames[i]
                im2 = img_filenames[i + 1]
                flo = flo_filenames[i]
                occ = occ_filenames[i]

                self._image_list += [[im1, im2]]
                self._flow_list += [flo]
                self._occ_list += [occ]

                # Sanity check
                im1_base_filename = os.path.splitext(os.path.basename(im1))[0]
                im2_base_filename = os.path.splitext(os.path.basename(im2))[0]
                flo_base_filename = os.path.splitext(os.path.basename(flo))[0]
                occ_base_filename = os.path.splitext(os.path.basename(occ))[0]
                im1_frame, im1_no = im1_base_filename.split("_")
                im2_frame, im2_no = im2_base_filename.split("_")
                assert (im1_frame == im2_frame)
                assert (int(im1_no) == int(im2_no) - 1)

                flo_frame, flo_no = flo_base_filename.split("_")
                assert (im1_frame == flo_frame)
                assert (int(im1_no) == int(flo_no))

                occ_frame, occ_no = occ_base_filename.split("_")
                assert (im1_frame == occ_frame)
                assert (int(im1_no) == int(occ_no))

        assert len(self._image_list) == len(self._flow_list)
        assert len(self._image_list) == len(self._occ_list)

        # -------------------------------------------------------------
        # Remove invalid validation indices
        # -------------------------------------------------------------
        full_num_examples = len(self._image_list)
        validate_indices = [
            x for x in VALIDATE_INDICES if x in range(full_num_examples)
        ]

        # ----------------------------------------------------------
        # Construct list of indices for training/validation
        # ----------------------------------------------------------
        list_of_indices = None
        if dstype == "train":
            list_of_indices = [
                x for x in range(full_num_examples)
                if x not in validate_indices
            ]
        elif dstype == "valid":
            list_of_indices = validate_indices
        elif dstype == "full":
            list_of_indices = range(full_num_examples)
        else:
            raise ValueError("dstype '%s' unknown!", dstype)

        # ----------------------------------------------------------
        # Save list of actual filenames for inputs and flows
        # ----------------------------------------------------------
        self._image_list = [self._image_list[i] for i in list_of_indices]
        self._flow_list = [self._flow_list[i] for i in list_of_indices]
        self._occ_list = [self._occ_list[i] for i in list_of_indices]

        if imgtype is "comb":
            image_list_final = [[
                val[0].replace("clean", "final"),
                val[1].replace("clean", "final")
            ] for idx, val in enumerate(self._image_list)]
            self._image_list += image_list_final
            self._flow_list += self._flow_list
            self._occ_list += self._occ_list

        assert len(self._image_list) == len(self._flow_list)
        assert len(self._image_list) == len(self._occ_list)

        # ----------------------------------------------------------
        # photometric_augmentations
        # ----------------------------------------------------------
        if photometric_augmentations:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> PIL
                    vision_transforms.ToPILImage(),
                    # PIL -> PIL : random hsv and contrast
                    vision_transforms.ColorJitter(
                        brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5),
                    # PIL -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                    transforms.RandomGamma(
                        min_gamma=0.7, max_gamma=1.5, clip_image=True),
                ],
                from_numpy=True,
                to_numpy=False)

        else:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                ],
                from_numpy=True,
                to_numpy=False)

        self._size = len(self._image_list)
示例#6
0
    def __init__(self,
                 args,
                 dir_root=None,
                 photometric_augmentations=False,
                 imgtype=None):

        self._args = args
        images_root = os.path.join(dir_root, imgtype)
        if not os.path.isdir(images_root):
            raise ValueError("Image directory '%s' not found!")

        all_img_filenames = sorted(glob(os.path.join(images_root, "*/*.png")))

        # Remember base for substraction at runtime
        # e.g. subtract_base = "/home/user/.../MPI-Sintel-Complete/training/clean"
        self._substract_base = tools.cd_dotdot(images_root)

        # ------------------------------------------------------------------------
        # Get unique basenames
        # ------------------------------------------------------------------------
        # e.g. base_folders = [alley_1", "alley_2", "ambush_2", ...]
        substract_full_base = tools.cd_dotdot(all_img_filenames[0])
        base_folders = sorted(
            list(
                set([
                    os.path.dirname(fn.replace(substract_full_base, ""))[1:]
                    for fn in all_img_filenames
                ])))

        self._image_list = []

        for base_folder in base_folders:
            img_filenames = [x for x in all_img_filenames if base_folder in x]

            for i in range(len(img_filenames) - 1):

                im1 = img_filenames[i]
                im2 = img_filenames[i + 1]
                self._image_list += [[im1, im2]]

                # Sanity check
                im1_base_filename = os.path.splitext(os.path.basename(im1))[0]
                im2_base_filename = os.path.splitext(os.path.basename(im2))[0]
                im1_frame, im1_no = im1_base_filename.split("_")
                im2_frame, im2_no = im2_base_filename.split("_")
                assert (im1_frame == im2_frame)
                assert (int(im1_no) == int(im2_no) - 1)

        full_num_examples = len(self._image_list)
        list_of_indices = range(full_num_examples)

        # ----------------------------------------------------------
        # Save list of actual filenames for inputs and flows
        # ----------------------------------------------------------
        self._image_list = [self._image_list[i] for i in list_of_indices]

        # ----------------------------------------------------------
        # photometric_augmentations
        # ----------------------------------------------------------
        if photometric_augmentations:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> PIL
                    vision_transforms.ToPILImage(),
                    # PIL -> PIL : random hsv and contrast
                    vision_transforms.ColorJitter(
                        brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5),
                    # PIL -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                    transforms.RandomGamma(
                        min_gamma=0.7, max_gamma=1.5, clip_image=True),
                ],
                from_numpy=True,
                to_numpy=False)

        else:
            self._photometric_transform = transforms.ConcatTransformSplitChainer(
                [
                    # uint8 -> FloatTensor
                    vision_transforms.transforms.ToTensor(),
                ],
                from_numpy=True,
                to_numpy=False)

        self._size = len(self._image_list)