Exemple #1
0
 def __init__(self, batch_size, num_threads, device_id, data_dir, crop):
     super(HybridTrainPipe, self).__init__(batch_size, num_threads,
                                           device_id, data_dir, crop)
     self.pad = ops.Paste(device="gpu",
                          fill_value=0,
                          ratio=1.1,
                          min_canvas_size=crop)
     self.res = ops.RandomResizedCrop(device="gpu",
                                      size=crop,
                                      random_area=[0.9, 1.1],
                                      random_aspect_ratio=1.33333)
     self.cutmix = ops.PythonFunction(function=cut_mixe_image,
                                      num_outputs=2,
                                      device='gpu')
     self.cmnp = ops.CropMirrorNormalize(
         device="gpu",
         output_dtype=types.FLOAT,
         output_layout=types.NCHW,
         image_type=types.RGB,
         mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],
         std=[0.229 * 255, 0.224 * 255, 0.225 * 255])
     self.coin = ops.CoinFlip(probability=0.5)
     self.rotated = ops.Rotate(device="gpu", keep_size=True)
     self.rotated_rng = ops.Uniform(range=(-5.0, 5.0))
     self.brightness = ops.Brightness(device="gpu")
     self.brightness_rng = ops.Uniform(range=(0.8, 1.2))
     self.reshape = ops.Reshape(device="gpu", layout="HWC")
     self.one_hot = ops.OneHot(num_classes=3,
                               dtype=types.INT32,
                               device="cpu")
     self.jitter_rng = ops.CoinFlip(probability=0.3)
     self.jittered = ops.Jitter(device="gpu")
 def __init__(self, num_classes, input, axis=-1, num_threads=1):
     super(OneHotPipeline, self).__init__(batch_size, num_threads, 0)
     sample_dim = len(input[0].shape)
     self.ext_src = ops.ExternalSource(source=[input],
                                       cycle=True,
                                       layout="ABCD"[0:sample_dim])
     self.one_hot = ops.OneHot(num_classes=num_classes,
                               axis=axis,
                               dtype=types.INT32,
                               device="cpu")
Exemple #3
0
 def __init__(self,
              num_classes,
              source,
              axis=-1,
              num_threads=1,
              layout=None,
              axis_name=None):
     super(OneHotPipeline, self).__init__(batch_size, num_threads, 0)
     self.ext_src = ops.ExternalSource(source=source, layout=layout)
     self.one_hot = ops.OneHot(num_classes=num_classes,
                               axis=axis,
                               dtype=types.INT32,
                               device="cpu",
                               axis_name=axis_name)
Exemple #4
0
 def __init__(self, num_classes, input, num_threads=1):
     super(OneHotPipeline, self).__init__(sample_size, num_threads, 0)
     self.ext_src = ops.ExternalSource(source=[input], cycle=True)
     self.one_hot = ops.OneHot(num_classes=num_classes,
                               dtype=types.INT32,
                               device="cpu")