A simple Tribute Page to my Unknown Tribe.
A Pen by MercyMarkus on CodePen.
A simple Tribute Page to my Unknown Tribe.
A Pen by MercyMarkus on CodePen.
# This ensures that any edits to libraries you make are reloaded here automatically, | |
# and also that any charts or images displayed are shown in this notebook. | |
%reload_ext autoreload | |
%autoreload 2 | |
%matplotlib inline |
# Import libraries | |
from fastai import * | |
from fastai.vision import * | |
from fastai.callbacks import CSVLogger, SaveModelCallback | |
import seaborn as sns | |
import warnings | |
warnings.filterwarnings('ignore') |
# Get the data from dropbox link | |
!wget https://www.dropbox.com/s/6kltw0kqynlijxv/widsdatathon2019.zip | |
# The downloaded competition data is zipped, let us unzip it | |
!unzip widsdatathon2019.zip | |
# The training and testing data have already been seperated, Unzip them as well | |
!unzip train_images.zip | |
!unzip leaderboard_holdout_data.zip | |
!unzip leaderboard_test_data.zip |
# Overview of the labels of the training data; | |
df = pd.read_csv('data/traininglabels.csv') | |
df.head() |
src = (ImageList.from_df(df, path, folder='train_images') | |
.random_split_by_pct(0.2, seed=14) | |
.label_from_df('has_oilpalm') | |
.add_test(combined_test)) | |
data = (src.transform(get_transforms(flip_vert=True), size=164) | |
.databunch() | |
.normalize(imagenet_stats)) |
test_imgs = [i for i in test.iterdir()] | |
hold_imgs = [i for i in lb_test.iterdir()] | |
combined_test = test_imgs + hold_imgs | |
len(combined_test) |
sns.countplot(df.has_oilpalm) |
data.show_batch(2) |
learn = create_cnn(data, models.resnet50, metrics=[accuracy, error_rate], | |
callback_fns=[ShowGraph, SaveModelCallback]) | |
# View model architecture | |
learn.model() |