Ejemplo n.º 1
0
Archivo: loader.py Proyecto: zmbhou/UVC
    def __init__(self,
                 video_path,
                 list_path,
                 patch_size,
                 rotate=10,
                 scale=1.2,
                 is_train=True,
                 moreaug=True):
        super(VidListv1, self).__init__()
        self.data_dir = video_path
        self.list_path = list_path
        normalize = transforms.Normalize(mean=(128, 128, 128),
                                         std=(128, 128, 128))

        t = []
        if rotate > 0:
            t.append(transforms.RandomRotate(rotate))
        if scale > 0:
            t.append(transforms.RandomScale(scale))
        t.extend([
            transforms.RandomCrop(patch_size, seperate=moreaug),
            transforms.RandomHorizontalFlip(),
            transforms.ToTensor(), normalize
        ])

        self.transforms = transforms.Compose(t)

        self.is_train = is_train
        self.read_list()
Ejemplo n.º 2
0
    def __init__(self,
                 video_path,
                 list_path,
                 patch_size,
                 rotate=10,
                 scale=1.2,
                 is_train=True,
                 moreaug=True):
        super(VidListv1, self).__init__()
        csv_path = "/raid/codes/CorrFlows/functional/feeder/dataset/oxuva.csv"
        filenames = open(csv_path).readlines()
        frame_all = [filename.split(',')[0].strip() for filename in filenames]
        nframes = [
            int(filename.split(',')[1].strip()) for filename in filenames
        ]
        self.data_dir = video_path
        self.list = frame_all
        self.nframes = nframes
        normalize = transforms.Normalize(mean=(128, 128, 128),
                                         std=(128, 128, 128))

        t = []
        if rotate > 0:
            t.append(transforms.RandomRotate(rotate))
        if scale > 0:
            t.append(transforms.RandomScale(scale))
        t.extend([
            transforms.RandomCrop(patch_size, seperate=moreaug),
            transforms.RandomHorizontalFlip(),
            transforms.ToTensor(), normalize
        ])

        self.transforms = transforms.Compose(t)

        self.is_train = is_train
Ejemplo n.º 3
0
    def __init__(self,
                 video_path,
                 list_path,
                 patch_size,
                 rotate=10,
                 scale=1.2,
                 is_train=True,
                 moreaug=True):
        super(VidListv1, self).__init__()
        csv_path = "/raid/codes/UVC/libs/GOT-new.csv"
        filenames = open(csv_path).readlines()
        frame_all = [filename.split(',')[0].strip() for filename in filenames]
        nframes = [
            int(filename.split(',')[1].strip()) for filename in filenames
        ]
        self.data_dir = video_path
        self.list = frame_all
        self.nframes = nframes
        normalize = transforms.Normalize(mean=(128, 128, 128),
                                         std=(128, 128, 128))

        t = []
        if rotate > 0:
            t.append(transforms.RandomRotate(rotate))
        if scale > 0:
            t.append(transforms.RandomScale(scale))
        t.extend([
            transforms.RandomCrop(patch_size, seperate=moreaug),
            transforms.RandomHorizontalFlip(),
            transforms.ToTensor(), normalize
        ])

        self.transforms = transforms.Compose(t)

        self.is_train = is_train
        self.video_list = []
        for filename in filenames:
            record = VideoRecord()
            record.path = os.path.join(video_path,
                                       filename.split(',')[0].strip())
            record.num_frames = int(filename.split(',')[1].strip(
            ))  # len(glob.glob(os.path.join(video_path, '*.jpg')))
            record.label = filename.split(',')[0].strip()
            self.video_list.append(record)