Skip to content

Instantly share code, notes, and snippets.

@neelriyer
Created July 5, 2020 10:03
Show Gist options
  • Save neelriyer/63269a53fe148da101f1a13d23de451a to your computer and use it in GitHub Desktop.
Save neelriyer/63269a53fe148da101f1a13d23de451a to your computer and use it in GitHub Desktop.
Get Databunch for video restoration
bs,size=64,128
# bs,size=8,480
arch = models.resnet34
src = ImageImageList.from_folder(path_lr).split_by_rand_pct(0.1, seed=42)
tfms = get_transforms(do_flip=True, flip_vert=True, max_zoom = 1.1, max_lighting=0.2, max_rotate = 10)
def get_data(bs,size=None):
if(size is None):
data = (src.label_from_func(lambda x: path_hr/x.name)
.transform(tfms, tfm_y=True)
.databunch(bs=bs).normalize(imagenet_stats, do_y=True))
else:
data = (src.label_from_func(lambda x: path_hr/x.name)
.transform(tfms,size=size, tfm_y=True)
.databunch(bs=bs).normalize(imagenet_stats, do_y=True))
data.c = 3
return data
data = get_data(bs,size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment