Created
November 14, 2021 12:49
-
-
Save danielcwq/465fc654a5d8fd14cf4c3c7ef8f377f1 to your computer and use it in GitHub Desktop.
First model to differentiate between cats and dogs.
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 * | |
path = untar_data(URLs.PETS)/'images' | |
def is_cat(x): return x[0].isupper() | |
dls = ImageDataLoaders.from_name_func( | |
path, get_image_files(path), valid_pct=0.2, seed=42, | |
label_func=is_cat, item_tfms=Resize(224)) | |
learn = cnn_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