Professional Documents
Culture Documents
PROJECT 2:
NEURAL NETWORKS
Course:
Computational Intelligence
Evangelia Anastasaki
Mtp 231
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Contents
Abstract ....................................................................................................................... 3
Introduction ................................................................................................................. 4
Methodology ............................................................................................................... 5
Hardware ............................................................................................................. 6
Libraries ............................................................................................................... 7
Results ....................................................................................................................... 11
Conclusion ................................................................................................................ 16
References ................................................................................................................. 17
2
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Abstract
3
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Introduction
In this paper, I utilize an Artificial Neural Network (ANN) - Backpropagation
Algorithm to solve image classification using Fashion-MNIST dataset on purpose the
best accuracy from the training of the model. Image classification refers to the task
of entering an image into a neural network and having it output some kind of label
for that image. The label that the network outputs will correspond to a pre-defined
class. There can be multiple classes that the image can be labelled as, or just one. A
subsection of image classification is object detection, where particular occurrences of
objects are recognized as belonging to a certain class like clothes. There are two sorts
of classification: supervised and unsupervised. Supervised learning is based on
training a data sample from the information establishment with the accurate
classification as of now apportioned. Such techniques are utilized in feedforward or
MultiLayer Perceptron (MLP) models. Learning through training in a supervised
Artificial Neural Network (ANN) model too called an error backpropagation
algorithm. The error correction-learning calculation trains the network based on the
input-output samples and finds error signal, which is the difference of the output
calculated and the specified output and adjusts the synaptic weights of the neurons
that are relative to the product of the error signal and the input occurrence of the
synaptic weight Self-Organizing neural networks learn to utilize an unsupervised
learning algorithm to distinguish hidden patterns in the unlabeled input information.
This unsupervised mentions the ability to memorize and organize data without
providing an error signal to evaluate the potential arrangement. The lack of direction
for the learning algorithm in unsupervised learning can in some cases be beneficial
since it lets the algorithm to look back for patterns that have not been previously
considered. The computational layer is additionally called a competitive layer since
the neurons within the layer compete with each other to end up dynamic. Thus, this
learning algorithm is called a competitive algorithm.
4
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Methodology
Fashion-MNIST Dataset
5
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
of the class labels and represents the article of clothing. The rest of the columns
contain the pixel-values of the related image.
Hardware
First of all, to perform machine learning the software required a computer system
powerful enough to handle the computing power necessary. Therefore, I have used:
➢ Central Processing Unit (CPU): Intel Core i7 8th Generation processor.
➢ Random Access Memory (RAM): 16 GB.
➢ Graphics Processing Unit (GPU): NVIDIA GeForce GT 640M LE.
6
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Libraries
Firstly, for the implementation of the software, I have used specifics machine learning
libraries:
➢ T-SNE (T-distributed Stochastic Neighbor Embedding) by scikit-learn is
a tool to visualize high-dimensional information. It converts similarities
between information points to joint probabilities and tries to minimize the
Kullback-Leibler dissimilarity between the joint probabilities of the low-
dimensional inserting and the high-dimensional information. Τ-SNE contains
a cost function that is not convex, i.e. with diverse initializations we will get
diverse results.
➢ NumPy is the basic package for scientific computing with Python. It contains
among other things: an effective N-dimensional cluster object, advanced
(broadcasting) functions, tools for joining C/C++ and Fortran code, useful
linear algebra, Fourier change, and irregular number capabilities.
➢ Matplotlib is a Python 2D plotting library which produces publication quality
figures in an assortment of hardcopy designs and interactive environments.
Matplotlib can be utilized in Python scripts, the Python and IPython shells (a
wealthy interactive interface, letting rapidly process information and test
thoughts.), the Jupyter notebook, web application servers, and four graphical
user interface toolkits. Moreover, it produces plots, histograms, control
spectra, bar charts, error charts, scatterplots, etc., with just a few lines of code.
Besides, it gives a MATLAB-like interface, especially when combined with
IPython.
➢ SciPy is one of the fundamental packages that make up the SciPy stack. It
gives numerous user-friendly and effective numerical routines, such as
routines for numerical integration, interpolation, optimization, linear algebra,
and statistics.
7
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
8
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Its first derivative, which I utilized during the backpropagation step of the training
algorithm, has the following equation:
➢ Also, I utilized the Softmax function. The Softmax function can be effectively
separated, output depends only on input and the elements of the resulting
vector sum to 1. The definition is:
9
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
➢ Measuring the error: I utilized the Cross-Entropy loss (known as log loss)
work to evaluate the error. This function measures the execution of a
classification model whose output is a likelihood. It penalizes (cruelly)
predictions that are wrong and certain. Here is the definition:
➢ Making predictions: the model can learn from data and form predictions on
data it has not seen before. I am aiming to implement two strategies for
prediction - predict and predict_proba. By and large talking, the predictions in
NN includes applying a forward step on the data. But the result of it is a vector
of values representing how solid the belief for each class is for the data and I
utilize Maximum likelihood estimation (MLE) to get the ultimate predictions.
MLE is a strategy of assessing the parameters of likelihood distribution by
maximizing a probability function so that beneath the expected statistical
model the observed information is most probable. The point within the
parameter space that maximizes the probability function is called the maximum
likelihood estimate.
10
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Furthermore, I created a Neural Network (NN) that can properly predict values from
the XOR function.
The epochs parameter controls how numerous times the algorithm will “see” the
information during training. At that point, I set the number of neurons within the
input, hidden and output layers - I have 2 numbers as input and 1 number as the output
size. The learning rate parameter controls how rapidly the NN will learn from new
information and forget what already knows.
Results
11
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
As it is reported above that the product images are grayscale, 28x28 pixels, like
figure 4 shows:
Then, the program appears a plot which is a lower dimensional representation of some
of the products using a T-SNE. It transforms the data into 2-dimensional using the
implementation from scikit-learn:
12
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
The plot appears a clear separation between a few classes and significant overlap
between others. Therefore, I have built a Neural Network that can attempt to isolated
between diverse fashion products. Then, from the training, it is observed that the sum
error seems to be decreasing. But as the plot appears (figure 7), the model cannot
proceed to decrease the error from the 60 epochs and so on.
13
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Then, the program appears a single prediction (figure 8), which seems correct. After
it is evaluated a few more predictions (figure 9), the most are wrong.
14
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Well, those do not look that good. While a random classifier will return ~20%
accuracy, ~61% accuracy on the test dataset will not make a practical classifier either.
Consequently, I improved the evaluation utilizing scikit-learn`s scale to normalize
the data and the final results seem much better.
15
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
Finally, the accuracy ~86% (vs ~61%) on the training set is a vast improvement over
the unscaled method.
Conclusion
In conclusion, after training and testing the fashion-MNIST dataset using the
backpropagation algorithm to solve image classification the model can fit the dataset
whose best accuracy is 86.55%.
16
Image Classification using Backpropagation Algorithm – Fashion Products by MNIST
Dataset | Evangelia Anastasaki
References
17