Training a Neural Network
Explore building and training a simple two-layer neural network to perform binary classification on images by using extracted features like horizontal and vertical edges. Understand dataset handling, network design, training procedures, and validation to create a model that distinguishes objects such as Rubik's cubes and balls.
We'll cover the following...
Classification means placing an object into one of the possible categories, referred to as classes. For example, fruits are moving on a conveyor, and we want to sort them according to their type; apples must go in one basket, and oranges must go in another basket. Deciding if an image represents one type of fruit or the other is a classification task.
In this lesson, we collected images of 1000 objects from one of two categories: Rubik’s cubes and balls. A human annotated the dataset, i.e., they assigned the label 0 for a Rubik’s cube and 1 for a ball for each image. Let’s assume that we previously wrote a computer vision program to extract two features from each image.
What are image features?
The presence of strong horizontal and vertical lines could be an attribute to differentiate the two classes (Rubik’s cube vs. ball), so an engineer would choose to detect the presence of vertical and horizontal lines. Strong linear features are an indication of a Rubik’s cube, and the absence of strong linear features is an indication of a ball. Linear features can be obtained by the average of the vertical and horizontal Sobel images. We can recall that Sobel images highlight the pixels of vertical or horizontal edges:
In lines 7 and 8, we extract the mean of the Sobel values (which are high in the presence of well-defined edges) for both the x- and y-directions. ...