Rocket Or Tower

Recently I started working on, this is my attempt at creating a network.

Attempt One

My training set contains 10 rockets and 10 towers

Using the the 3 line program from the library for the precompiled model resnet

data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True), 5)

0 is more rocket-like, 1 is more building-like

With having only 10 examples of each. It is amazing how well it did. Only misclassifing the CN tower just barely to being a rocket

Attempt Two

I added a lot more photos to about 300 each for training and 15 for the validation

This time adding data augmentation, variable learning rate and unfreezing the model

Data Augmentation

Modify the image slightly to known effects of a camera. This is transformations that shift, zoom and flip the images. These are fed into the learning like any other image

tfms = tfms_from_model(resnet34, sz, aug_tfms=transforms_side_on, max_zoom=1.1)

Stochastic Gradient Descent with Restarts

When a network is learning a function. It needs to start off high and reduce to gain more accuracy. This is included but also is restarted every epoch. This helps generalize the network, by trying avoiding narrow minimums. Creating a learning rate like this...

This is improved a little bit more by slowing down the learning rate on the later epochs.

Training the precomputed Model

Before training was done on the last few layers. This opens the begining layers. Also much lower learning rates are used in decreasing order to the earlier layers

lr=np.array([1e-4,1e-3,1e-2]), 3, cycle_len=1, cycle_mult=2)


96.6% accuracy. With one error in classification

  plot_confusion_matrix(cm, data.classes)

Below it the images it was most uncertain of including the incorrect labeling of the rocket on the bottom left

Thank you