Last active
October 24, 2022 10:59
-
-
Save riven314/92b768299dc27d7b19794ba979cba39e to your computer and use it in GitHub Desktop.
sample run lesson1-pets.ipynb to test M1 mac
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
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) | |
learn = vision_learner(dls, resnet34, metrics=error_rate).to_fp16() | |
learn.fit_one_cycle(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment