Esempio n. 1
0
 def image_decoder_crop_pipe(max_batch_size, input_data, device):
     pipe = Pipeline(batch_size=max_batch_size, num_threads=4, device_id=0)
     encoded = fn.external_source(source=input_data,
                                  cycle=False,
                                  device='cpu')
     decoded = fn.image_decoder_crop(encoded, device=device)
     pipe.set_outputs(decoded)
     return pipe
Esempio n. 2
0
def test_image_decoder_crop_device():
    pipe = Pipeline(batch_size=batch_size, num_threads=4, device_id=None)
    input, _ = fn.file_reader(file_root=images_dir, shard_id=0, num_shards=1)
    decoded = fn.image_decoder_crop(input,
                                    output_type=types.RGB,
                                    crop=(10, 10))
    pipe.set_outputs(decoded)
    pipe.build()
    for _ in range(3):
        pipe.run()