Free GPU — --> Lesson 1 -HW- Alien vs. Predator images

1. Data Collection

The goal for all data collection is to capture quality evidence that allows analysis to lead to the formulation of convincing and credible answers to the questions that have been posed.

  • Creating your own dataset from Google Images
    link 1
    link 2
  • Google Dataset Search The tool surfaces information about datasets hosted in thousands of repositories across the Web, making these datasets universally accessible and useful.
  • Download Alien vs. Predator images Dataset from kaggle

2. Setup Google Colab

  • Login into Gmail
  • Upload Data into Google Drive
  • Fastai requires the datasets to be organized in folders in the following way:
|-- train
|-- alien
|-- predator
|-- valid
|-- alien
|-- predator
  • Open Google Colab
  • Select New Python 3 Notebook
  • Go to Edit → Notebook Setting → Select Hardware Accelerator-GPU → Save
  • Mounting Google Drive locally : mount your Google Drive in your virtual machine using an authorization code
# Load the Drive helper and mount
from google.colab import drive
# This will prompt for authorization.
  • Click the link → Select ‘Allow’ → Copy Authorization code → paste into Enter Autorizatoin text box → press Enter

3. Install Pytorch 1.0 and Fastai 1.0

!pip install torch_nightly -f
!pip install fastai

4. Import Libraries

%reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai import *
from import *

5. Preprocessing and Feature Engineering

!ls "/content/drive/My Drive/FastaiData/Alien-vs-Predator"
path='/content/drive/My Drive/FastaiData/Alien-vs-Predator'
tfms = get_transforms(do_flip=False)
#default bs=64, set image size=100 to run successfully on colab
data = ImageDataBunch.from_folder(path,ds_tfms=tfms, size=100)
data.show_batch(rows=3, figsize=(10,10))

6. Model Building

learn = ConvLearner(data, models.resnet50, metrics=accuracy)

7. Model Evaluation

interp = ClassificationInterpretation.from_learner(learn)
interp.plot_top_losses(9, figsize=(15,11))
interp.plot_confusion_matrix(figsize=(12,12), dpi=60)

Further Reading

Happy Learning!