Image Classification Using Convolutional Neural Networks
Image Classification Using Convolutional Neural Networks
https://doi.org/10.22214/ijraset.2022.47085
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue XII Dec 2022- Available at www.ijraset.com
Abstract: Convolutional neural networks (CNNs), which are composed of multiple processing layers to learn the representations
of data with multiple abstract levels, are the most successful machine learning models in recent years. Within this paper, we
present the usage of a trained deep convolutional neural network model to extract the features of the images, and then classify
the images. We will study image processing and understand image classification. It has good application prospects.
Keywords: Convolutional Neural Networks, Deep Learning, Image Processing, Image Classification, Overfitting.
I. INTRODUCTION
The rise of big data and the rapid popularization of high-performance computing devices in recent years have contributed to the
unprecedented development of machine learning. Regarding image classification, this study intends to artificially extract features,
and convert the features of an original image into useful features characterized by lower dimension and less noise. Machine learning
has been gaining momentum over last decades. It is a class of artificial intelligence methods, which allows the computer to operate in
a self-learning mode, without being explicitly programmed. Neural network is a machine learning algorithm. It is a system of
interconnected artificial “neurons” that exchange messages between each other. The network consists of multiple layers of feature-
detecting neurons. Each layer has many neurons that respond to different combinations of inputs from the previous layers.
Convolutional Neural Network is a special case of the neural network proposed by Yann LeCun in 1988. It consists of one or more
convolutional layers, often with a subsampling layer, which are followed by one or more fully connected layers as in a standard
neural network. The design of a CNN is motivated by the discovery of a visual mechanism, the visual cortex, in the brain. Each
feature of a layer receives inputs from a set of features located in a small neighbourhood in the previous layer called a local
receptive field. With local receptive fields, features can extract elementary visual features, such as oriented edges, end-points,
corners, etc., which are then combined by the higher layers. One of the most important uses of this architecture is Image
Classification.
While neural networks and other pattern detection methods have been around, there is significant development in the area of
convolutional neural networks. This is because of its ruggedness to shifts and distortions in the image, fewer memory requirements,
easier and better training. The image input is passed through a series of convolutional, pooling, flattening and dense fully connected
layers, and then the output is generated. In this paper we will be studying about layers of convolutional neural networks and its
implementation in real-time.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 586
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue XII Dec 2022- Available at www.ijraset.com
V. SOLUTION
Digital image classification utilizes computer-aided enhancement to turn subjective features of an image into data that can be
measured, quantified and evaluated. Image processing must be approached in a manner consistent with the scientific method so that
others may reproduce, and validate, one’s results. To study image processing and understand image classification we will be using
convolutional neural networks. The image input is passed as a dataset through a series of convolutional, pooling, flattening and dense
fully connected layers, and then the output is generated.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 587
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue XII Dec 2022- Available at www.ijraset.com
A. Convolution Layer
It is always the first. The image matrix with pixel values is entered into it. Imagine that the reading of the input matrix begins at the
top left of image. Next the software selects a smaller matrix there, which is called a filter. Then the filter produces convolution, i.e.
moves along the input image. The filter’s task is to multiply its values by the original pixel values. All these multiplications are
summed up. One number is obtained in the end. Since the filter has read the image only in the upper left corner, it moves further and
further right by one unit performing a similar operation. After passing the filter across all positions, a matrix is obtained, but smaller
than the input matrix. When the image passes through one convolution layer, the output of the first layer becomes the input for the
second layer. And this happens with every further convolutional layer.
C. Flattening Layer
After the convolution and pooling layers, our classification part consists of dense fully connected layers. However, these fully
connected layers can only accept One Dimensional data. To convert our 3D data to 1D, we use the flattening layer.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 588
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue XII Dec 2022- Available at www.ijraset.com
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 589
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue XII Dec 2022- Available at www.ijraset.com
batch_size = 32,
class_mode = 'binary')
classifier.fit_generator(training_set,
steps_per_epoch = 800,
epochs = 25,
validation_data = test_set,
validation_steps = 200)
# Making predictions
import numpy as np
from keras.preprocessing import image
test_image= image.load_img('dataset/single_prediction/cat_or_dog_1.jpg', target_size = (64, 64))
test_image = image.img_to_array(test_image)
test_image = np.expand_dims(test_image, axis = 0)
result = classifier.predict(test_image)
training_set.class_indices
if result[0][0] == 1:
prediction = 'dog'
else:
prediction = 'cat'
VII. ANALYSIS
The basis of the model is Supervised Machine Learning. It is one of the ways of machine learning where the model is trained by input
data and expected output data. It is tested and evaluated. Тo create such model, it is necessary to go through the following phases:
model construction, model training, model testing and model evaluation. Model Construction depends on machine learning
algorithms. In this project’s case, it is convolutional neural networks. Before model training it is important to scale data for the further
use. After model construction it is time for Model Training. In this phase, the model is trained using training data and expected output
for this data. Progress is visible on the console when the script runs. At the end it will report the final accuracy of the model. Once the
model has been trained it is possible to carry out Model Testing. During this phase a second set of data is loaded. This data set has
never been seen by the model and therefore it’s true accuracy will be verified. Finally, the saved model can be used in the real world.
The name of this phase is Model Evaluation. This means that the model can be used to evaluate new data.
We have taken datasets of cats and dogs. We tried how to classify the images of cats and dogs. The Training Set has 800 pictures of
cats and dogs. The Test Set has 200 pictures of cats and dogs. Given any image we must classify whether it is a cat or a dog. As a
result of testing the model, we got a very good accuracy: 93.8% of correct classification samples after 32 epochs. The only
drawback was that we had to wait about 30 minutes until 32 epochs come to the end. If the training data accuracy (acc) keeps
improving while the validation data accuracy (val_acc) gets worse, we are likely in an overfitting situation, i.e. your model starts to
basically just memorize the data. Consequently, this model is sufficient to train on 10 epochs. The model can still be optimized to get
100% accuracy by introducing new techniques into the model.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 590
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue XII Dec 2022- Available at www.ijraset.com
VIII. CONCLUSION
From this project, we figured out what deep learning is. We constructed, assembled, trained, tested and evaluated the Convolutional
Neural Networks Model to classify images of cats and dogs. We have tested that this model works well with small number of
images and measured how the accuracy depends on the number of epochs in order to detect potential overfitting problem. It is
determined that 10 epochs are enough for a successful training of the model. The scope can be extended to try this model on more
data sets and apply it to practical tasks in order to see how a higher efficiency can be achieved in various problems.
IX. ACKNOWLEDGMENT
This project work was supported by our Mentor Prof. Dr. G Madhu of Information Technology Department and encouraged by our
Institution VNR Vignana Jyothi Institute of Engineering and Technology.
REFERENCES
[1] https://www.learnopencv.com/image-classification-using-convolutional-neural-networks-in-keras/ [1]
[2] http://www.thejavageek.com/2018/05/13/image-classification-using-cnn/ [2]
[3] Papers from https://ieeexplore.ieee.org/document/8379889 [3]
[4] Book on Deep Learning with Python by François Chollet [4]
[5] Book on Practical Convolutional Neural Networks by Pradeep Pujari, Md. Rezaul Karim, Mohit Sewak [5]
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 591