Skip to content

Commit

Permalink
initial planet nb
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Sep 11, 2017
1 parent 2ae29b3 commit 53a416d
Show file tree
Hide file tree
Showing 6 changed files with 1,032 additions and 2,051 deletions.
490 changes: 324 additions & 166 deletions courses/dl1/lesson1.ipynb

Large diffs are not rendered by default.

682 changes: 682 additions & 0 deletions courses/dl1/lesson2-image_models.ipynb

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions courses/dl1/planet.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from imports import *
from fast_gen import *
from dataset_pt import *
from fastai.imports import *
from fastai.transforms import *
from fastai.dataset import *
from sklearn.metrics import fbeta_score
import warnings

def f2(preds, targs, start=0.17, end=0.24, step=0.01):
return max([fbeta_score(targs, (preds>th), 2, average='samples')
for th in np.arange(start,end,step)])
with warnings.catch_warnings():
warnings.simplefilter("ignore")
return max([fbeta_score(targs, (preds>th), 2, average='samples')
for th in np.arange(start,end,step)])

def opt_th(preds, targs, start=0.17, end=0.24, step=0.01):
ths = np.arange(start,end,step)
Expand All @@ -17,7 +20,7 @@ def get_data(path, tfms,bs, n, cv_idx):
val_idxs = get_cv_idxs(n, cv_idx)
return ImageClassifierData.from_csv(path, 'train-jpg', f'{path}train_v2.csv', bs, tfms,
suffix='.jpg', val_idxs=val_idxs, test_name='test-jpg')

def get_data_zoom(f_model, path, sz, bs, n, cv_idx):
tfms = tfms_from_model(f_model, sz, aug_tfms=transforms_top_down, max_zoom=1.05)
return get_data(path, tfms, bs, n, cv_idx)
Expand Down
Loading

0 comments on commit 53a416d

Please sign in to comment.