Full Text 02
Full Text 02
October 2022
Comparison of pre-trained
Convolutional Neural Network (CNN)
architectures for classification of organic
and recyclable materials from solid
waste.
The authors declare that they are the sole authors of this thesis and that they have not used
any sources other than those listed in the bibliography and identified as references. They further
declare that they have not submitted this thesis to any other institution to obtain a degree.
Contact Information:
Author(s):
Nandakishore Reddy Mandle
E-mail: nama21@student.bth.se
University advisor:
Dr. Sai Prashanth Josyula, Associate Senior Lecturer
Department of Computer Science
Background: Classification of organic and recyclable materials from the solid waste
is one of the primary challenges. Due to the world’s expanding population and ur-
banization, waste is growing at an alarming rate. As a result, waste classification
requires a significant amount of human effort and time. However, because of the
toxic materials present in the waste, this comes at a cost to human health. So the
goal of this thesis is to contribute towards automating the solid waste classification
process using computer vision techniques. In this study, Convolutional Neural Net-
work (CNN) architectures are used to build and automate an image classifier that
recognizes the object and determines the type of waste material, and find the best
efficient CNN architecture among the selected architectures.
Objectives: This thesis aims to select the best transfer learning algorithm for the
classification of organic and recyclable materials from solid waste. The selected
models are compared to find the efficient transfer learning architecture for classify-
ing images of solid waste into organic and recyclable.
Results: In this thesis, we have selected four transfer learning architectures namely,
DenseNet121, ResNet50, VGG19, and MobileNet. When compared to other archi-
tectures, VGG19 achieved high accuracy of 97.5% after testing and training the
architectures using the Kaggle data set.
Conclusion: The trained models for CNN architectures to classify organic and re-
cyclable materials from the images of solid waste. Upon experimentation with the
Kaggle dataset, VGG19 performed better than other architectures.
We are extremely grateful to our supervisor Dr. Sai Prashanth Josyula for help-
ing and meeting us throughout our thesis work. We sincerely thank our supervisor,
friends, and family who have been supportive throughout our research work.
Additionally, we would like to thank our examiner Prashant Goswami for his ongoing
encouragement and suggestions throughout the writing of this thesis. His lectures
on research methodology were very helpful to us in structuring the thesis completion.
Authors:
Nandakishore Reddy Mandle
Naga Veera Sai Ram Chikkala
ii
Contents
Abstract i
Acknowledgments ii
1 Introduction 3
1.1 Aim and Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.1 Aim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Research Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Outline of Thesis . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Background Work 6
2.1 Waste Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Deep learning . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Convolutional Neural Network . . . . . . . . . . . . . . . . . . . . . . 7
2.3.1 Layers of Convolutional Neural Network . . . . . . . . . . . . 8
2.3.2 Types of Convolutional Neural Network . . . . . . . . . . . . 9
2.4 Performance Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 Related Work 12
4 Method 14
4.1 Experimentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1.1 Experimental Environment . . . . . . . . . . . . . . . . . . . . 15
4.1.2 Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1.3 Exploratory Data Analysis (EDA) . . . . . . . . . . . . . . . . 17
4.1.4 Fitting the models . . . . . . . . . . . . . . . . . . . . . . . . 17
4.1.5 Performance analysis of the architectures . . . . . . . . . . . . 21
iii
6 Discussion 26
References 28
iv
List of Figures
1
Acronyms
AI Artificial Intelligence.
DL Deep Learning.
FN False Negative.
FP False Positive.
ML Machine Learning.
RQ Research Question.
TN True Negative.
TP True Positive.
2
Chapter 1
Introduction
The separation of waste and recycling is essential for a sustainable society [3]. Sep-
aration of waste is required before it becomes contaminated by other materials [3].
Waste classification can be done based on the type of garbage, biodegradable mate-
rials, and other factors [4]. The main goal of this thesis is to use computer vision
to classify organic and recyclable materials from waste using image classifiers. Com-
puter vision is a visual perception component of an ambitious agenda to mimic human
intelligence and to endow robots with intelligent behavior [5].
Organic waste refers to waste materials that are biodegradable and originate from
plants or animals [6]. Leftover food, eggshells, apple cores, fallen leaves, cut flowers,
untreated/unpainted woods, and so on are examples of organic waste [6]. Turning or-
ganic waste into resources has numerous environmental benefits. For example, these
organic wastes can be converted into nutrient- and protein-rich organic fertilizers,
which will help crops get all the nutrients and proteins they need, as they decom-
pose [7], biogas can be produced by anaerobic digestion of organic waste to provide
a versatile energy [8], and so on.
Recycling is a viable option for reducing waste, particularly in large areas where
waste is growing [9]. Recycling is the process of collecting and processing waste
materials to re-purpose them into new products [9]. Recycling materials has many
benefits, including reducing waste sent to landfills, conserving natural resources, sav-
ing energy, reducing pollution, and creating jobs [9]. Because natural resource usage
is increasing, future generations may lose their resources. Recycling helps to reduce
the collection of new resources [10].
Classifying organic materials and recyclable materials from the waste manually re-
3
Chapter 1. Introduction 4
quires a lot of human effort and time, this process can also be dangerous for human
health [11]. To resolve this problem, we can automate this process using computer
vision [5] to analyze and classify the organic and recyclable materials from the waste.
In computer vision, Machine Learning (ML) performs a significant role to extract cru-
cial information from images [12]. Machine Learning is a part of Artificial Intelligence
(AI), it allows computers to learn and think by themselves, and it performs tasks in a
similar way as humans do [13]. ML algorithms are divided into three sub-categories:
Supervised Learning, Unsupervised Learning, and Reinforcement Learning. Super-
vised ML uses labeled data sets, which allow the models to learn and improve over
time [13]. Unsupervised machine learning algorithms recognize previously unidenti-
fied patterns in data sets in order to derive rules from them [13]. Reinforcement ML
algorithms train models through trial and error to determine the best action based
on previous results [14].
1.1.2 Objectives
The main objectives of this thesis are:
1. To classify the images of solid waste into either of the two categories: "organic"
or "recyclable".
3. To find the efficient CNN architecture, among the selected architectures, that is
most suitable for classifying images of solid waste into organic and recyclable.
Chapter 1. Introduction 5
6
Chapter 2. Background Work 7
Consider customer purchase data, but humans cannot understand what types of pur-
chases and similar properties can be drawn from customer profiles. When this data is
fed into unsupervised learning, it may be determined that a woman of a certain age
who purchases unscented soaps is indeed likely to be pregnant. As a result, products
related to babies and pregnant women will be suggested to that target group.
Neural networks are layers of nodes that function in the same way that the human
brain is made up of nerves. The number of layers in the network indicates how
deep it is. Signals travel between nodes and are assigned weights. A node with a
higher weight will have a greater influence on the nodes below it. The last layer
combines the weighted inputs to generate an output [20]. There are various types of
DL algorithms. This study focuses on the Transfer learning algorithm.
The CNN’s job is to compress the images into a more manageable format while pre-
serving elements that are required for prediction. This is crucial when creating an
architecture that can learn features while also being scalable to large datasets. So, a
CNN is composed of three layers: the input layer, the hidden layers, and the output
layer, which are known as the convolutional layer, the pooling layer, and the fully-
connected layer, respectively. Each layer contains a collection of filters that detect
patterns or features in images.
Figure 2.1 illustrates how, after training, the CNN processes the input to produce
and evaluate output.
The result is known as the Feature map, and it contains information about the image
such as its corners and edges. This feature map is later transferred to other layers
in CNN to learn additional features from the input image.
Chapter 2. Background Work 9
Pooling that selects the maximum element from the region of the feature map covered
by the filter is known as max pooling. Average pooling computes the average of the
elements present in the filter’s feature map region. Global pooling reduces each
channel in the feature map to a single value.
Each of the following CNN architectures excels at extracting features from images,
detecting objects, detecting hidden patterns, and classifying them. Each architecture
has some pros and cons. So, we want to study how accurately each CNN architec-
ture performs and compare the architectures for the classification of organic and
recyclable materials from the images of solid waste.
that it has 8 times more depth than VGG, which only has 3 x 3 filters. ResNet50 is
made up of two layers: convolutional and pooling.
True Positive(TP): It is the case when the model correctly predicted positive out-
comes [28].
True Negative(TN):It is the case when the model correctly predicted negative
outcomes [28].
False Positive(FP): It is the case when the model incorrectly predicted positive
outcomes [28].
False Negative: It is the case when the model incorrectly predicted negative out-
comes [28].
TP
P= (2.1)
TP + FP
Recall R: The recall is determined by dividing the total number of positive samples
by the number of Positive samples that were correctly identified as Positive [28].
Equation2.2 defines the recall.
Chapter 2. Background Work 11
TP
R= (2.2)
TP + FN
Accuracy: Accuracy is defined as the ratio of the total number of true predicted
values to the total number of predictions. Accuracy is used for evaluating classifica-
tion models. The accuracy of the ML model indicates how many times it was correct
overall [28]. Equation2.3 defines the accuracy.
TP + TN
Accuracy = (2.3)
TP + FP + FN + TN
F1 Score: The F1-Score is calculated by taking the harmonic mean of precision and
recall and assigning equal weight to each [28]. A higher F1 score indicates better
performance from the classifier. Equation2.4 defines the F1 Score.
2XP XR
F1 Score = (2.4)
P +R
Chapter 3
Related Work
George E. Sakr et al [3] have carried out research on comparing deep learning al-
gorithms like Convolutional Neural Network (CNN) and Support Vector Machines
(SVM) to automate the classification of waste by using images. Using a 256 x 256
colored png image of the waste, each algorithm separates waste into three main cat-
egories: plastic, paper, and metal in this study. The accuracy of each algorithm
was compared to see which one was the most accurate, and SVM achieved higher
accuracy than CNN.
Sai Susanth G et al [16] have carried out research on Garbage Waste Segregation
by comparing deep learning algorithms such as ResNet50, DenseNet169, VGG16,
and AlexNet. The data used in this study is collected from Gary Thung and Mindy
Yang’s. DenseNet169 achieved a high accuracy rate and ResNet50 performed closer
to DenseNet169.
Victoria Ruiz et al [10] have carried out research on the automatic image-based
classification of garbage types. This study compared Convolutional Neural Network
(CNN) architectures: VGG, Inception, and ResNet. The trashNet dataset was used
to train and compare the VGG, Inception, and ResNet. This dataset contains RGB
images of six classes of waste: glass, paper, cardboard, plastic, metal, and general
trash. Each image has only one type of garbage. The Combined Inception-ResNet
model got high accuracy.
Arpit Patil et al [23] have carried out research to deal with garbage classification
using deep learning. The process is automated by building an image classifier using
a CNN, ResNet50, and VGG16. The trained models are then fed into a mobile ap-
plication that uses a camera to capture images in real time. The final result of this
thesis concludes that VGG16 outperformed other models.
12
Chapter 3. Related Work 13
Rahmi Arda Aral et al [26] carried out research on the classification of waste using
deep learning models. Densenet121, DenseNet169, InceptionResnetV2, MobileNet,
Xception architectures were applied for Trashnet dataset. Every image that was uti-
lized in this investigation had a single object against a white backdrop. Densenet121
received a high accuracy score of 95%. InceptionResnetV2 had a comparable score
of 94%.
In the research papers mentioned above, VGG16 and ResNet18 achieved high ac-
curacy. So, in this study, we decided to compare four CNN architectures, DenseNet121,
ResNet50, VGG19, and MobileNet, along with the above two architectures to classify
organic and recyclable materials from images of solid waste.
Chapter 4
Method
1. "waste classification" Dataset is used for this study which is gathered from the
Kaggle.
2. To conduct this study four transfer learning architectures are selected and used.
3. As a part of the study the different data pre-processing steps are applied to
the selected dataset.
5. The four algorithms have different performance metrics such as accuracy for
comparing them against each other.
14
Chapter 4. Method 15
4.1 Experimentation
4.1.1 Experimental Environment
The research takes place in the environments listed below. The four transfer learning
algorithms have different environments involved individually.
Google Colab: Google colab was created by Google. It is a jupyter notebook en-
vironment that entirely runs Python code in the cloud. It is best suited for machine
learning and data analysis. Colab, in more technical terms, is a hosted jupyter note-
book service that requires no setup and provides free access to computing resources
such as GPUs.
Matplotlib: Matplotlib is a Python library for low-level graph plotting and visu-
alization. For platform compatibility, a small portion of Matplotlib is written in C,
Objective-C, and JavaScript. The majority of the library is written in Python. The
matplotlib library is included using the statement "import matplotlib".
2. Data cleaning: Noise and inconsistencies can be found in the Kaggle data set
we downloaded. This data set can be filtered by eliminating the noise in the
data and dropping null values.
4. Splitting of data: Selected dataset is split into two parts, mainly called
training and testing where 80% of the data is considered as training and the
remaining as testing. In both training and testing, a batch size of 32 images is
sent with a categorical mode of the same target size ( 224,224).
5.1 Prediction
This section contains the predictions of the CNN architectures after fitting the data
set into each architecture. For comparison, four architectures are used: DenseNet121,
ResNet50, VGG19, and MobileNet. Each architecture’s performance metrics were
recorded and compared in order to determine the most efficient architecture for
classifying organic and recyclable materials from solid waste images.
22
Chapter 5. Results and Analysis 23
Figure 5.5: Representing a Line-graph about the results of the transfer learning
algorithm
Chapter 5. Results and Analysis 25
RQ: How effective are different CNN architectures such as DenseNet121, ResNet50,
VGG19, and MobileNet for classifying images of solid waste into two categories (or-
ganic and recyclable)?
Answer: An experimentation process is carried out above to answer the RQ. The
primary goal of the research is to select the most efficient CNN architecture from
the available architectures for classifying images of solid waste into two categories
(organic and recyclable). We created models for several CNN architectures, including
DenseNet121, ResNet50, VGG19, and MobileNet.A Kaggle data set is used, For data
validation, 5% of data is utilised. then data preprocessing is implemented and the
newly cleaned dataset is used for the training and testing of the model. To train
and test the chosen architectures, 80% of the data or 10104 images, is used for
training, while 20%, or 2526 images(i.e 1409 images are related to organic images
and 1117 images are related to recyclable images), are used to test the architectures.
We obtained accuracy for each architecture after execution. Accuracy was chosen
because it provides a more useful performance measurement for the target variable’s
categorical. DenseNet121 has a 94.51% accuracy, ResNet50 has a 93.6% accuracy,
VGG19 has a 97.5% accuracy, and MobileNet has a 92.73% accuracy. In comparison
to all other CNN architectures tested, the final result obtained by VGG19 has the
highest accuracy of 97.5%.
26
Chapter 7
Conclusions and Future Work
7.1 Conclusions
The goal of this study is to use transfer learning algorithms to classify waste into
organic and recyclable categories from images of solid waste. Our data was gathered
from Kaggle, an open-source data source. EDA is used to analyze the data. After
preprocessing, nearly 80% of the data is trained, and the remaining 20% is used for
testing. To predict the best accurate performing algorithm, the thesis includes a
comparative study of transfer learning algorithms such as DenseNet121, ResNet50,
VGG19, and MobileNet. The experimental results show that the VGG19 is the
best-performing algorithm with an accuracy of 97.5%.
27
References
[1] A. Demirbas, “Waste management, waste resource facilities and waste conversion
processes,” Energy Conversion and Management, vol. 52, no. 2, pp. 1280–1287,
2011.
[2] “Trends in Solid Waste Management.” https://datatopics.worldbank.org/what-
a-waste/trends_in_solid_waste_management.html (accessed May 28, 2022).
[3] G. E. Sakr, M. Mokbel, A. Darwich, M. N. Khneisser, and A. Hadi, “Comparing
deep learning and support vector machines for autonomous waste sorting,” in
2016 IEEE international multidisciplinary conference on engineering technology
(IMCET), 2016, pp. 207–212.
[4] M. Yang and G. Thung, “Classification of trash for recyclability status,” CS229
project report, vol. 2016, p. 3, 2016.
[5] R. Szeliski, Computer vision: algorithms and applications. Springer Science
Business Media, 2010.
[6] N. Nnamoko, J. Barrowclough, and J. Procter, “Solid Waste Image Classification
Using Deep Convolutional Neural Network,” Infrastructures, vol. 7, no. 4, p. 47,
2022.
[7] A. A. Kadir, N. W. Azhari, and S. N. Jamaludin, “An overview of organic waste
in composting,” in MATEC Web of Conferences, 2016, vol. 47, p. 05025.
[8] V. K. Vijay, R. Kapoor, A. Trivedi, and V. Vijay, “Biogas as clean fuel for cook-
ing and transportation needs in India,” in Advances in Bioprocess Technology,
Springer, 2015, pp. 257–275.
[9] O. US EPA, “Recycling Basics,” Apr. 16, 2013.
https://www.epa.gov/recycle/recycling-basics (accessed May 28, 2022).
[10] V. Ruiz, Á. Sánchez, J. F. Vélez, and B. Raducanu, “Automatic image-based
waste classification,” in International Work-Conference on the Interplay Between
Natural and Artificial Computation, 2019, pp. 422–431.
[11] W. Lu and J. Chen, “Computer vision for solid waste sorting: A critical review
of academic research,” Waste Management, vol. 142, pp. 29–43, 2022.
[12] A. A. Khan, A. A. Laghari, and S. A. Awan, “Machine learning in computer
vision: A review,” EAI Transactions on Scalable Information Systems, p. e4,
2021.
[13] J. Alzubi, A. Nayyar, and A. Kumar, “Machine learning from theory to algo-
rithms: an overview,” in Journal of physics: conference series, 2018, vol. 1142,
no. 1, p. 012012.
28
References 29