Skip to content

Instantly share code, notes, and snippets.

@melonkernel
Last active October 21, 2022 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melonkernel/f41940c4c408a91336054c5c2eb8c399 to your computer and use it in GitHub Desktop.
Save melonkernel/f41940c4c408a91336054c5c2eb8c399 to your computer and use it in GitHub Desktop.
Debugging fastai on m1
from fastai.vision.all import *
from nbdev.showdoc import *
set_seed(2)
bs = 64
path = untar_data(URLs.PETS);
Path.BASE_PATH = path # display all paths relative to dataset root
path_anno = path/'annotations'
path_img = path/'images'
fnames = get_image_files(path_img)
dls = ImageDataLoaders.from_name_re(
path, fnames, pat=r'(.+)_\d+.jpg$', item_tfms=Resize(460), bs=bs,
batch_tfms=[*aug_transforms(size=224, min_scale=0.75), Normalize.from_stats(*imagenet_stats)])
print(dls.vocab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment