Keras: Handwritten Digit Recognition using MNIST Dataset

Similar documents
Keras: Handwritten Digit Recognition using MNIST Dataset

Code Mania Artificial Intelligence: a. Module - 1: Introduction to Artificial intelligence and Python:

A Quick Guide on Training a neural network using Keras.

Tutorial on Keras CAP ADVANCED COMPUTER VISION SPRING 2018 KISHAN S ATHREY

Index. Umberto Michelucci 2018 U. Michelucci, Applied Deep Learning,

Deep Nets with. Keras

Tutorial on Machine Learning Tools

Lecture 2 Notes. Outline. Neural Networks. The Big Idea. Architecture. Instructors: Parth Shah, Riju Pahwa

An Introduction to Deep Learning with RapidMiner. Philipp Schlunder - RapidMiner Research

Deep Learning Frameworks. COSC 7336: Advanced Natural Language Processing Fall 2017

An Introduction to NNs using Keras

MoonRiver: Deep Neural Network in C++

ECE 5470 Classification, Machine Learning, and Neural Network Review

PLT: Inception (cuz there are so many layers)

Advanced Machine Learning

Neural networks. About. Linear function approximation. Spyros Samothrakis Research Fellow, IADS University of Essex.

Deep Learning. Practical introduction with Keras JORDI TORRES 27/05/2018. Chapter 3 JORDI TORRES

Application of Deep Learning Techniques in Satellite Telemetry Analysis.

Practical Methodology. Lecture slides for Chapter 11 of Deep Learning Ian Goodfellow

COMP9444 Neural Networks and Deep Learning 7. Image Processing. COMP9444 c Alan Blair, 2017

Deep Learning with Tensorflow AlexNet

Deep Learning and Its Applications

POINT CLOUD DEEP LEARNING

Machine Learning With Python. Bin Chen Nov. 7, 2017 Research Computing Center

Machine Learning. MGS Lecture 3: Deep Learning

Convolution Neural Network for Traditional Chinese Calligraphy Recognition

Recurrent Convolutional Neural Networks for Scene Labeling

Artificial Intelligence Introduction Handwriting Recognition Kadir Eren Unal ( ), Jakob Heyder ( )

Deep Neural Networks Optimization

Deep Learning Benchmarks Mumtaz Vauhkonen, Quaizar Vohra, Saurabh Madaan Collaboration with Adam Coates, Stanford Unviersity

Frameworks in Python for Numeric Computation / ML

Encoding RNNs, 48 End of sentence (EOS) token, 207 Exploding gradient, 131 Exponential function, 42 Exponential Linear Unit (ELU), 44

Perceptron: This is convolution!

The Mathematics Behind Neural Networks

Practical 8: Neural networks

Machine Learning 13. week

Deep Neural Network Hyperparameter Optimization with Genetic Algorithms

NVIDIA GPU CLOUD DEEP LEARNING FRAMEWORKS

Polytechnic University of Tirana

DEEP LEARNING IN PYTHON. Creating a keras model

Deep neural networks II

Deep Learning. Visualizing and Understanding Convolutional Networks. Christopher Funk. Pennsylvania State University.

TensorFlow and Keras-based Convolutional Neural Network in CAT Image Recognition Ang LI 1,*, Yi-xiang LI 2 and Xue-hui LI 3

Tutorial on Deep Learning with Theano and Lasagne. Jan Schlüter Sander Dieleman EMBL-EBI

LSTM: An Image Classification Model Based on Fashion-MNIST Dataset

Machine Learning and Algorithms for Data Mining Practical 2: Neural Networks

Deep Learning Basic Lecture - Complex Systems & Artificial Intelligence 2017/18 (VO) Asan Agibetov, PhD.

SEMANTIC COMPUTING. Lecture 8: Introduction to Deep Learning. TU Dresden, 7 December Dagmar Gromann International Center For Computational Logic

Machine Learning Workshop

Index. Springer Nature Switzerland AG 2019 B. Moons et al., Embedded Deep Learning,

Day 1 Lecture 6. Software Frameworks for Deep Learning

Vulnerability of machine learning models to adversarial examples

Fuzzy Set Theory in Computer Vision: Example 3, Part II

Review: The best frameworks for machine learning and deep learning

Dropout. Sargur N. Srihari This is part of lecture slides on Deep Learning:

CS 523: Multimedia Systems

Deep Learning for Computer Vision II

International Journal of Computer Engineering and Applications, Volume XII, Special Issue, September 18,

Handwritten Mathematical Expression Recognition

Deep Learning. Volker Tresp Summer 2017

SGD: Stochastic Gradient Descent

DEEP LEARNING REVIEW. Yann LeCun, Yoshua Bengio & Geoffrey Hinton Nature Presented by Divya Chitimalla

CPSC 340: Machine Learning and Data Mining. Deep Learning Fall 2016

Handwritten Digit Recognition Using Convolutional Neural Networks

Deep Learning. Vladimir Golkov Technical University of Munich Computer Vision Group

ImageNet Classification with Deep Convolutional Neural Networks

A Deep Learning Approach to Vehicle Speed Estimation

MACHINE LEARNING CLASSIFIERS ADVANTAGES AND CHALLENGES OF SELECTED METHODS

Deep Learning Workshop. Nov. 20, 2015 Andrew Fishberg, Rowan Zellers

DEEP LEARNING IN PYTHON. The need for optimization

On the Effectiveness of Neural Networks Classifying the MNIST Dataset

Outlier detection using autoencoders

Deep Learning with R. Francesca Lazzeri Data Scientist II - Microsoft, AI Research

CNN Basics. Chongruo Wu

Hand Written Digit Recognition Using Tensorflow and Python

A performance comparison of Deep Learning frameworks on KNL

CS 6501: Deep Learning for Computer Graphics. Training Neural Networks II. Connelly Barnes

CS489/698: Intro to ML

Lecture 17: Neural Networks and Deep Learning. Instructor: Saravanan Thirumuruganathan

CMU Lecture 18: Deep learning and Vision: Convolutional neural networks. Teacher: Gianni A. Di Caro

Lecture : Neural net: initialization, activations, normalizations and other practical details Anne Solberg March 10, 2017

Advanced Video Analysis & Imaging

Machine Learning. Deep Learning. Eric Xing (and Pengtao Xie) , Fall Lecture 8, October 6, Eric CMU,

Deep learning at Microsoft

Smart Parking System using Deep Learning. Sheece Gardezi Supervised By: Anoop Cherian Peter Strazdins

INTRODUCTION TO DEEP LEARNING

Final Report: Classification of Plankton Classes By Tae Ho Kim and Saaid Haseeb Arshad

All You Want To Know About CNNs. Yukun Zhu

Deep Learning for Computer Vision

A Comparison of Sequence-Trained Deep Neural Networks and Recurrent Neural Networks Optical Modeling For Handwriting Recognition

CIS581: Computer Vision and Computational Photography Project 4, Part B: Convolutional Neural Networks (CNNs) Due: Dec.11, 2017 at 11:59 pm

BAYESIAN GLOBAL OPTIMIZATION

XES Tensorflow Process Prediction using the Tensorflow Deep-Learning Framework

Kaggle Data Science Bowl 2017 Technical Report

Convolution Neural Networks for Chinese Handwriting Recognition

Deep Learning For Video Classification. Presented by Natalie Carlebach & Gil Sharon

Deep Indian Delicacy: Classification of Indian Food Images using Convolutional Neural Networks

COMP 551 Applied Machine Learning Lecture 16: Deep Learning

Stochastic Gradient Descent Algorithm in the Computational Network Toolkit

CS 2750: Machine Learning. Neural Networks. Prof. Adriana Kovashka University of Pittsburgh April 13, 2016

Transcription:

Keras: Handwritten Digit Recognition using MNIST Dataset IIT PATNA January 31, 2018 1 / 30

OUTLINE 1 Keras: Introduction 2 Installing Keras 3 Keras: Building, Testing, Improving A Simple Network 2 / 30

Architecture of a Neural Network Figure : A Neural Network 3 / 30

Keras Keras is high-level neural networks library written in Python capable of running on top of TensorFlow (open source software library for numerical computation) Theano (numerical computation library for Python) CNTK (Microsoft Cognitive Toolkit): Deep learning framework developed with a focus on enabling fast experimentation (through user friendliness, modularity, and extensibility) 4 / 30

Guiding principles Modularity configurable modules neural layers, cost functions, optimizers, initialization schemes, activation functions, regularization schemes are all standalone modules that you can combine to create new models Minimalism Each module should be kept short and simple Easy extensibility New modules are simple to add (as new classes and functions) suitable for advanced research Work with Python Models are described in Python code, which is compact, easier to debug, and allows for ease of extensibility 5 / 30

Dependencies Python 2.7+ numpy: fundamental package for scientific computing with Python scipy: library used for scientific computing and technical computing Matplotlib (Optional, recommended for exploratory analysis) HDF5 and h5py (Optional, required if you use model saving/loading functions) Theano 6 / 30

Installation Follow instructions provided in keras installation file Alternatively you may visit Keras Installation Page 7 / 30

Keras provides Models Layers Preprocessing Metrics Optimizers Activations Datasets Constraints and many more... 8 / 30

Model Model core data structure of Keras a way to organize layers Two types: Sequential Model class API Sequential Model: a linear stack of layers functional API: for defining complex models, such as models with shared layers 9 / 30

Layers Core Layers Dense Activation Dropout Flatten many more... Convolutional Layers Pooling Layers Recurrent Layers Your own Keras layers and many more... 10 / 30

Core Layers Dense fully connected NN layer: connection to all activation in previous layer Activation Applies an activation function softmax: usually used on the output layer to turn the outputs into probability-like values relu: rectified linear unit (ReLU), most popular activation function, f (x) = max(x, 0) linear and many more... Dropout Applies Dropout to the input randomly setting a fraction p of input units to 0 prevent overfitting 11 / 30

Keras provides Optimizer the specific algorithm used to update weights while we train our model such as sgd (Stochastic gradient descent optimizer) objective function or loss function used by the optimizer to navigate the space of weights such as mse (mean squared error) metrics used to judge the performance of your model such as accuracy 12 / 30

Building a Simple Deep Learning Network Using Keras Steps Import libraries and modules Load image data Preprocess data Define model architecture Compile model Fit and evaluate Model Improvements Henceforth, the example file complements the (incomplete) slides 13 / 30

Building a Simple Deep Learning Network Using Keras Import libraries and modules as in example file Dataset Keras provides in-built support to many datasets such as MNIST database of handwritten digits used extensively in optical character recognition and machine learning research training set of 60,000 examples, and a test set of 10,000 examples digits have been size-normalized and centered in a fixed-size image black and white digits 28 28 pixels Keras provides method to load MNIST data set (example file) 14 / 30

Building a Simple Deep Learning Network Using Keras Preprocessing input data for Keras With Theano backend, the depth of the input image must be declared explicitly MNIST images have a depth of 1 Also, convert data type to float32 and normalize values as in example Preprocessing class labels for Keras 10 different classes, one for each digit as in example 15 / 30

Building a Simple Deep Learning Network Using Keras Model Architecture Usually most time consuming Use sequential model a Sequential model is declared as model = Sequential() Adding layers The model needs to know what input shape it should expect first layer in a Sequential model (and only the first, because following layers can do automatic shape inference) needs to receive information about its input shape Dense(32, input dim=784) specifies that it is first (input) layer output dimension is 32 (1 st argument input dimension is 784 If no activation function specified, no activation is applied (ie. linear activation: a(x) = x). 16 / 30

Model architecture one hidden layer with the same number of neurons as there are inputs (784) init: name of initialization function for the weights of the layer. normal for values randomly drawn from normal distribution. there are many other initializations available in Keras rectifier activation function is used for the neurons in the hidden layer softmax activation function is used on the output layer to turn the outputs into probability-like values and allow one class of the 10 to be selected as the models output prediction 17 / 30

Compile model Before training, configure the learning process, using compile() method. Three argements: optimizer: ANN training process is an optimization task with the aim of finding a set of weights to minimize some objective function loss function: the objective function that model try to minimize list of metrics: used to judge performance of model, similar to objective function however not used for training purpose Logarithmic loss is used as the loss function ADAM gradient descent algorithm is used to learn the weights 18 / 30

Train and Evaluate model Train model using fit() function Evaluate model on test data using evaluate() function 19 / 30

Performance of Simple Network 20 / 30

Improving Performance of Simple Network: additional hidden layers 21 / 30

Improving Performance of Simple Network: additional hidden layers 22 / 30

Improving Performance of Simple Network: introducing dropout layer 23 / 30

Improving Performance of Simple Network: using different optimizers 24 / 30

Improving Performance of Simple Network: training for more number of epochs 25 / 30

Improving Performance of Simple Network: training for more number of epochs 26 / 30

Improving Performance of Simple Network other options to explore different learning rate for optimizer number of neurons in hidden layer batch size 27 / 30

Constructing the Right Network steps to follow to make an efficient image classifier? lot of experimentation and testing to get the optimal structure and parameters 28 / 30

Important Links Links 1 Keras Official Documentation Page 2 Keras GitHub page 3 Another GitHub Page 4 GitHub Page MNIST example 5 Keras Tutorial 6 An Example 7 Another Example 8 Deep Learning with Keras (Book) 29 / 30

The End 30 / 30