So, for fun, I decided to work on “DerpNet”… a network to classify “derpy” dog pics from regular dog pics
For my dataset, I scraped images from a Google Image Search for the term “derpy dog” and arrived at around ~ 200 images. I also grabbed all 25000 dog images from the dog vs. cat Kaggle dataset and selected around 650 images at random as the “non-derpy” class (I reviewed these manually to ensure none of them were “derpy” in nature)
Here is a quick look at some images:
Following along the lines of the Lecture 1 notebook, I trained a Resnet50 model and was able to achieve ~ 5% error rate in training, which seemed pretty decent.
The real test though for me, was to see if I could use this model to actually find instances of derpy dogs in an unlabeled dataset. To test this out, I ran this trained model against all 25,000 dog images in the dogs vs cats dataset and then looked at the top-50 highest confidence “derpy” predictions made by the classifier.
As I expected, the generalization wasn’t too great. This isn’t too surprising given that “derpyness” is not well defined, and since I don’t restrict to a single breed of dog, there is a lot of variations in the “derpy” class of images and only 150 training images are unlikely to be sufficient. Still, I was quite pleased to note that there were some definite successes for my model as shown below (Ranks 1, 2, 13, 14, 37, 46)
Rank1:
Interestingly, the dogs dataset had the following (trick?) image within it that was labeled as “dog”. DerpNet ranked this pretty high (Rank 40 out of 25000), so clearly the model needs a fair bit of work, though, to be fair, the model was trained to output P(derpy | dog) and wasn’t really trained to handle rejecting images with no dogs in them at all.
I also reimplemented all of this from scratch using Pytorch only (largely based on code in this tutorial - https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html) and despite not using lr_finder or one_cycle_fit, I was able to achieve slightly better performance simply training over several epochs with an error rate of 4.4%.