Esempio n. 1
0
def get_pipeline(batch_size, tile, ratio, angle):
  pipe = Pipeline(batch_size, 4, None)
  with pipe:
    input, _ = fn.readers.file(file_root=img_dir)
    decoded = fn.image_decoder(input, device='cpu', output_type=types.RGB)
    grided = fn.grid_mask(decoded, device='cpu', tile=tile, ratio=ratio, angle=angle)
    pipe.set_outputs(grided, decoded)
  return pipe
Esempio n. 2
0
def get_random_pipeline(batch_size):
  pipe = Pipeline(batch_size, 4, None)
  with pipe:
    input, _ = fn.readers.file(file_root=img_dir)
    decoded = fn.image_decoder(input, device='cpu', output_type=types.RGB)
    tile = fn.cast(fn.uniform(range=(50, 200), shape=[1]), dtype=types.INT32)
    ratio = fn.uniform(range=(0.3, 0.7), shape=[1])
    angle = fn.uniform(range=(-math.pi, math.pi), shape=[1])
    grided = fn.grid_mask(decoded, device='cpu', tile=tile, ratio=ratio, angle=angle)
    pipe.set_outputs(grided, decoded, tile, ratio, angle)
  return pipe
Esempio n. 3
0
def get_pipeline(device, batch_size, tile, ratio, angle):
    pipe = Pipeline(batch_size, 4, 0)
    with pipe:
        input, _ = fn.readers.file(file_root=img_dir)
        decoded = fn.decoders.image(input, device='cpu', output_type=types.RGB)
        decoded = decoded.gpu() if device == 'gpu' else decoded
        grided = fn.grid_mask(decoded,
                              device=device,
                              tile=tile,
                              ratio=ratio,
                              angle=angle)
        pipe.set_outputs(grided, decoded)
    return pipe
Esempio n. 4
0
def get_random_pipeline(device, batch_size):
    pipe = Pipeline(batch_size, 4, 0)
    with pipe:
        input, _ = fn.readers.file(file_root=img_dir)
        decoded = fn.decoders.image(input, device='cpu', output_type=types.RGB)
        decoded = decoded.gpu() if device == 'gpu' else decoded
        tile = fn.cast(fn.uniform(range=(50, 200)), dtype=types.INT32)
        ratio = fn.uniform(range=(0.3, 0.7))
        angle = fn.uniform(range=(-math.pi, math.pi))
        grided = fn.grid_mask(decoded,
                              device=device,
                              tile=tile,
                              ratio=ratio,
                              angle=angle)
        pipe.set_outputs(grided, decoded, tile, ratio, angle)
    return pipe