Skip to content

Instantly share code, notes, and snippets.

@Blaizzy
Last active May 3, 2020 17:22
Show Gist options
  • Select an option

  • Save Blaizzy/3ca30dbb7ec0323b77eb646f4d536ae4 to your computer and use it in GitHub Desktop.

Select an option

Save Blaizzy/3ca30dbb7ec0323b77eb646f4d536ae4 to your computer and use it in GitHub Desktop.
scale, bs = 2, 8
# scale, bs = 4, 4
sz_lr = 256
src = ImageImageList.from_folder(path).split_by_rand_pct(0.1, seed = 42)
def get_data(bs, size):
data = (src.label_from_func(lambda x: path/x.name)
.transform(get_transforms(do_flip=True, max_rotate=20),
size=size[0],tfm_y =True)
.transform_y(size = size[1])
.databunch(bs=bs, no_check = True).normalize(imagenet_stats, do_y=True))
return data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment