Skip to content

Instantly share code, notes, and snippets.

@Ben-Karr
Created September 25, 2022 14:48
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 Ben-Karr/b1ec618308ccf9f8af67c2e416f0958f to your computer and use it in GitHub Desktop.
Save Ben-Karr/b1ec618308ccf9f8af67c2e416f0958f to your computer and use it in GitHub Desktop.
Fastai minimal Quick-Start-Code: Vision
from fastai.vision.all import *
path = untar_data(URLs.PETS)
files = get_image_files(path/"images")
def label_func(f): return f[0].isupper()
dls = ImageDataLoaders.from_name_func(path, files, label_func, item_tfms=Resize(224))
learn = vision_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment