You are on page 1of 24

Object Classification using CNN

Lalit Jain https://www.linkedin.com/in/lalit7jain/


Rohit Agarwal https://www.linkedin.com/in/rohitag04/
Shivam Goel https://www.linkedin.com/in/goelshi/
Hina Gandhi: https://www.linkedin.com/in/hina-gandhi-52834356/

Big Data & Engineering Systems


Under the guidance of Professor. Dino Konstantopoulos
Agenda
1. Case Study
2. Building a Convolutional Neural Network
3. Time Complexity
Agenda
4. Using VGG16 model
5. Demo
6. Results
7. Limitations & Challenges
8. Future Scope
Case Study
Building a CNN model which can be trained on
the fly and classify objects
Approach
1. Using Google API to download 100 images from the front end using a Keyword
2. Prepare the image by cleaning and augmentation
3. Train the model based on the image downloaded with Convolutional Neural Network
using Keras and Tensorflow
4. Classify the image

Technology Stack:
Programming Language: Python
Front End: Django Framework
Machine Specifications:
Libraries: Keras, Tensorflow, VGG16, etc
Convolutional Neural Network
Images are a matrix of pixel values

Convolution Operation

Relu Activation

Pooling (Max)
Putting it all together
About the Dataset
We have taken two datasets :
Static Model:
One dataset is related to natural calamities where we have trained our
models for 4 classes “earthquake”, “hurricane”, “tornado” and “volcanic
eruption”.

Dynamic Model:
Other dataset is related to personality identification which will work on the
fly. During demo, we will add one personality on the fly in addition to the
existing classes (Donald Trump, Morgan Freeman)
Use case and Scope
1. Using static model, identify one of the 4 natural calamities
2. Using the trained dynamic model, identify the personality

Out of Scope/ Limitations:


1. Being able to identify a class which is not trained
2. Being able to identify 0 as output if image does not match
3. Misclassification of images due to training on uncleaned and inaccurate
image labels
DEMO
Data augmentation for improving the
model
By applying random transformation to our train set, we artificially enhance our
dataset with new unseen images.
shear_range: Rotate image by 0.2
zoom_range: Zoom the image by 0.2
horizontal_flip: Randomly flip inputs horizontally
rescale: rescaling factor (1./255)
Building CNN from Scratch
Basic CNN model (the model that was
developed from scratch) gave ~74% accuracy.
CNN training complexity
Time: 8-9 Hours
Processor: CPU
Dataset: 2000 images
Classes: 2

Can we improve it?


VGG16 Pre-Trained Model
The model achieves 92.7%
top-5 test accuracy in
ImageNet, which is a
dataset of over 14 million
images belonging to 1000
classes.

Citation: https://arxiv.org/pdf/1409.1556.pdf
Using the VGG16 Model
Using the VGG16 Model
We have created our own sequential model and then added to VGG16.
Improvement
Using this approach, the accuracy was improved to 87%.
Time to run the model was still 2-3 hours.

Can we improve the


time?
Using GPU machine
Running the model on a AWS instance with Nvidia GK104 GPU (4 GB) powered instance
The epochs that took 1 hour to train 140 images are now executing in under a minute as
shown in next slide with an accuracy of 95%
Results
Results
Evolution of accuracy on training (blue) and validation (green) sets for 1 to 30 epochs :
CHALLENGES
1. Limitation of Google API custom search to return only 10 images.
2. Compressing large size images before writing to disk.
3. Basic CNN model took more than 8 hours to run from scratch
4. The total images in all the classes should be same and the batch size should be the
GCD of total images in train and test classes.
5. Django installation and other software installations required lot of configurations in
GPU instance
6. Tried to install quiver engine for visualization of each convoluted layer.
Future Scope
1. Facial key point detection
2. Analysis of satellite images for disaster detection
3. Real Time Criminal Detection through Video analysis
4. And many more…
References
References:
https://districtdatalabs.silvrback.com/modern-methods-for-sentiment-analysis
https://www.zybuluo.com/HaomingJiang/note/462804
https://xkcd.com/1425/
http://cs231n.stanford.edu/reports/2016/pdfs/267_Report.pdf
https://en.wikipedia.org/wiki/Kernel_(image_processing)
https://adeshpande3.github.io/adeshpande3.github.io/A-Beginner's-Guide-To-
Understanding-Convolutional-Neural-Networks-Part-2/
http://culurciello.github.io/tech/2016/06/04/nets.html
https://en.wikipedia.org/wiki/Convolutional_neural_network
THANK YOU

Code & Report Available at: https://github.com/Lalit7Jain/ObjectClassification_CNN_Keras

You might also like