Source: Deep Learning on Medium
Building a Convolutional Neural Network (CNN) in Keras Using R
What Is Deep Learning?
Deep learning is an Artificial Intelligence function that imitates the workings of the human brain in processing data and creating patterns for use in decision making. Deep learning is a subset of machine learning in artificial intelligence (AI) that has networks capable of learning unsupervised from data that is unstructured or unlabeled. Also known as deep neural learning or deep neural network.
What Is Convolutional Neural Network?
CNNs are powerful image processing, artificial intelligence (AI) that use deep learning to perform both generative and descriptive tasks, often using machine vison that includes image and video recognition, along with recommender systems and natural language processing (NLP).
A Neural network is a system of hardware and/or software patterned after the operation of neurons in the human brain. Traditional neural networks are not ideal for image processing and must be fed images in reduced-resolution pieces. CNN have their “neurons” arranged more like those of the frontal lobe, the area responsible for processing visual stimuli in humans and other animals. The layers of neurons are arranged in such a way as to cover the entire visual field avoiding the piecemeal image processing problem of traditional neural networks.
A CNN uses a system much like a multilayer perceptron that has been designed for reduced processing requirements. The layers of a CNN consist of an input layer, an output layer and a hidden layer that includes multiple convolutional layers, pooling layers, fully connected layers and normalization layers. The removal of limitations and increase in efficiency for image processing results in a system that is far more effective, simpler to trains limited for image processing and natural language processing.
Layers In Convolution Neural Networks
Convolutional layers are the major building blocks used in convolutional neural networks.There are 7 Layers in Convolution Neural Networks.
Input Layer → Convolution Layer →Pooling Layer →Drop Out Layer→Flattening Layer →Fully Connected Layer →Output Layer
What Is Keras?
Keras is an open-source neural-network library written in Python. It is capable of running on top of TensorFlow, Microsoft Cognitive Toolkit, Theano, or PlaidML. Designed to enable fast experimentation with deep neural networks, it focuses on being user-friendly, modular, and extensible.
The Keras library makes it pretty simple to build a CNN. Computers see images using pixels. … A convolution multiplies a matrix of pixels with a filter matrix or ‘kernel’ and sums up the multiplication values
Building Convolutional Neural Network In R
First of all install and load 2 packages keras & EBImage.
The data-set contain 35 different types of images.I am using 30 images for training and 5 images for testing.
First of all set your working directory to that location where all the pics are saved.Create a vector that will contain all that pics that we gonna used for training.After that create one empty list and use For Loop to read all the train images. EBImage library provide us readImage() funciton for reading image.
Now we do same for test images.Create another vector that will contain all the test images,create another empty list,use for loop that will read all the test images and save them is empty list.
Explore The Data
Time to explore the data.we can use print() ,summary(),display(),plot() functions to look at data.we can explore dimension,color mode, mean,median and quantiles of each pic.