예제 #1
0
 def __init__(self,
              batch_size,
              data,
              shuffle=False,
              stride=1,
              step=-1,
              device_id=0,
              num_shards=1,
              interleave_size=0,
              interleave_mode="shorten",
              dtype=types.FLOAT,
              sequence_length=COUNT):
     super(LabeledVideoPipe, self).__init__(batch_size,
                                            num_threads=2,
                                            device_id=device_id,
                                            seed=12)
     self.input = ops.VideoReader(device="gpu",
                                  filenames=data,
                                  sequence_length=sequence_length,
                                  interleave_size=interleave_size,
                                  interleave_mode=interleave_mode,
                                  labels=[k for k in range(len(data))],
                                  enable_frame_num=True,
                                  shard_id=0,
                                  num_shards=num_shards,
                                  random_shuffle=shuffle,
                                  normalized=True,
                                  image_type=types.YCbCr,
                                  dtype=dtype,
                                  step=step,
                                  stride=stride)
예제 #2
0
    def __init__(self, batch_size, sequence_length, num_threads, device_id, files, \
                 crop_size, random_shuffle=True, step=-1, gray_mode=False):
        super(VideoReaderPipeline, self).__init__(batch_size, num_threads, device_id, seed=12)
        #Define VideoReader, output shape [N, F, H, W, C] (N being the batch size and F the number of frames)
        self.reader = ops.VideoReader(device="gpu", \
                                      filenames=files, \
                                      sequence_length=sequence_length, \
                                      normalized=False, \
                                      random_shuffle=random_shuffle, \
                                      image_type=types.RGB, \
                                      dtype=types.UINT8, \
                                      step=step, \
                                      initial_fill=16)

        # Define crop and permute operations to apply to every sequence	
        self.crop = ops.CropCastPermute(device="gpu", \
                                        crop=crop_size, \
                                        output_layout=types.NCHW, \
                                        output_dtype=types.FLOAT)
        #  crop and permute (from [N,H,W,C] to [N,C,H,W])
        # self.crop = ops.Crop(device="gpu", \
        # 					 crop=crop_size, \
        # 					 output_dtype=types.FLOAT)
        # # permute from [N,F,H,W,C] to [N,F,C,H,W]
        # self.permute = ops.Transpose(device="gpu", perm=[0,1,4,2,3])

        self.uniform = ops.Uniform(range=(0.0, 1.0)) # used for random crop
예제 #3
0
 def __init__(self,
              batch_size,
              data,
              shuffle=False,
              stride=1,
              step=-1,
              device_id=0,
              num_shards=1,
              dtype=types.FLOAT,
              sequence_length=COUNT):
     super(VideoPipe, self).__init__(batch_size,
                                     num_threads=2,
                                     device_id=device_id,
                                     seed=12)
     self.input = ops.VideoReader(device="gpu",
                                  filenames=data,
                                  sequence_length=sequence_length,
                                  shard_id=0,
                                  num_shards=num_shards,
                                  random_shuffle=shuffle,
                                  normalized=True,
                                  image_type=types.YCbCr,
                                  dtype=dtype,
                                  step=step,
                                  stride=stride)
예제 #4
0
 def __init__(self, batch_size, data, device_id=0, sequence_length=COUNT):
     super(VideoPipeList, self).__init__(batch_size,
                                         num_threads=2,
                                         device_id=device_id)
     self.input = ops.VideoReader(device="gpu",
                                  file_list=data,
                                  sequence_length=sequence_length)
예제 #5
0
 def __init__(
     self,
     batch_size: int,
     num_threads: int,
     device_id: int,
     file_list: Path,
     shuffle: bool,
     initial_prefetch_size: int,
     clip_length_in_frames: int,
     seed: int,
 ):
     super().__init__(
         batch_size=batch_size,
         num_threads=num_threads,
         device_id=device_id,
         seed=seed,
     )
     self.input = ops.VideoReader(
         device="gpu",
         shard_id=0,
         num_shards=1,
         file_list=file_list,
         enable_frame_num=True,
         enable_timestamps=True,
         random_shuffle=shuffle,
         initial_fill=initial_prefetch_size,
         sequence_length=clip_length_in_frames,
     )
    def __init__(
        self,
        args,
        file_list,
        batch_size=16,
        num_threads=1,
        device_id=0,
        shuffle=False,
    ):
        """
        Args:
          step: The frame interval between each sequence.
          stride: The distance between consecutive frames in each sequence.
        """
        shard_id = 0
        num_shards = 1

        super(ActivityNetVideoPipe, self).__init__(batch_size,
                                                   num_threads,
                                                   device_id,
                                                   seed=args['seed'])
        print(shuffle, args['dist_videoframes'], args['skip_videoframes'],
              args['num_videoframes'], file_list)
        self.input = ops.VideoReader(
            device="gpu",
            file_list=file_list,
            sequence_length=args['num_videoframes'],
            shard_id=shard_id,
            num_shards=num_shards,
            random_shuffle=shuffle,
            initial_fill=args['initial_prefetch_size'],
            step=args['dist_videoframes'],
            stride=args['skip_videoframes'],
            skip_vfr_check=False)
예제 #7
0
    def __init__(self,
                 batch_size,
                 num_threads=6,
                 device_id=0,
                 file_root='',
                 shuffle=False,
                 sequence_length=30,
                 step=-1,
                 stride=1,
                 initial_fill=1024,
                 seed=0,
                 channels=3):

        super(VideoPipeFileRoot, self).__init__(batch_size,
                                                num_threads,
                                                device_id,
                                                seed=seed)

        self.input = ops.VideoReader(device='gpu',
                                     file_root=file_root,
                                     sequence_length=sequence_length,
                                     step=step,
                                     stride=stride,
                                     shard_id=0,
                                     num_shards=1,
                                     random_shuffle=shuffle,
                                     initial_fill=initial_fill,
                                     channels=channels)

        self.normalize = ops.Normalize(device='gpu')
예제 #8
0
    def __init__(self, batch_size: int, num_threads: int, device_id: int,
                 sequence_length: int, initial_prefetch_size: int, data: List,
                 shuffle: bool):
        """
        :param batch_size: size of dataset batch
        :param num_threads: number of parallel threads
        :param device_id: "gpu" or "cpu"
        :param sequence_length: number of frames
        :param initial_prefetch_size: count of videos readed preliminarily
        :param data: input video paths
        :param shuffle: suffle samples
        """
        super().__init__(batch_size, num_threads, device_id, seed=16)
        self.input = ops.VideoReader(device="gpu",
                                     filenames=data,
                                     sequence_length=sequence_length,
                                     shard_id=0,
                                     num_shards=1,
                                     random_shuffle=shuffle,
                                     initial_fill=initial_prefetch_size)

        self.extract = ops.ElementExtract(device="gpu",
                                          element_map=list(
                                              range(0, FRAMES_PER_VIDEO)))

        self.resize = ops.Resize(device="gpu",
                                 resize_x=config.IMG_SIZE,
                                 resize_y=config.IMG_SIZE)
    def __init__(self, batch_size, sequence_length, num_threads, device_id, file_root, crop_size, transforms=None):
        super(VideoReaderPipeline, self).__init__(batch_size, num_threads, device_id, seed=12)
        self.reader = ops.VideoReader(
            device='gpu',
            file_root=file_root,
            sequence_length=sequence_length,
            normalized=False,
            random_shuffle=True,
            image_type=types.RGB,
            dtype=types.UINT8,
            initial_fill=16
        )

        self.crop = ops.Crop(device="gpu", crop=crop_size, output_dtype=types.FLOAT)
        self.transpose = ops.Transpose(device="gpu", perm=[3, 0, 1, 2])
        self.uniform = ops.Uniform(range=(0.0, 1.0))
        self.flip = ops.Flip(device="gpu", horizontal=1, vertical=0)
        # self.normalize = ops.NormalizePermute(
        #     device="gpu",
        #     mean=[0.485, 0.456, 0.406],
        #     std=[0.229, 0.224, 0.225],
        #     width=224,
        #     height=224
        # )
        self.cmn = ops.CropMirrorNormalize(
             device="gpu",
             output_dtype=types.FLOAT,
        #     # output_layout=types.NCHW,
             crop=(224, 224),
             image_type=types.RGB,
             mean=[0.485, 0.456, 0.406],
             std=[0.229, 0.224, 0.225]
        )
예제 #10
0
 def __init__(self,
              device,
              batch_size,
              num_threads=1,
              device_id=0,
              num_gpus=1,
              is_old_crop=True):
     super(CropSequencePipeline, self).__init__(batch_size, num_threads,
                                                device_id)
     self.device = device
     VIDEO_FILES = [
         test_data_video + '/' + file
         for file in ['sintel_trailer_short.mp4']
     ]
     self.input = ops.VideoReader(device='gpu',
                                  filenames=VIDEO_FILES,
                                  sequence_length=10,
                                  shard_id=0,
                                  num_shards=1,
                                  random_shuffle=False,
                                  normalized=True,
                                  image_type=types.RGB,
                                  dtype=types.UINT8)
     if is_old_crop:
         self.crop = ops.Crop(device=device,
                              crop=(224, 224),
                              crop_pos_x=0.3,
                              crop_pos_y=0.2,
                              image_type=types.RGB)
     else:
         self.crop = ops.NewCrop(device=device,
                                 crop=(224, 224),
                                 crop_pos_x=0.3,
                                 crop_pos_y=0.2,
                                 image_type=types.RGB)
예제 #11
0
 def __init__(self, batch_size, sequence_length, num_threads, device_id,
              file_list, crop_size):
     super(VideoReaderPipeline, self).__init__(batch_size,
                                               num_threads,
                                               device_id,
                                               seed=12)
     self.reader = ops.VideoReader(device="gpu",
                                   file_list=file_list,
                                   sequence_length=sequence_length,
                                   normalized=True,
                                   random_shuffle=True,
                                   image_type=types.RGB,
                                   dtype=types.FLOAT,
                                   initial_fill=16,
                                   enable_frame_num=True,
                                   stride=1,
                                   step=-1)
     self.uniform = ops.Uniform(range=(0.0, 1.0))
     self.coin = ops.CoinFlip(probability=0.5)
     #        self.crop = ops.Crop(device="gpu", crop=crop_size, output_dtype=types.FLOAT)
     #        self.transpose = ops.Transpose(device="gpu", perm=[3, 0, 1, 2])
     self.cropmirrornorm = ops.CropMirrorNormalize(
         device="gpu",
         crop=crop_size,
         output_dtype=types.FLOAT,
         mean=[0.45, 0.45, 0.45],
         std=[0.225, 0.225, 0.225],
         output_layout="CFHW")
예제 #12
0
 def __init__(self, batch_size, num_threads, device_id, data):
     super(VideoPipe, self).__init__(batch_size, num_threads, device_id, seed=12)
     self.input = ops.VideoReader(device="gpu", file_root = data, sequence_length=COUNT,
     # instead of file_root, path to text file with pairs video_filepath label_value can be provided
     # self.input = ops.VideoReader(device="gpu", file_list = "file_list.txt", sequence_length=COUNT,
                                  shard_id=0, num_shards=1, random_shuffle=False,
                                  normalized=True, image_type=types.YCbCr, dtype=types.FLOAT)
예제 #13
0
 def __init__(self, batch_size, data, device_id=0, sequence_length=COUNT):
     super(VideoPipeRoot, self).__init__(batch_size,
                                         num_threads=2,
                                         device_id=device_id)
     self.input = ops.VideoReader(device="gpu",
                                  file_root=data,
                                  sequence_length=sequence_length,
                                  random_shuffle=True)
예제 #14
0
 def __init__(self, batch_size, num_threads, device_id, data, seq_len,
              step):
     super(OFPipeline, self).__init__(batch_size, num_threads, device_id)
     self.input = ops.VideoReader(device="gpu",
                                  file_list=data,
                                  sequence_length=seq_len,
                                  step=step)
     self.of_op = ops.OpticalFlow(device="gpu", output_format=4)
예제 #15
0
 def __init__(self,
              batch_size,
              num_threads,
              device_id,
              file_list,
              sequence_length,
              seg_num,
              seg_length,
              resize_shorter_scale,
              crop_target_size,
              is_training=False,
              initial_prefetch_size=10,
              num_shards=1,
              shard_id=0,
              dali_mean=0.,
              dali_std=1.0):
     super(VideoPipe, self).__init__(batch_size, num_threads, device_id)
     self.input = ops.VideoReader(device="gpu",
                                  file_list=file_list,
                                  sequence_length=sequence_length,
                                  seg_num=seg_num,
                                  seg_length=seg_length,
                                  is_training=is_training,
                                  num_shards=num_shards,
                                  shard_id=shard_id,
                                  random_shuffle=is_training,
                                  initial_fill=initial_prefetch_size)
     # the sequece data read by ops.VideoReader is of shape [F, H, W, C]
     # Because the ops.Resize does not support sequence data,
     # it will be transposed into [H, W, F, C],
     # then reshaped to [H, W, FC], and then resized like a 2-D image.
     self.transpose = ops.Transpose(device="gpu", perm=[1, 2, 0, 3])
     self.reshape = ops.Reshape(device="gpu",
                                rel_shape=[1.0, 1.0, -1],
                                layout='HWC')
     self.resize = ops.Resize(device="gpu",
                              resize_shorter=resize_shorter_scale)
     # crops and mirror are applied by ops.CropMirrorNormalize.
     # Normalization will be implemented in paddle due to the difficulty of dimension broadcast,
     # It is not sure whether dimension broadcast can be implemented correctly by dali, just take the Paddle Op instead.
     self.pos_rng_x = ops.Uniform(range=(0.0, 1.0))
     self.pos_rng_y = ops.Uniform(range=(0.0, 1.0))
     self.mirror_generator = ops.Uniform(range=(0.0, 1.0))
     self.cast_mirror = ops.Cast(dtype=types.DALIDataType.INT32)
     self.crop_mirror_norm = ops.CropMirrorNormalize(
         device="gpu",
         crop=[crop_target_size, crop_target_size],
         mean=dali_mean,
         std=dali_std)
     self.reshape_back = ops.Reshape(device="gpu",
                                     shape=[
                                         seg_num, seg_length * 3,
                                         crop_target_size, crop_target_size
                                     ],
                                     layout='FCHW')
     self.cast_label = ops.Cast(device="gpu",
                                dtype=types.DALIDataType.INT64)
예제 #16
0
 def __init__(self, image_dir, batch_size, num_threads, device_id, num_gpus,
              shuffle, cfg):
     super(VideoPipe, self).__init__(batch_size, num_threads, device_id,
                                     num_gpus, cfg)
     self.input = ops.VideoReader(device="gpu",
                                  file_root=image_dir,
                                  sequence_length=sequence_length,
                                  shard_id=0,
                                  num_shards=1,
                                  random_shuffle=shuffle,
                                  initial_fill=initial_prefetch_size)
예제 #17
0
 def __init__(self, batch_size, num_threads, device_id, data):
     super(VideoPipe, self).__init__(batch_size,
                                     num_threads,
                                     device_id,
                                     seed=120)
     self.input = ops.VideoReader(device="gpu",
                                  filenames=data,
                                  sequence_length=1,
                                  shard_id=0,
                                  num_shards=1,
                                  random_shuffle=False,
                                  initial_fill=10)
    def __init__(self, batch_size, num_threads=6, device_id=0, file_list="", shuffle=False, sequence_length=30, step=-1,
                 stride=1, initial_fill=1024, seed=0):
        # super(VideoPipe, self).__init__(batch_size, num_threads, device_id, seed=seed)
        super(VideoPipe, self).__init__(batch_size, num_threads, device_id, seed=seed)

        # filenames assumes the selection of which files to load has already been made
        # TODO: does it load in order specified?
        # self.input = ops.VideoReader(device="gpu", filenames=filenames,
        self.input = ops.VideoReader(device="gpu", file_list=file_list,
                                     sequence_length=sequence_length, step=step, stride=stride,
                                     shard_id=0, num_shards=1,
                                     random_shuffle=shuffle, initial_fill=initial_fill)
예제 #19
0
 def __init__(self, batch_size, num_threads, device_id, data):
     super(VideoPipe, self).__init__(batch_size,
                                     num_threads,
                                     device_id,
                                     seed=12)
     self.input = ops.VideoReader(device="gpu",
                                  filenames=data,
                                  sequence_length=COUNT,
                                  shard_id=0,
                                  num_shards=1,
                                  random_shuffle=False,
                                  normalized=True,
                                  image_type=types.YCbCr)
예제 #20
0
 def __init__(self, batch_size, sequence_length, num_threads, device_id,
              files):
     super(VideoReaderPipeline, self).__init__(batch_size,
                                               num_threads,
                                               device_id,
                                               seed=12)
     self.reader = ops.VideoReader(device="gpu",
                                   filenames=files,
                                   sequence_length=sequence_length,
                                   normalized=False,
                                   image_type=types.RGB,
                                   dtype=types.UINT8)
     self.transpose = ops.Transpose(device="gpu", perm=[0, 3, 1, 2])
예제 #21
0
 def __init__(self, video_files, sequence_length=8, target_size=224,
              stride=30):
     super(VideoPipe, self).__init__(1, 4, 0, seed=42)
     self.input = ops.VideoReader(
         device="gpu", filenames=video_files,
         sequence_length=sequence_length, stride=stride,
         shard_id=0, num_shards=1, random_shuffle=False, pad_last_batch=True)
     self.cmnp = ops.CropMirrorNormalize(
         device="gpu",
         dtype=types.FLOAT,
         output_layout=types.NFCHW,
         crop=(target_size, target_size),
         mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],
         std=[0.229 * 255, 0.224 * 255, 0.225 * 255])
예제 #22
0
    def __init__(self, batch_size, sequence_length, num_threads, files, gt_files, \
        crop_size, random_shuffle=True, step=-1, device_id=-1, seed=12):
        super(VideoReaderPipeline, self).__init__(batch_size,
                                                  num_threads,
                                                  device_id,
                                                  seed=seed)
        #Define VideoReader
        self.reader = ops.VideoReader(device="gpu", \
                filenames=files, \
                sequence_length=sequence_length, \
                normalized=False, \
                random_shuffle=random_shuffle, \
                image_type=types.RGB, \
                dtype=types.UINT8, \
                step=step, \
                initial_fill=16,
                seed=seed)


        self.gt_reader = ops.VideoReader(device="gpu", \
                filenames=gt_files, \
                sequence_length=sequence_length, \
                normalized=False, \
                random_shuffle=random_shuffle, \
                image_type=types.RGB, \
                dtype=types.UINT8, \
                step=step, \
                initial_fill=16,
                seed=seed)

        # Define crop and permute operations to apply to every sequence
        self.crop = ops.Crop(device="gpu", \
                crop=[crop_size, crop_size], \
                output_dtype=types.FLOAT)
        self.uniform = ops.Uniform(range=(0.0, 1.0))  # used for random crop
        self.transpose = ops.Transpose(device="gpu", perm=[3, 0, 1, 2])
예제 #23
0
 def __init__(self,
              batch_size,
              data,
              device_id=0,
              sequence_length=COUNT,
              step=-1,
              stride=1):
     super(VideoPipeList, self).__init__(batch_size,
                                         num_threads=2,
                                         device_id=device_id)
     self.input = ops.VideoReader(device="gpu",
                                  file_list=data,
                                  sequence_length=sequence_length,
                                  step=step,
                                  stride=stride,
                                  file_list_frame_num=True)
예제 #24
0
 def __init__(self, batch_size, sequence_length, num_threads, device_id,
              files, crop_size):
     super(VideoReaderPipeline, self).__init__(batch_size,
                                               num_threads,
                                               device_id,
                                               seed=12)
     self.reader = ops.VideoReader(device="gpu",
                                   filenames=files,
                                   sequence_length=sequence_length,
                                   normalized=False,
                                   random_shuffle=True,
                                   image_type=types.RGB,
                                   dtype=types.UINT8,
                                   initial_fill=16)
     # self.crop = ops.Crop(device="gpu", crop=crop_size, output_dtype=types.FLOAT)
     self.uniform = ops.Uniform(range=(0.0, 1.0))
     self.transpose = ops.Transpose(device="gpu", perm=[3, 0, 1, 2])
예제 #25
0
	def __init__(self, batch_size, sequence_length, num_threads, device_id, files,
				 crop_size, random_shuffle=True, step=-1):
		super(VideoReaderPipeline, self).__init__(batch_size, num_threads, device_id, seed=12)
		# Define VideoReader
		self.reader = ops.VideoReader(device="gpu",
										filenames=files,
										sequence_length=sequence_length,
										normalized=False,
										random_shuffle=random_shuffle,
										image_type=types.DALIImageType.RGB,
										dtype=types.DALIDataType.UINT8,
										step=step,
										initial_fill=16)

		# Define crop and permute operations to apply to every sequence
		self.crop = ops.CropMirrorNormalize(device="gpu",
										crop_w=crop_size,
										crop_h=crop_size,
										output_layout='FCHW',
										dtype=types.DALIDataType.FLOAT)
		self.uniform = ops.Uniform(range=(0.0, 1.0))  # used for random crop
예제 #26
0
 def __init__(
     self,
     file_names: List[str],
     batch_size: int,
     num_workers: int,
     device_id: int,
     sequence_length: int,
     seed: int = -1,
     stride: int = 1,
     read_ahead: bool = False,
     shuffle: bool = False,
 ):
     super().__init__(batch_size, num_workers, device_id, seed)
     self.input = ops.VideoReader(device='gpu',
                                  sequence_length=sequence_length,
                                  enable_frame_num=True,
                                  filenames=file_names,
                                  labels=[],
                                  shard_id=0,
                                  num_shards=1,
                                  random_shuffle=shuffle,
                                  read_ahead=read_ahead,
                                  stride=stride)
예제 #27
0
    def __init__(self, batch_size, sequence_length, num_threads, device_id, files, \
        crop_size, random_shuffle=True, step=-1):
        super(VideoReaderPipeline, self).__init__(batch_size,
                                                  num_threads,
                                                  device_id,
                                                  seed=12)
        #Define VideoReader
        self.reader = ops.VideoReader(device="gpu", \
                filenames=files, \
                sequence_length=sequence_length, \
                normalized=False, \
                random_shuffle=random_shuffle, \
                image_type=types.RGB, \
                dtype=types.UINT8, \
                step=step, \
                initial_fill=16)

        # Define crop and permute operations to apply to every sequence
        self.crop = ops.CropCastPermute(device="gpu", \
                crop=crop_size, \
                output_layout=types.NCHW, \
                output_dtype=types.FLOAT)
        self.uniform = ops.Uniform(range=(0.0, 1.0))  # used for random crop
예제 #28
0
    def __init__(self,
                 file_list,
                 batch_size,
                 sequence_length,
                 num_threads,
                 device_id,
                 crop_size,
                 step=-1,
                 stride=1,
                 random_shuffle=True):
        super(VideoReaderPipeline, self).__init__(batch_size,
                                                  num_threads,
                                                  device_id,
                                                  seed=12)

        # Define VideoReader
        self.reader = ops.VideoReader(device="gpu",
                                      file_list=file_list,
                                      sequence_length=sequence_length,
                                      normalized=False,
                                      random_shuffle=random_shuffle,
                                      image_type=types.RGB,
                                      dtype=types.UINT8,
                                      step=step,
                                      stride=stride,
                                      initial_fill=16)

        # Define crop, mirror and normalisation operations to apply to every sequence
        self.crop = ops.Crop(device="gpu",
                             crop=crop_size,
                             output_dtype=types.FLOAT)

        self.transpose = ops.Transpose(device="gpu", perm=[0, 3, 1,
                                                           2])  # [N F C H W]

        self.uniform = ops.Uniform(range=(0.2, 1.0))  # used for random crop
예제 #29
0
 def __init__(self, batch_size, num_threads, device_id, data):
     super(VideoPipe, self).__init__(batch_size, num_threads, device_id, seed=12)
     self.input = ops.VideoReader(device="gpu", filenames=data, count=COUNT,
                                  shard_id=0, num_shards=1, random_shuffle=False)
예제 #30
0
    def __init__(self,
                 directory,
                 supervised: bool = True,
                 sequence_length: int = 11,
                 batch_size: int = 1,
                 num_workers: int = 1,
                 gpu_id: int = 0,
                 shuffle: bool = True,
                 crop_size: tuple = (256, 256),
                 resize: tuple = None,
                 brightness: float = 0.25,
                 contrast: float = 0.1,
                 mean: list = [0.5, 0.5, 0.5],
                 std: list = [0.5, 0.5, 0.5],
                 conv_mode='3d',
                 image_shape=(256, 256),
                 validate: bool = False):
        super().__init__(batch_size,
                         num_workers,
                         gpu_id,
                         prefetch_queue_depth=1)
        self.input = ops.VideoReader(additional_decode_surfaces=1,
                                     channels=3,
                                     device="gpu",
                                     dtype=types.FLOAT,
                                     enable_frame_num=False,
                                     enable_timestamps=False,
                                     file_root=directory,
                                     image_type=types.RGB,
                                     initial_fill=1,
                                     lazy_init=False,
                                     normalized=True,
                                     num_shards=1,
                                     pad_last_batch=False,
                                     prefetch_queue_depth=1,
                                     random_shuffle=shuffle,
                                     sequence_length=sequence_length,
                                     skip_vfr_check=True,
                                     step=-1,
                                     shard_id=0,
                                     stick_to_shard=False,
                                     stride=1)

        self.uniform = ops.Uniform(range=(0.0, 1.0))
        self.cmn = ops.CropMirrorNormalize(device='gpu',
                                           crop=crop_size,
                                           mean=mean,
                                           std=std,
                                           output_layout=types.NFHWC)

        self.coin = ops.CoinFlip(probability=0.5)
        self.brightness_val = ops.Uniform(
            range=[1 - brightness, 1 + brightness])
        self.contrast_val = ops.Uniform(range=[1 - contrast, 1 + contrast])
        self.supervised = supervised
        self.half = ops.Constant(fdata=0.5)
        self.zero = ops.Constant(idata=0)
        self.cast_to_long = ops.Cast(device='gpu', dtype=types.INT64)
        if crop_size is not None:
            H, W = crop_size
        else:
            # default
            H, W = image_shape
        # print('CONV MODE!!! {}'.format(conv_mode))
        if conv_mode == '3d':
            self.transpose = ops.Transpose(device="gpu", perm=[3, 0, 1, 2])
            self.reshape = None
        elif conv_mode == '2d':
            self.transpose = ops.Transpose(device='gpu', perm=[0, 3, 1, 2])
            self.reshape = ops.Reshape(device='gpu', shape=[-1, H, W])
        self.validate = validate