Himanshu Gupta Configuration Manual
Himanshu Gupta Configuration Manual
Himanshu Gupta
Student ID: x18203302
School of Computing
National College of Ireland
I hereby certify that the information contained in this (my submission) is information
pertaining to research I conducted for this project. All information other than my own
contribution will be fully referenced and listed in the relevant bibliography section at the
rear of the project.
ALL internet material must be referenced in the bibliography section. Students are
required to use the Referencing Standard specified in the report template. To use other
author’s written or electronic work is illegal (plagiarism) and may result in disciplinary
action.
Signature:
Attach a completed copy of this sheet to each project (including multiple copies). □
Attach a Moodle submission receipt of the online project submission, to □
each project (including multiple copies).
You must ensure that you retain a HARD COPY of the project, both for □
your own reference and in case a project is lost or mislaid. It is not sufficient to keep
a copy on computer.
Assignments that are submitted to the Programme Coordinator office must be placed
into the assignment box located outside the office.
Date:
Penalty Applied (if applicable):
Configuration Manual
Himanshu Gupta
x18203302
1 Introduction
This manual presents the system configuration required to run the submitted project. It
contains all the packages, libraries, and programming codes written and used during the
project implementation of : ”Trash Image Classification System using Machine Learning
and Deep Learning Algorithms”.
2 System Configurations
2.1 Hardware
Following Hardware configuration used:
RAM:8GB System type: Macintosh 64 bit Processor: Dual-Core Intel Core i5
CPU:1.8GHz Storage:1 TB HDD GPU::Intel HD Graphics 6000 1536 MB.
2.2 Software
• PyCharm: It is an IDE that is majorly used to run the python code. Two ver-
sions are there one is professional and one is community version. For this project
Community edition has been downloaded from this website1.
• Google Colaboratory: Also known as Colab, this is an online cloud service
that provides an environment to run your Jupyter notebooks freely. All the basic
packages for machine learning problems are already installed in the environment
like TensorFlow, Keras, pandas, and user needs to import these packages according
to their usage. However, to run a specific version of software the version should be
mentioned in the notebook before calling their functions. Three modes are provided
to run the notebook which are None, GPU, and TPU. GPU setting was used to
execute the notebooks. Authenticated google drive access is necessary to access
Colab. Sometimes GPU is available for limited usage per day and in that case,
None can be selected in the settings as shown in Figure 1.
1https://www.jetbrains.com/pycharm/
1
Figure 1: Settings: Google Colaboratary
3 Project Development
The main steps in this research development are data pre-processing( data downloading,
data analyses, new data structure creation, removing unwanted columns), conversion
from image to NumPy arrays, creating dummy variables, data split, data array reshaping
for each model, data normalization in several stages. Several codes have been written
for successfully performing and evaluating all the experiments such: creating a baseline
Sequential Keras, ResNet-50, VGG-19 neural network, adding several layers with different
weights and defining training parameters, selecting hyper-parameters for the XGBoost
model. Writing codes for running all the models at different k-folds for cross-validation,
changing sample size and many epochs, creating classification matrix, training testing
accuracy, and plotting evaluation graphs.
2http://tacodataset.org/
3
https://github.com/pedropro/TACO/blob/master/data/annotations.json
4https://github.com/pedropro/TACO/blob/master/download.py
2
Figure 2: Annotation file path
3
Figure 4: First Part of the script which create data frame with selective five categories
and remove duplicate values from the data
In the continuation of above script, after creating the initial data frame augmented data
generated through the script.
• A free open source Python image library ’PIL’ has been imported.
• Image cropping, Rotation, Gaussian blur ,horizontal flip functions applied to get
these four types of images.
• Images belongs to ’Drink Can’ and ’Plastic Straw’ were very lessor as compare to
other categories and therefore another set of vertical flipped images generated for
these two categories.
The code snippet is shown in Figure 7. Generated data further divided into train and
test dataset using scikit-learn which is a machine learning open-source library.
4
Figure 5: Initial data frame saved into CSV file which used by various base model
5
Final data has saved into csv file format in the main directory folder and data has
been fetched from there while implementing the model.
6
Figure 9: Required Libraries
Figure 10: Keras Sequential model baseline structure from the scratch
7
Figure 11: Keras Early stopping package imported and use to stop the training if it is
not improving to same the computational and time cost. Also, for overfitting the model
8
4.2 Experiments with ResNet-50 Model
The code for ResNet-50 model initialisation is shown in Figure 15. The weights for the
ResNet which trained on ’imagenet’ has downloaded in the model call. The first layer of
the model is not trainable because it has already trained on imagenet. The summary of
the model is shown in Figure 16. Import ResNet-50 model from keras application which
will load the ResNet-50 object during the initialisation call.
After plotting all the evaluation plots the confusion matrix created using sklearn
metrics plot of confusion matrix. The code reference for plotting the confusion matrix is
referred from 5
5https://analyticsindiamag.com/transfer-learning-for-multi-class-image-classification-using-deep-
convolutional-neural-network/
9
Figure 17: Confusion Matrix Code
In Figure 21 the code for converting the input train and test array into features
according to the format required by VGG-19.
10
Figure 20: Trainable and Non-trainable parameters of VGG-19 Model
11
Figure 21: Converting to VGG-19 input features
12
Figure 23: Data conversion to csv before fetching for the model training. DMatrix
optimization method applied on input dataset
13
Figure 25: XGBoost Model Evaluation on unseen data for obtaining the classification
report
Figure 26: Log loss function calculation using xgboost cross validation method
14