Esempio n. 1
0
class C2Pipe(Pipeline):
    def __init__(self,
                 batch_size,
                 num_threads,
                 device_id,
                 pipelined=True,
                 async=True):
        super(C2Pipe, self).__init__(batch_size,
                                     num_threads,
                                     device_id,
                                     exec_pipelined=pipelined,
                                     exec_async=async)
        self.input = ops.ExternalSource()
        self.decode = ops.HostDecoder(output_type=types.RGB)
        self.rcm = ops.FastResizeCropMirror(crop=[224, 224])
        self.np = ops.NormalizePermute(device="gpu",
                                       output_dtype=types.FLOAT16,
                                       mean=[128., 128., 128.],
                                       std=[1., 1., 1.],
                                       height=224,
                                       width=224,
                                       image_type=types.RGB)
        self.uniform = ops.Uniform(range=(0., 1.))
        self.resize_uniform = ops.Uniform(range=(256., 480.))
        self.mirror = ops.CoinFlip(probability=0.5)
        self.iter = 0
Esempio n. 2
0
 def __init__(self, batch_size, num_threads, device_id, pipelined = True, exec_async = True):
     super(C2Pipe, self).__init__(batch_size,
                                  num_threads,
                                  device_id,
                                  exec_pipelined=pipelined,
                                  exec_async=exec_async)
     self.input = ops.ExternalSource()
     self.decode = ops.ImageDecoder(device = 'cpu', output_type = types.RGB)
     self.rcm = ops.FastResizeCropMirror(crop = (224, 224))
     self.np = ops.CropMirrorNormalize(device = "gpu",
                                       dtype = types.FLOAT16,
                                       mean = [128., 128., 128.],
                                       std = [1., 1., 1.])
     self.uniform = ops.Uniform(range = (0., 1.))
     self.resize_uniform = ops.Uniform(range = (256., 480.))
     self.mirror = ops.CoinFlip(probability = 0.5)