Esempio n. 1
0
def valid_generator(ds, shape_aug=None, input_aug=None, label_aug=None, batch_size=16, nr_procs=1):
    ### augment both the input and label
    ds = ds if shape_aug is None else AugmentImageComponents(ds, shape_aug, (0, 1), copy=True)
    ### augment just the input
    ds = ds if input_aug is None else AugmentImageComponent(ds, input_aug, index=0, copy=False)
    ### augment just the output
    ds = ds if label_aug is None else AugmentImageComponent(ds, label_aug, index=1, copy=True)
    #
    ds = BatchData(ds, batch_size, remainder=True)
    ds = CacheData(ds) # cache all inference images 
    return ds
Esempio n. 2
0
def valid_generator_class(ds, shape_aug=None, input_aug=None,
                          batch_size=16, nr_procs=1):
    ### augment the input
    ds = ds if shape_aug is None else AugmentImageComponent(
        ds, shape_aug, index=0, copy=True)
    ### augment the input
    ds = ds if input_aug is None else AugmentImageComponent(
        ds, input_aug, index=0, copy=False)
    #
    ds = BatchData(ds, batch_size, remainder=True)
    ds = CacheData(ds)  # cache all inference images
    return ds