This was a binary classification CNN I made in July, and was my first taste of neural networks. At the time, I didn’t fully understand the theory behind what I was doing. I suppose I understood what each step was doing, but I didn’t understand why. To me, it was a series of black boxes I fashioned together.
After much reading (thank you Deep Learning) I can see it all piece together. It is quite fascinating.
I was inspired by seeing trail camera photos of a particular type of wild cat: the Pallas’s cat.
I collected (even more) photos of this cat, and divided them into two classes: child and adult. I then labeled each class and created a training set and a testing set. In each case, the data was balanced 1:1 child to adult. I was interested in knowing whether a CNN I could make could learn the subtle differences between cats of a different age. Determining the age of a human face was a problem which had already been tackled. I wanted to see if I could work with a new dataset.
I organized this in a way that Keras could read, and created a model with alternating convolutional and pooling layers, a CNN. Generalization was achieved with batch normalization, and regularization with dropout. The activation function was ReLu.
The loss function was the Keras function binary_crossentropy. Flattening with sigmoid was necessary to use this. The optimizer was Adam.
I have come to be intimate with all of these techniques and functions.
Knowing what I know now, here are two things I would have done differently:
1. Implement evaluation metrics other than accuracy. Accuracy ended up between high 70s and low 80s, depending on hyperparameters. It so happened that I had a balanced dataset, but even still a confusion matrix would have told the whole story.
2. Implement early stopping. I think I overfit. The last log of the model shows training loss stagnating for the last few epochs. Ah...