Last active
March 11, 2020 09:44
-
-
Save gurucharanmk/a114173573cdc08d112cb581355d7721 to your computer and use it in GitHub Desktop.
Code snippet for medium article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_x = lambda x:CELEBA_PATH/f'{x[0]}' | |
get_y = lambda x:[headers[index+1] for index,val in enumerate(x[1:]) if val == 1] | |
batch_tfms = [*aug_transforms(size=224, max_warp=0), Normalize.from_stats(*imagenet_stats)] | |
item_tfms = RandomResizedCrop(460, min_scale=0.75, ratio=(1.,1.)) | |
bs=64 | |
celleba_data = DataBlock(blocks=(ImageBlock, MultiCategoryBlock), | |
get_x=get_x, | |
splitter=RandomSplitter(), | |
get_y=get_y, | |
item_tfms=item_tfms, | |
batch_tfms=batch_tfms) | |
dls = celleba_data.dataloaders(df, bs=bs) | |
dls.show_batch(max_n=9, figsize=(20,9)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment