SlideShare a Scribd company logo
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 570
Image Classification – Cat and Dog Images
Tushar Jajodia1, Pankaj Garg2
1Student, Department of Information Technology, Maharaja Agrasen Institute of Technology
2Assistant Professor, Department of Information Technology, Maharaja Agrasen Institute of Technology
---------------------------------------------------------------------***----------------------------------------------------------------------
Abstract - Many problems in computervision weresaturating
on their accuracy before a decade. However, with the rise of
deep learning techniques, the accuracy of these problems
drastically improved. One of the major problem was that of
image classification, which is defined as predicting theclassof
the image. Cat and Dog image classification is one such
example of where the images of cat and dogareclassified. This
paper aims to incorporate state-of-art technique for object
detection with the goal of achieving high accuracy. A
convolutional neural network is been build for the image
classification task.
Key Words: Image Classification, Convolutional Neural
Network, Keras, Deep Learning, Callbacks.
1. INTRODUCTION
The Dogs vs. Cats image classification has been around for a
long time now. The Dogs vs. Cats competition from Kaggle is
trying to solve the CAPTCHA challenge, which relies on the
problem of distinguishing images of dogs and cats. It is easy
for humans, but evidence suggests that cats and dogs are
particularly difficult to tell apart automatically.
Many people has worked or are working on constructing
machine learning classifiers to address this problem. A
classifier based on color features got 56.9% accuracy on the
Asirra dataset. An accuracy of 82.7% was achieved from a
SVM classifier based on a combination of color and texture
features.
In my project I am going to build a convolutional neural
network to solve the problem and achieve higher
performance and better results.
In my project instead of using the Kaggledata setcomprising
of total 25000 images, I would be working on subsetofthese
images. My dataset would be comprising of total 10000
images. Keras would used for model buildingandall thecode
would be implemented on google colab.
2. Convolutional Neural Network
The name “convolutional neural network” indicates that the
network employs a mathematical (convolution) operation.
Convolution is a specialized kind of linear operation.
Convolutional networks are simplyneural networksthat use
convolution in place of general matrix multiplication in at
least one of their layers
A convolutional neural network consists of an input and an
output layer, as well as multiple hidden layers. The hidden
layers of a CNN typically consist of a series of convolutional
layers that convolve with a multiplication or other dot
product. The activation function is commonly a RELU layer,
and is subsequently followed by additional convolutions
such as pooling layers, fully connected layers and
normalization layers, referred to as hidden layers because
their inputs and outputs are masked by the activation
function and final convolution. Thefinal convolution,inturn,
often involves backpropagation in order to more accurately
weight the end product.
Fig 1. Basic CNN Architecture
3. Dataset and Data Augmentation
The dataset in keras is divided into folders for each class.
The dataset is divided into training and testing set. The
training set and the test set compose of 2 folders one for cat
images and other for dog images. There are 4000 images of
each cat and dog for training and 1000 image of each cat and
dog for testing. The images are of varing shape and sizes, but
in order to train a CNN the images should be of same size.
Data Augmentation is being carried out by using the
ImageDataGenerator module provided by Keras.Usingitthe
images are resized to 64 x 64. Also, for training of a
convolutional neural network largesetofimagesareneeded.
So, data augmentation is appliedontheexistingsetofimages
to increase the dataset size. Various data augmentation
technique such as rescaling, shear range, zoom range are
being used to do the same.
4. Model Architecture
Classifier is the name given to the Sequential model. The
model’s first layer is a Conv2D layer. Since, it is thefirstlayer
of the model, input shape of the images that are going to be
supplied to the model is being mentioned. Next layer is a
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 571
batch normalization layer. Then one activation layer
corresponding to the conv2d layer. Further there is another
set of conv2d, batch normalization and activation layer with
different number of kernels in the conv2d layer. After that a
max Pooling layer is there and then a dropout layer is there.
The same set of layers is again repeated with different
number of kernel’s and dropout rate. The convolutionlayers
end with this set. Next are the fully connected layer.
The Sequential model API is used to build model. The
sequential API allows you to create models layer-by-layer.
The ‘add()’ function to add layers to our model. The model
needs to know what input shape it should expect. For this
reason, only the first layer in a Sequential model needs to
receive information about its input shape.
Dropout layer consists in randomly setting a fraction rate of
input units to 0 at each update during training time, which
helps prevent overfitting.
Activation layer are used to apply the activation function to
the output of that layer. The purpose of the activation
function is to introduce non-linearity into the output of a
neuron. Relu and sigmoid activation are used in the model.
Batch Normalization is used for improving the speed,
performance, and stability of artificial neural
networks. Batch normalization is a method we can use to
normalize the inputs of each layer and achieve faster
convergence.
Maximum pooling, or max pooling, is a pooling operation
that calculates the maximum, or largest, value in each patch
of each feature map. The resultsaredownsampledor pooled
feature maps that highlight the most present feature in the
patch.
In Conv2D layer, a kernel, convolution matrix, or mask is a
small matrix. It is used for blurring, sharpening,
embossing, edge detection, and more. This is accomplished
by doing a convolution between a kernel and an image. This
layer creates a convolution kernel that is convolved withthe
layer input to produce a tensor of outputs.
Then comes the fully connected layers. It contains only 2
layers. First one is the global average pooling layer to
minimize overfitting by reducing the total number of
parameters in the model. Second layer and the final layer is
the Dense layer with sigmoid activation.
Global Average Pooling 2D layer is used to minimize
overfitting by reducingthetotal numberofparametersinthe
model. GAP layers perform a more extreme type of
dimensionality reduction, where a tensor with
dimensions h×w×d is reduced in size to have
dimensions 1×1×d. GAPlayersreduceeach h×w feature map
to a single number by simply taking the average of
all hw values.
Dense layer implements the operation: output =
activation(dot( input + kernel ) + bias, activation is the
element-wise activation function passed as the
activation argument, kernel is a weights matrix created by
the layer, and bias is a bias vector created by the layer ( only
applicable if use_bias is True).
There are total 131,457 total parameters, out of which
130,881 are trainable parametersand576arenon-trainable
parameters. The major number parameters are form the
conv2d layer. Batch normalization and dense layer also
contribute few of the parameters.
5. Model Compilation and Training
During the model compilation, the optimizer algorithm, loss
function and the list of metrics are parameters which are to
be taken care of. Adam is used as the optimizationalgorithm,
binary cross entropy is used as the loss function and
accuracy is the only metric used. Early Stopping and
ModelCheckPointer callbacks areusedtopreventoverfitting
and save the best state of the model. These callbacks are
mentioned as a list during the training. Sequential models
fit_generator() is used to train the model. Model is trained
for 100 epochs with EarlyStopping and modelCheckPointer
callbacks.
6. Model Evaluation
The model trained for 15 epochs after which it stopped due
to the presence of EarlyStopping callback which had the
patience parameter set to 5. The training accuracy kept on
increasing but the validation accuracy started to decrease
which might be due to overfitting. That was the reason
EarlyStopper check pointer was used to prevent results
obtained due to overfitting. Below is the table showing the
end result of training i.e train accuracy, test accuracy, train
loss, test loss and epochs.
Table -1: Training Result Per Epoch
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 572
The graph below shows training accuracy and testing
accuracy vs the number of epochs.
Chart -1: Accuracy vs Epoch
It is evident from the graph that the train accuracy kept on
increasing with the number of epochs but the test accuracy
become near constant after the 11th epoch.
The graph below shows the train loss and test loss vs the
number of epochs.
Chart -2: Loss vs Epoch
It is evident from the graph that the train loss kept
decreasing with the number of epochs but the test loss
become near constant after 11th epoch.
The final accuracy was obtained by initializing the model
with the weights that were stored during training by the use
of ModelCheckPointer callbacks. Final accuracy of 90.10%
was obtained on the testing data.
7. CONCLUSION
In this paper we build a deep convolutional neural network
for image classification (cat and dog images). Despite of
using only a subset of the images an accuracy of 90.10%was
obtained. If the whole dataset was being used the accuracy
would have been even better.
REFERENCES
[1] Golle, P. (2008, October). Machine learning attacks
against the Asirra CAPTCHA. In Proceedings of the 15th
ACM conference on Computer and communications
security (pp. 535-542). ACM.
[2] J. Elson, J. Douceur, J. Howell and J. Saul. Asirra: a
CAPTCHA that exploits interest-aligned manual image
categorization. Proc. of ACM CCS 2007, pp. 366-374.
[3] Muthukrishnan Ramprasath, M.Vijay Anand and
Shanmugasundaram Hariharan, Image Classification
using Convolutional Neural Networks. International
Journal of Pure and Applied Mathematics, Volume 119
No. 17 2018, 1307-1319
[4] Parkhi, O. M., Vedaldi, A., Zisserman, A., & Jawahar, C. V.
(2012, June). Cats and dogs. In Computer Vision and
Pattern Recognition (CVPR), 2012 IEEE Conference on
(pp. 3498-3505). IEEE.
[5] Zeiler, M. D., & Fergus, R. (2013). Visualizing and
Understanding Convolutional Neural Networks. arXiv
preprint arXiv:1311.2901.
[6] Bang Liu, Yan Liu, Kai Zhou “Image Classification for
Dogs and Cats”.

More Related Content

PDF
IRJET- Mango Classification using Convolutional Neural Networks
PDF
IRJET - Hand Gesture Recognition to Perform System Operations
PDF
IRJET - Implementation of Neural Network on FPGA
PPTX
Deep learning summary
PDF
IRJET- Fault Detection and Maintenance Prediction for Gear of an Industri...
PDF
Ijetcas14 329
PDF
Simulation of Single and Multilayer of Artificial Neural Network using Verilog
PDF
11.digital image processing for camera application in mobile devices using ar...
IRJET- Mango Classification using Convolutional Neural Networks
IRJET - Hand Gesture Recognition to Perform System Operations
IRJET - Implementation of Neural Network on FPGA
Deep learning summary
IRJET- Fault Detection and Maintenance Prediction for Gear of an Industri...
Ijetcas14 329
Simulation of Single and Multilayer of Artificial Neural Network using Verilog
11.digital image processing for camera application in mobile devices using ar...

What's hot (19)

PDF
Electricity Demand Forecasting Using ANN
PPT
eam2
PDF
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
PDF
Electricity Demand Forecasting Using Fuzzy-Neural Network
PPTX
Face Recognition: From Scratch To Hatch / Эдуард Тянтов (Mail.ru Group)
PDF
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
PDF
Comparison of hybrid pso sa algorithm and genetic algorithm for classification
PDF
Design of c slotted microstrip antenna using
PDF
11.comparison of hybrid pso sa algorithm and genetic algorithm for classifica...
PDF
IRJET- Machine Learning based Object Identification System using Python
PDF
Genetic Algorithm Processor for Image Noise Filtering Using Evolvable Hardware
PDF
CUDA Accelerated Face Recognition
PDF
Modeling of neural image compression using gradient decent technology
PDF
Iterative Determinant Method for Solving Eigenvalue Problems
PDF
IRJET- Handwritten Decimal Image Compression using Deep Stacked Autoencoder
PDF
SAR Image Classification by Multilayer Back Propagation Neural Network
PDF
Feed forward neural network for sine
PPTX
Artificial Neural Network
PDF
Hybrid PSO-SA algorithm for training a Neural Network for Classification
Electricity Demand Forecasting Using ANN
eam2
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Electricity Demand Forecasting Using Fuzzy-Neural Network
Face Recognition: From Scratch To Hatch / Эдуард Тянтов (Mail.ru Group)
BACKPROPAGATION LEARNING ALGORITHM BASED ON LEVENBERG MARQUARDT ALGORITHM
Comparison of hybrid pso sa algorithm and genetic algorithm for classification
Design of c slotted microstrip antenna using
11.comparison of hybrid pso sa algorithm and genetic algorithm for classifica...
IRJET- Machine Learning based Object Identification System using Python
Genetic Algorithm Processor for Image Noise Filtering Using Evolvable Hardware
CUDA Accelerated Face Recognition
Modeling of neural image compression using gradient decent technology
Iterative Determinant Method for Solving Eigenvalue Problems
IRJET- Handwritten Decimal Image Compression using Deep Stacked Autoencoder
SAR Image Classification by Multilayer Back Propagation Neural Network
Feed forward neural network for sine
Artificial Neural Network
Hybrid PSO-SA algorithm for training a Neural Network for Classification
Ad

Similar to IRJET- Image Classification – Cat and Dog Images (20)

PPTX
cnn ppt.pptx
PDF
Image Classification using Deep Learning
PPTX
Deep learning with keras
PPTX
Cv mini project (1)
PDF
imageclassification-160206090009.pdf
PDF
dfdshofdifhdifhdfhgfoighfgofgfgfgfgdfdfdfdf
PPTX
Image classification with Deep Neural Networks
PDF
Handwritten Digit Recognition using Convolutional Neural Networks
PDF
Classification of Images Using CNN Model and its Variants
PDF
Introduction to Convolutional Neural Networks
PDF
Hand Written Digit Classification
PPTX
Artificial Intelligence, Machine Learning and Deep Learning
PDF
Eye deep
PDF
Deep-Learning-with-PydddddddddddddTorch.pdf
PPTX
2017 (albawi-alkabi)image-net classification with deep convolutional neural n...
PDF
Neural Networks from Scratch - TensorFlow 101
PDF
0b85886e-4490-4af0-8b46-7ff3caf5dc2e.pdf
PPTX
PyConZA'17 Deep Learning for Computer Vision
PDF
Deep Learning for Computer Vision - ExecutiveML
PDF
OpenPOWER Workshop in Silicon Valley
cnn ppt.pptx
Image Classification using Deep Learning
Deep learning with keras
Cv mini project (1)
imageclassification-160206090009.pdf
dfdshofdifhdifhdfhgfoighfgofgfgfgfgdfdfdfdf
Image classification with Deep Neural Networks
Handwritten Digit Recognition using Convolutional Neural Networks
Classification of Images Using CNN Model and its Variants
Introduction to Convolutional Neural Networks
Hand Written Digit Classification
Artificial Intelligence, Machine Learning and Deep Learning
Eye deep
Deep-Learning-with-PydddddddddddddTorch.pdf
2017 (albawi-alkabi)image-net classification with deep convolutional neural n...
Neural Networks from Scratch - TensorFlow 101
0b85886e-4490-4af0-8b46-7ff3caf5dc2e.pdf
PyConZA'17 Deep Learning for Computer Vision
Deep Learning for Computer Vision - ExecutiveML
OpenPOWER Workshop in Silicon Valley
Ad

More from IRJET Journal (20)

PDF
Enhanced heart disease prediction using SKNDGR ensemble Machine Learning Model
PDF
Utilizing Biomedical Waste for Sustainable Brick Manufacturing: A Novel Appro...
PDF
Kiona – A Smart Society Automation Project
PDF
DESIGN AND DEVELOPMENT OF BATTERY THERMAL MANAGEMENT SYSTEM USING PHASE CHANG...
PDF
Invest in Innovation: Empowering Ideas through Blockchain Based Crowdfunding
PDF
SPACE WATCH YOUR REAL-TIME SPACE INFORMATION HUB
PDF
A Review on Influence of Fluid Viscous Damper on The Behaviour of Multi-store...
PDF
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
PDF
Explainable AI(XAI) using LIME and Disease Detection in Mango Leaf by Transfe...
PDF
BRAIN TUMOUR DETECTION AND CLASSIFICATION
PDF
The Project Manager as an ambassador of the contract. The case of NEC4 ECC co...
PDF
"Enhanced Heat Transfer Performance in Shell and Tube Heat Exchangers: A CFD ...
PDF
Advancements in CFD Analysis of Shell and Tube Heat Exchangers with Nanofluid...
PDF
Breast Cancer Detection using Computer Vision
PDF
Auto-Charging E-Vehicle with its battery Management.
PDF
Analysis of high energy charge particle in the Heliosphere
PDF
A Novel System for Recommending Agricultural Crops Using Machine Learning App...
PDF
Auto-Charging E-Vehicle with its battery Management.
PDF
Analysis of high energy charge particle in the Heliosphere
PDF
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
Enhanced heart disease prediction using SKNDGR ensemble Machine Learning Model
Utilizing Biomedical Waste for Sustainable Brick Manufacturing: A Novel Appro...
Kiona – A Smart Society Automation Project
DESIGN AND DEVELOPMENT OF BATTERY THERMAL MANAGEMENT SYSTEM USING PHASE CHANG...
Invest in Innovation: Empowering Ideas through Blockchain Based Crowdfunding
SPACE WATCH YOUR REAL-TIME SPACE INFORMATION HUB
A Review on Influence of Fluid Viscous Damper on The Behaviour of Multi-store...
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
Explainable AI(XAI) using LIME and Disease Detection in Mango Leaf by Transfe...
BRAIN TUMOUR DETECTION AND CLASSIFICATION
The Project Manager as an ambassador of the contract. The case of NEC4 ECC co...
"Enhanced Heat Transfer Performance in Shell and Tube Heat Exchangers: A CFD ...
Advancements in CFD Analysis of Shell and Tube Heat Exchangers with Nanofluid...
Breast Cancer Detection using Computer Vision
Auto-Charging E-Vehicle with its battery Management.
Analysis of high energy charge particle in the Heliosphere
A Novel System for Recommending Agricultural Crops Using Machine Learning App...
Auto-Charging E-Vehicle with its battery Management.
Analysis of high energy charge particle in the Heliosphere
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...

Recently uploaded (20)

PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Digital Logic Computer Design lecture notes
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Welding lecture in detail for understanding
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPT
Project quality management in manufacturing
PDF
composite construction of structures.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Geodesy 1.pptx...............................................
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
OOP with Java - Java Introduction (Basics)
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Digital Logic Computer Design lecture notes
Operating System & Kernel Study Guide-1 - converted.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
additive manufacturing of ss316l using mig welding
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Mechanical Engineering MATERIALS Selection
Welding lecture in detail for understanding
Model Code of Practice - Construction Work - 21102022 .pdf
Project quality management in manufacturing
composite construction of structures.pdf
Construction Project Organization Group 2.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Geodesy 1.pptx...............................................

IRJET- Image Classification – Cat and Dog Images

  • 1. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 570 Image Classification – Cat and Dog Images Tushar Jajodia1, Pankaj Garg2 1Student, Department of Information Technology, Maharaja Agrasen Institute of Technology 2Assistant Professor, Department of Information Technology, Maharaja Agrasen Institute of Technology ---------------------------------------------------------------------***---------------------------------------------------------------------- Abstract - Many problems in computervision weresaturating on their accuracy before a decade. However, with the rise of deep learning techniques, the accuracy of these problems drastically improved. One of the major problem was that of image classification, which is defined as predicting theclassof the image. Cat and Dog image classification is one such example of where the images of cat and dogareclassified. This paper aims to incorporate state-of-art technique for object detection with the goal of achieving high accuracy. A convolutional neural network is been build for the image classification task. Key Words: Image Classification, Convolutional Neural Network, Keras, Deep Learning, Callbacks. 1. INTRODUCTION The Dogs vs. Cats image classification has been around for a long time now. The Dogs vs. Cats competition from Kaggle is trying to solve the CAPTCHA challenge, which relies on the problem of distinguishing images of dogs and cats. It is easy for humans, but evidence suggests that cats and dogs are particularly difficult to tell apart automatically. Many people has worked or are working on constructing machine learning classifiers to address this problem. A classifier based on color features got 56.9% accuracy on the Asirra dataset. An accuracy of 82.7% was achieved from a SVM classifier based on a combination of color and texture features. In my project I am going to build a convolutional neural network to solve the problem and achieve higher performance and better results. In my project instead of using the Kaggledata setcomprising of total 25000 images, I would be working on subsetofthese images. My dataset would be comprising of total 10000 images. Keras would used for model buildingandall thecode would be implemented on google colab. 2. Convolutional Neural Network The name “convolutional neural network” indicates that the network employs a mathematical (convolution) operation. Convolution is a specialized kind of linear operation. Convolutional networks are simplyneural networksthat use convolution in place of general matrix multiplication in at least one of their layers A convolutional neural network consists of an input and an output layer, as well as multiple hidden layers. The hidden layers of a CNN typically consist of a series of convolutional layers that convolve with a multiplication or other dot product. The activation function is commonly a RELU layer, and is subsequently followed by additional convolutions such as pooling layers, fully connected layers and normalization layers, referred to as hidden layers because their inputs and outputs are masked by the activation function and final convolution. Thefinal convolution,inturn, often involves backpropagation in order to more accurately weight the end product. Fig 1. Basic CNN Architecture 3. Dataset and Data Augmentation The dataset in keras is divided into folders for each class. The dataset is divided into training and testing set. The training set and the test set compose of 2 folders one for cat images and other for dog images. There are 4000 images of each cat and dog for training and 1000 image of each cat and dog for testing. The images are of varing shape and sizes, but in order to train a CNN the images should be of same size. Data Augmentation is being carried out by using the ImageDataGenerator module provided by Keras.Usingitthe images are resized to 64 x 64. Also, for training of a convolutional neural network largesetofimagesareneeded. So, data augmentation is appliedontheexistingsetofimages to increase the dataset size. Various data augmentation technique such as rescaling, shear range, zoom range are being used to do the same. 4. Model Architecture Classifier is the name given to the Sequential model. The model’s first layer is a Conv2D layer. Since, it is thefirstlayer of the model, input shape of the images that are going to be supplied to the model is being mentioned. Next layer is a
  • 2. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 571 batch normalization layer. Then one activation layer corresponding to the conv2d layer. Further there is another set of conv2d, batch normalization and activation layer with different number of kernels in the conv2d layer. After that a max Pooling layer is there and then a dropout layer is there. The same set of layers is again repeated with different number of kernel’s and dropout rate. The convolutionlayers end with this set. Next are the fully connected layer. The Sequential model API is used to build model. The sequential API allows you to create models layer-by-layer. The ‘add()’ function to add layers to our model. The model needs to know what input shape it should expect. For this reason, only the first layer in a Sequential model needs to receive information about its input shape. Dropout layer consists in randomly setting a fraction rate of input units to 0 at each update during training time, which helps prevent overfitting. Activation layer are used to apply the activation function to the output of that layer. The purpose of the activation function is to introduce non-linearity into the output of a neuron. Relu and sigmoid activation are used in the model. Batch Normalization is used for improving the speed, performance, and stability of artificial neural networks. Batch normalization is a method we can use to normalize the inputs of each layer and achieve faster convergence. Maximum pooling, or max pooling, is a pooling operation that calculates the maximum, or largest, value in each patch of each feature map. The resultsaredownsampledor pooled feature maps that highlight the most present feature in the patch. In Conv2D layer, a kernel, convolution matrix, or mask is a small matrix. It is used for blurring, sharpening, embossing, edge detection, and more. This is accomplished by doing a convolution between a kernel and an image. This layer creates a convolution kernel that is convolved withthe layer input to produce a tensor of outputs. Then comes the fully connected layers. It contains only 2 layers. First one is the global average pooling layer to minimize overfitting by reducing the total number of parameters in the model. Second layer and the final layer is the Dense layer with sigmoid activation. Global Average Pooling 2D layer is used to minimize overfitting by reducingthetotal numberofparametersinthe model. GAP layers perform a more extreme type of dimensionality reduction, where a tensor with dimensions h×w×d is reduced in size to have dimensions 1×1×d. GAPlayersreduceeach h×w feature map to a single number by simply taking the average of all hw values. Dense layer implements the operation: output = activation(dot( input + kernel ) + bias, activation is the element-wise activation function passed as the activation argument, kernel is a weights matrix created by the layer, and bias is a bias vector created by the layer ( only applicable if use_bias is True). There are total 131,457 total parameters, out of which 130,881 are trainable parametersand576arenon-trainable parameters. The major number parameters are form the conv2d layer. Batch normalization and dense layer also contribute few of the parameters. 5. Model Compilation and Training During the model compilation, the optimizer algorithm, loss function and the list of metrics are parameters which are to be taken care of. Adam is used as the optimizationalgorithm, binary cross entropy is used as the loss function and accuracy is the only metric used. Early Stopping and ModelCheckPointer callbacks areusedtopreventoverfitting and save the best state of the model. These callbacks are mentioned as a list during the training. Sequential models fit_generator() is used to train the model. Model is trained for 100 epochs with EarlyStopping and modelCheckPointer callbacks. 6. Model Evaluation The model trained for 15 epochs after which it stopped due to the presence of EarlyStopping callback which had the patience parameter set to 5. The training accuracy kept on increasing but the validation accuracy started to decrease which might be due to overfitting. That was the reason EarlyStopper check pointer was used to prevent results obtained due to overfitting. Below is the table showing the end result of training i.e train accuracy, test accuracy, train loss, test loss and epochs. Table -1: Training Result Per Epoch
  • 3. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 572 The graph below shows training accuracy and testing accuracy vs the number of epochs. Chart -1: Accuracy vs Epoch It is evident from the graph that the train accuracy kept on increasing with the number of epochs but the test accuracy become near constant after the 11th epoch. The graph below shows the train loss and test loss vs the number of epochs. Chart -2: Loss vs Epoch It is evident from the graph that the train loss kept decreasing with the number of epochs but the test loss become near constant after 11th epoch. The final accuracy was obtained by initializing the model with the weights that were stored during training by the use of ModelCheckPointer callbacks. Final accuracy of 90.10% was obtained on the testing data. 7. CONCLUSION In this paper we build a deep convolutional neural network for image classification (cat and dog images). Despite of using only a subset of the images an accuracy of 90.10%was obtained. If the whole dataset was being used the accuracy would have been even better. REFERENCES [1] Golle, P. (2008, October). Machine learning attacks against the Asirra CAPTCHA. In Proceedings of the 15th ACM conference on Computer and communications security (pp. 535-542). ACM. [2] J. Elson, J. Douceur, J. Howell and J. Saul. Asirra: a CAPTCHA that exploits interest-aligned manual image categorization. Proc. of ACM CCS 2007, pp. 366-374. [3] Muthukrishnan Ramprasath, M.Vijay Anand and Shanmugasundaram Hariharan, Image Classification using Convolutional Neural Networks. International Journal of Pure and Applied Mathematics, Volume 119 No. 17 2018, 1307-1319 [4] Parkhi, O. M., Vedaldi, A., Zisserman, A., & Jawahar, C. V. (2012, June). Cats and dogs. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on (pp. 3498-3505). IEEE. [5] Zeiler, M. D., & Fergus, R. (2013). Visualizing and Understanding Convolutional Neural Networks. arXiv preprint arXiv:1311.2901. [6] Bang Liu, Yan Liu, Kai Zhou “Image Classification for Dogs and Cats”.