Image Classification using Pre-Trained Convolutional Neural Network in COLAB

Page 1

GRD Journals- Global Research and Development Journal for Engineering | Volume 5 | Issue 7 | June 2020 ISSN- 2455-5703

Image Classification using Pre-Trained Convolutional Neural Network in COLAB V. Neethidevan Assistant Professor Department of MCA Mepco Schlenk Engineering College, Sivkaasi

Abstract The object detection recognition is the heart today’s research world. The main goal of this field is to train machines to understand the content of an image just like humans do. The various Machine learning models like Histogram of oriented Gradients, Support Vector Machine, Bag of features model, Viola-Jones algorithms were earlier used for object recognition. The system is trained to detect and identify new object in the field of object recognition. Using Deep learning technique, the system is trained enough so that it could detect and recognize when a new object is fed to the system. Using deep learning it is possible to train the system to classify all types of data. It could be text, images, video or sound. It is implemented using neural network architecture. In deep learning, network may consist of hundreds of layers for complex systems. In this work, system is trained with Alex-net a pretrained neural network; classify the various input images such as animals and birds. Various types of animals and birds are used to train the system and finally a new object is given it can able to classify object as lion, bell pepper etc. The system is implemented in Google Colab a virtual VM, in which there is no need to install software’s and very much useful for the research community provided by Google for the research community. The system is implemented using python code using Colab. GPU is a graphics processing unit (GPU) is a specialized system provided by Google for free to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. Keywords- Machine Learning, Colab, Deep Learning, Object Detection, Image Classification

I. INTRODUCTION A. Convolutional Neural Network Artificial Neural Networks (ANNs) are computational processing systems of which are heavily inspired by way biological nervous systems (such as the human brain) operate. ANNs are mainly comprised of a high number of interconnected computational nodes (referred to as neurons), of which work interweave in a distributed fashion to collectively learn from the input in order to optimize its final output. The basic structure of an ANN can be modelled as shown in Figure 1.

Fig. 1: Basic structure of an ANN

The input could be loaded, usually in the form of a multidimensional vector to the input layer of which will distribute it to the hidden layers. The hidden layers will then make decisions from the previous layer and weigh up how a stochastic change within itself detriments or improves the final output, and this is referred to as the process of learning. B. Convolutional Neural Networks (CNNs) Convolutional Neural Networks (CNNs) are analogous to traditional ANNs in that they are comprised of neurons that selfoptimize through learning. Each neuron will still receive an input and perform an operation (such as a scalar product followed by a non-linear function) - the basis of countless ANNs. From the input raw image vectors to the final output of the class score, the entire network will still express a single perceptive score function (the weight). The last layer will contain loss functions associated with the classes, and all of the regular tips and tricks developed for traditional ANNs still apply. The only notable

All rights reserved by www.grdjournals.com

40


Image Classification using Pre-Trained Convolutional Neural Network in COLAB (GRDJE/ Volume 5 / Issue 7 / 006)

difference between CNNs and traditional ANNs is that CNNs are primarily used in the field of pattern recognition within images. This allows us to encode image-specific features into the architecture, making the network more suited for image-focused tasks whereas further reducing the parameters required setting up the model.

II. LITERATURE SURVEY In [1], Deep Learning is a subset of Artificial Intelligence, is applied to a number of signal and image applications. The primary goal of the work, is to apply the f a Deep Learning algorithm as, Convolutional neural networks (CNN) in image classification. The algorithm is tested on various standard datasets, like remote sensing data of aerial images (UC Merced Land U se Dataset) and scene images from SUN database. . In [2], authors mainly aimed at learning hierarchical representations of data by using deep architecture models. The application such as smart city, system has to capture many data automatically processed and analyzed. In this paper, authors applied Deep learning algorithms, to video analytics of smart city for object detection, object tracking, face recognition, image classification and scene labeling. In [3], authors addressed the use of two different kinds of network architectures, namely LeNet and Network in Network (NiN). The architectures were compared for both performance and computational efficiency. In [4], authors attempted to apply Web browsing capabilities to allow for several users and their browsing activity might be synchronized. A collaborative Web browsing system must allow necessary facilities so that users to get synchronized and desynchronized in a flexible way. In [5], the authors applied an atomizing process for bacteria recognition. This research study possibility to use image classification and deep learning method for classify genera of bacteria. In [6], collaborative learning based image classification method that uses features pre-trained convolutional neural networks (CNN) and hand-crafted. In [7]., the authors used a single-layer and deep convolutional networks for remote sensing data analysis.

III. SYSTEM DESIGN A. System Flow Diagram

Fig. 2: System Diagram

B. Classify an Image using AlexNet Read, resize, and classify an image using AlexNet. First, load a pretrained AlexNet model. net = alexnet; Read the image using imread. I = imread('peppers.png'); figure; imshow(I);

All rights reserved by www.grdjournals.com

41


Image Classification using Pre-Trained Convolutional Neural Network in COLAB (GRDJE/ Volume 5 / Issue 7 / 006)

The pretrained model requires the image size to be the same as the input size of the network. Determine the input size of the network using the InputSize property of the first layer of the network. sz = net.Layers(1).InputSize sz = 227 227 3 Crop the image to the input size of the network. Alternatively, resize the image using imresize (Image Processing Toolbox™). I = I(1:sz(1),1:sz(2),1:sz(3)); figure; imshow(I);

Classify the image using classify. label = classify(net,I) label = categorical bell pepper Show the image and classification result together. figure; imshow(I); title(char(label));

All rights reserved by www.grdjournals.com

42


Image Classification using Pre-Trained Convolutional Neural Network in COLAB (GRDJE/ Volume 5 / Issue 7 / 006)

C. Modules Design 1) Import the Required Libraries In this module, all the required libraries are imported into the package – google.colab.output – IPython.display – torchvision – pillow(PIL) – matplotlib – matplotlib.image 2) Load the Datasets In this module, the following datasets are loaded from the disk : image_classes.txt using open() method 3) Upload the Images and Capture the Image Download the images (animals, fruits, birds, vegetables, things) from internet and upload the images in the Colab research environment.

Fig. 3: Screenshot of Upload in Colab

4) Image Classification (Predict Value) With Help of dataset it can be classified the image For example: Upload the image “lion.jpg” it will classify the image with the help of dataset and give the result in the name of the image and percentage matched. 5) Display the Accurate Result with Given Image

All rights reserved by www.grdjournals.com

43


Image Classification using Pre-Trained Convolutional Neural Network in COLAB (GRDJE/ Volume 5 / Issue 7 / 006)

IV. SYSTEM IMPLEMENTATION A. System Environment (Google Colab)

Fig. 4: Colab Features

Colaboratory is a Google research project created to help machine learning education and research become more accessible and easy for everyone. It's a Jupyter notebook environment that requires Zero setup to use and runs entirely in the Google cloud. B. Software Package Details The Complete dataset is stored in the Colab Environment. Now the dataset is available in the Colab Environment. C. Implementation Details The following steps are required to load and run the program: – Open the web browser (Google Chrome) – Log in with the Google Account – Open the Colab in the browser – Open the existing notebook (Final Project.ipynb) – Press Ctrl+F9 (Runtime – Run All) to execute the program D. Sample Reports (output) File Name : 1.jpg Image Name : snail Percentage matched : 65.76302337646484 %

File Name : 2.jpg Image Name : hen Percentage matched : 98.18214416503906 %

All rights reserved by www.grdjournals.com

44


Image Classification using Pre-Trained Convolutional Neural Network in COLAB (GRDJE/ Volume 5 / Issue 7 / 006)

File Name : 3.jpg Image Name : trolleybus, trolley coach, trackless trolley Percentage matched : 31.01752471923828 %

File Name : 4.jpg Image Name : Labrador retriever

V. CONCLUSION As shown in the implementation details, system is trained with more input images in the training phase and the testing phase also we tested with new input image and system can able to detect recognize it successfully with more accuracy. The outputs shown in the implementation section clearly shows the system correctly detects classify as objects. In future we could train with more types of input data to train and testing with new data type more clearly.

VI. REFERENCES [1]

Deepika Jaswal, Sowmya.V, K.P.Soman, Image Classification Using Convolutional Neural Networks, International Journal of Advancements in Research & Technology, Volume 3, Issue 6, June-2014. [2] Wang L, Sng D. Deep learning algorithms with applications to video analytics for a smart city: A survey. ArXiv Prepr ArXiv151203131; 2015. [3] M. Badea, I. Felea, C. Vertan, L. Florea, The Use of Deep Learning in Image Segmentation Classification and Detection, Computer Vision and Pattern Recognition 62(5)2016, pp. 187–198 [4] Guillermo de Jesús Hoyos-Rivera, CoLab: A Flexible Collaborative Web Browsing Tool, Proceedings of the 19th International Conference on Advanced Information Networking and Applications. [5] Treebupachatsakul, Treesukon and Suvit Poomrittigul. “Bacteria Classification using Image Processing and Deep learning.” 2019 34th International Technical Conference on Circuits/Systems, Computers and Communications (ITC-CSCC) (2019): 1-3. [6] A. Romero, C. Gatta and G. Camps-Valls, "Unsupervised Deep Feature Extraction for Remote Sensing Image Classification," in IEEE Transactions on Geoscience and Remote Sensing, vol. 54, no. 3, pp. 1349-1362, March 2016. [7] E. TaSci and A. Ugur, "Image classification using ensemble algorithms with deep learning and hand-crafted features," 2018 26th Signal Processing and Communications Applications Conference (SIU), Izmir, 2018, pp. 1-4. [8] Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems (pp. 1097-1105). [9] LeCun, Y., Bengio, Y. and Hinton, G. (2015) Deep Learning. Nature, 521, 436-444.http://dx.doi.org/10.1038/nature14539 [10] Ribeiro, S. S., & Yao, J. (2019, December). Toward a Three-Way Image Classification Model: A Case Study on Corn Grain Images. In 2019 IEEE International Symposium on Multimedia (ISM) (pp. 177-1776). IEEE.

All rights reserved by www.grdjournals.com

45


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.