0% found this document useful (0 votes)
25 views

Image Classification Using Backpropagation Algorithm (Presentation)

The document discusses image classification using a backpropagation algorithm on the MNIST fashion dataset. It describes setting up a basic neural network in Python using NumPy and libraries like scikit-learn, matplotlib and SciPy. It shows the code implementation for forward and backpropagation, and presents results of the network's training and testing accuracy on the dataset.

Uploaded by

eveanast
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Image Classification Using Backpropagation Algorithm (Presentation)

The document discusses image classification using a backpropagation algorithm on the MNIST fashion dataset. It describes setting up a basic neural network in Python using NumPy and libraries like scikit-learn, matplotlib and SciPy. It shows the code implementation for forward and backpropagation, and presents results of the network's training and testing accuracy on the dataset.

Uploaded by

eveanast
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Hellenic Mediterranean University

M.Sc. Informatics Engineering

Project 2 : Course:
Artificial Neural Networks Computational Intelligence

Image Classification using


Backpropagation Algorithm
Fashion Products by MNIST Dataset

Evangelia Anastasaki
MTP231
What is Image Classification

• Refers to the task of inputting 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 subset of image classification is object detection, where specific instances of objects are
identified as belonging to a certain class like clothes.

• There are two types of classification: supervised and unsupervised.


Types of Image Classification

Supervised Classification Unsupervised Classification

• uses the spectral signatures obtained


• finds spectral classes (or clusters) in a
from training samples.
multiband image without the analyst’s
intervention.
• can easily create training samples to
represent the classes you want to • provides access to the tools to create the
extract.
clusters, capability to analyze the quality
of the clusters, and access to classification
• can also easily create a signature file
tools.
from the training samples, which is
then used by the multivariate
classification tools.
Fashion - MNIST Dataset

Image Data

• A dataset of Zalando’s article images -


consisting of a training set of 60,000
examples and a test set of 10,000
examples.

• Each example is a 28 x 28 grayscale


image, associated with a label from 10
classes and each class takes three rows.
Machine Learning Set-Up

Hardware • RAM – 16 GB
• CPU - Intel Core i7 8th
Generation processor

• GPU - NVIDIA GeForce GT 640M LE


Machine Learning Set-Up

Libraries
T- SNE

• a tool to visualize high-dimensional data • a powerful N-dimensional array object.


by a two- or three- dimensional point.
• broadcasting functions.
• nonlinear
• tools for integrating C/C++.
• has a cost function, which with different
initializations we can get different results. • useful linear algebra, Fourier transform and
random number capabilities.
Machine Learning Set-Up

Libraries

• is a 2D plotting library • provides routines for numerical integration,


interpolation, optimization, linear algebra
• generates plots, histograms, errorcharts, and statistics.
scatterplots, etc.

• provides a MATLAB-like interface.


Machine Learning Set-Up
Python Spyder (Anaconda Distribution)
• High - Level Programming • Open - Source 
Language
• The easiest way to perform Python data science and machine
• Object - Oriented learning for various Python versions
• Open Source Language • Manages libraries, dependencies, and environments with
Conda
• Develops and trains machine learning and deep learning
models
• Analyzes data with scalability and performance 
• Visualizes results
Basic Neural Network-Backpropagation Code (1/3)
Basic Neural Network-Backpropagation Code (2/3)
Basic Neural Network-Backpropagation Code (3/3)
Software

• Building NN: 1 hidden layer

• Initializing the weights: I sample a uniform distribution with values between -1 and 1 for the
initial weights.

• Training: For each epoch, I apply the backprop algorithm, evaluate the error and the gradient
with respect to the weights. Then, I use the learning rate and gradients to update the weights.

• Measuring the error: I use Cross-Entropy loss (known as log loss) function to evaluate the
error.

• Making predictions: on data NN has not seen before

• Evaluation: the NN model to the test


Software & Results

Exploration
The product images are grayscale, 28x28 pixels

Result 1
Software & Results
• Lower dimensional representation of some of the products using T-SNE.
Exploration
• Transforms the data into 2-dimensional using the implementation from scikit-learn:

Result 2
Software & Results

Sigmoid - Sigmoid Prime


Sigmoid defined:

Sigmoid Prime
defined:

Result 3
Software & Results

Softmax
can be easily differentiated and the output
depends only on input, and the elements
of the resulting vector sum to 1.

In probability theory, the output of the Softmax function is sometimes used as


a representation of a categorical distribution.

Result 4
Software & Results
By defining some parameters
Backpropagation
Solving XOR

The training data (from the table)


looks like this
Software & Results
Log Loss
 A plot at the training error:

Result 5 Result 6
Software & Results

Prediction

A plot at a single prediction:

Result 7
Software & Results
Prediction
Accuracy

Result 8
Software & Results
Improving the predictions
Accuracy

Final Result
References

• Image Classification: https://www.sc.chula.ac.th/courseware/2309507/Lecture/remote18.htm

• Neural Network Using Python and NumPy:


https://www.python-course.eu/neural_networks_with_python_numpy.php

• Python: https://www.python.org/

• Anaconda Distribution: https://www.anaconda.com/distribution/

• Fashion - MNIST Dataset:


https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/

• Scikit-Learn: https://scikit-learn.org/stable/index.html

• NumPy: https://numpy.org/

• Matplotlib: https://matplotlib.org/3.1.0/index.html

• SciPy: https://www.scipy.org/

You might also like