Create aap.py
Browse files
aap.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
path = untar_data(URLs.PETS)/'images'
|
3 |
+
def is_cat(x): return x[0].isupper()
|
4 |
+
dls = ImageDataLoaders.from_name_func('.',
|
5 |
+
get_image_files(path), valid_pct=0.2, seed=42,
|
6 |
+
label_func=is_cat,
|
7 |
+
item_tfms=Resize(192))
|
8 |
+
learn = vision_learner(dls, resnet18, metrics=error_rate)
|
9 |
+
learn.fine_tune(3)
|
10 |
+
learn.export('model.pkl')
|