If you’ve been following along with this series of blog posts, then you already know what a hugefan I am of Keras. Keras is a super powerful, easy to use Python library for building neural networks and deep learning networks. In the remainder of this blog post, I’ll demonstrate how to build a simple neural network using Python and Keras, and then apply it to the task of image classification.
To start this post, we’ll quickly review the most common neural network architecture — feedforward networks. We’ll then write some Python code to define our feedforward neural network and specifically apply it to the Kaggle Dogs vs. Cats classification challenge. The goal of this challenge is to correctly classify whether a given image contains a dog or a cat. Finally, we’ll review the results of our simple neural network architecture and discuss methods to improve it.
While there are many, many different neural network architectures, the most common architecture is the feedforward network:
In this type of architecture, a connection between two nodes is only permitted from nodes in layer i to nodes in layer i + 1 (hence the term feedforward; there are no backwards or inter-layer connections allowed). Furthermore, the nodes in layer i are fully connected to the nodes in layer i + 1. This implies that every node in layer i connects to every node in layer i + 1. For example, in the figure above, there are a total of 2 x 3 = 6 connections between layer 0 and layer 1 — this is where the term “fully connected” or “FC” for short, comes from. We normally use a sequence of integers to quickly and concisely describe the number of nodes in each layer. For example, the network above is a 3-2-3-2 feedforward neural network:
Top DSC Resources