aug_transforms: Augmentation

Description Usage Arguments Value Examples

View source: R/image_ops.R

Description

Utility func to easily create a list of flip, rotate, zoom, warp, lighting transforms.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
aug_transforms(
  mult = 1,
  do_flip = TRUE,
  flip_vert = FALSE,
  max_rotate = 10,
  min_zoom = 1,
  max_zoom = 1.1,
  max_lighting = 0.2,
  max_warp = 0.2,
  p_affine = 0.75,
  p_lighting = 0.75,
  xtra_tfms = NULL,
  size = NULL,
  mode = "bilinear",
  pad_mode = "reflection",
  align_corners = TRUE,
  batch = FALSE,
  min_scale = 1
)

Arguments

mult

ratio

do_flip

to do flip

flip_vert

flip vertical or not

max_rotate

maximum rotation

min_zoom

minimum zoom

max_zoom

maximum zoom

max_lighting

maximum lighting

max_warp

maximum warp

p_affine

probability affine

p_lighting

probability lighting

xtra_tfms

extra transformations

size

size of image

mode

mode

pad_mode

padding mode

align_corners

align_corners

batch

batch size

min_scale

minimum scale

Value

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 

URLs_PETS()

path = 'oxford-iiit-pet'

path_img = 'oxford-iiit-pet/images'
fnames = get_image_files(path_img)

dls = ImageDataLoaders_from_name_re(
path, fnames, pat='(.+)_.jpg$',
item_tfms=Resize(size = 460), bs = 10,
batch_tfms=list(aug_transforms(size = 224, min_scale = 0.75),
                Normalize_from_stats( imagenet_stats() )
)
)


## End(Not run)

fastai documentation built on July 28, 2021, 5:06 p.m.