Application of Deep Learning Based on Garbage Image Classification
FENG LI, LINGLING WANG*
School of Management Science and Engineering
Anhui University of Finance and Economics
Bengbu 233030, CHINA
Abstract: - In recent years, with the rapid development of economy, the country's various construction is
thriving, and remarkable achievements. At the same time, resources and the environment have been seriously
damaged. This phenomenon is directly related to the irrationality of garbage classification and delivery, and the
contradiction between the two is becoming increasingly acute as people strongly reflect the problem of
environmental pollution but do nothing about it. This paper designs a garbage image classification system
based on deep learning, the main research content is to compare multiple deep learning neural network models,
find the optimal classifier, develop web applications and deploy neural networks, which includes image data
acquisition, image pre-processing, and comparison of VGG16, Inception, and Resnet neural network model
accuracy
Key-Words: Garbage Image Classification; Deep Learning; VGG16; Inception.
Received: September 19, 2021. Revised: May 17, 2022. Accepted: June 13, 2022. Published: July 15, 2022.
1 Introduction
At present, the main way of garbage
classification is that residents consciously classify
garbage when they dump it and throw it into the
corresponding garbage [1-3]. However, this garbage
classification method based on residents'
consciousness is difficult to be deeply implemented,
and residents cannot accurately distinguish the types
of recyclable garbage and classify each kind of
garbage in detail [4]. Through some city residents
forced garbage classification in recent years, but
through a period of implementation, the effect is not
good, most of the general public is not entirely
correct in classifying rubbish, so to enforce garbage
classification was fined not only let the masses
themselves, and also for the recyclable garbage
classification is not too big effect [5].
Therefore, it is not an effective method to
classify garbage solely by the waste producers'
consciousness. Instead, it should be simply
classified by the waste producers, then the waste
recycling plant will carry out detailed garbage
classification and classify and treat the recyclable
garbage [6]. Garbage problem is increasingly
serious, with the rapid development of economy, the
urbanization process is gradually accelerating,
people's living water. In order to meet people's
growing needs for life, a variety of diversified
commodities and articles of daily use have been
pouring in. This is followed by an increasing
amount of household garbage, which has caused
great pressure on the environment. Some cities have
already seen garbage [7]. The phenomenon of siege,
garbage classification is a reform of the traditional
way of garbage collection and disposal, is an
effective disposal of garbage management methods.
How to deal with recyclable waste is a major
research issue globally. The classification and reuse
of recyclable garbage is an important link between
resource recycling and reuse [8]. The effect of
garbage resource recycling is closely related to the
quality of garbage classification. Rapid and
effective garbage classification can greatly reduce
the environmental pollution and resource waste
caused by garbage. The classification of recyclable
garbage by deep learning has the characteristics of
high precision, fast speed and high adaptability [9]
[10]. The establishment of a precise garbage
WSEAS TRANSACTIONS on COMPUTERS
DOI: 10.37394/23205.2022.21.34
Feng Li, Lingling Wang
E-ISSN: 2224-2872
277
Volume 21, 2022
classification system can not only help garbage
recycling plants to carry out garbage classification,
because of its simple operation, but also help people
to identify the types of recyclable garbage, help
them to accurately put garbage, and realize the
intelligent development of garbage classification.
An automated machine that can automatically
sort recyclable garbage [11]. The machines input
images from external devices, such as cameras, and
then calculate the types of garbage using a deep
learning network inside the machine. At the time,
however, the machine could only sort the valuable
rubbish from the huge amount of rubbish waiting to
be sorted, not really sort the huge amount of rubbish.
Subsequently, computer vision technology has been
widely applied to image detection and classification
in the academic world, and computer vision is used
to classify various objects in the industry. However,
due to the diversity of recyclable garbage, mature
garbage classification algorithm is still a difficult
problem. Plastic accounts for a large proportion of
recyclable waste, and the accuracy of a traditional
computer vision-based algorithm for classifying
plastic bottles is greatly reduced due to the
transparent nature of plastic and the complex
background of garbage classification [12]. Later, a
plastic sorting method based on infrared spectrum
analysis equipment was also proposed, but this
equipment is relatively expensive, so it is not
suitable for large-scale commercial use. It can be
seen that the traditional computer vision is not ideal
for the classification of recyclable garbage. On the
one hand, the identification accuracy is not high
enough; on the other hand, the classification cost is
too high, which is not suitable for large-scale
application in manufacturers.
2 Overview of Deep Learning
Deep Learning is a kind of neural network
technology. Its most revolutionary point is that as
long as there is enough learning data, the neural
network itself can automatically extract the features
of the data group. The analysis of images and data
before this requires the operation of the extraction
algorithm according to each data and problem.
However, deep learning does not require manual
operation, but automatically extracts features.
Slightly crudely, this is what it means: simply inject
data into a neural network and you can extract any
feature you want.
A neural network is a network of connected
brain nerve units that mimic neurons [13]. The input
signal is propagated. One of the characteristics of
this method is that each layer of neural network can
be phased learning. For example, let the first layer
learn to output the input information as is, let the
second layer learn to reproduce the input in the
same way on the basis of the first layer, the third
layer after the same operation. Deep learning is best
at pattern recognition of data that cannot form
symbols, such as image data and waveform data,
and stage learning after inputting images through
the input layer. The commonly used neural network
is a perceptual neural network with all layers
connected together. But in the case of image
recognition, it is easier to adopt a special connection
method. This is called a convolutional neural
network. It is the prototype of deep learning. It is
characterized by a multi-scale intermediate layer for
different size segmentation of input data and feature
extraction. Input an image of a car, for example, and
you can extract everything from detailed patterns to
large structures and overall Outlines.
Deep learning is a division in the field of
artificial intelligence as a whole. Some researchers
believe that the neural network before deep learning
has made a leap forward, but there is still some gap
between it and the social cognition that suddenly
approaches human beings [14]. Moreover, it takes
time and stages to reach a point where it is truly
useful to society. At present, the development of
technology for practical purposes in many fields is
proceeding rapidly all over the world. In particular,
the neural network is characterized by the repetition
of market calculation and the large number of
parallel calculations. As a result, graphics boards
equipped with gpus, which support the gaming and
computer graphics industries can be used.
In a word, deep learning can help us classify
recyclable garbage reasonably and efficiently, and
create a society in which garbage resources can be
reasonably reused and resources can be fully
WSEAS TRANSACTIONS on COMPUTERS
DOI: 10.37394/23205.2022.21.34
Feng Li, Lingling Wang
E-ISSN: 2224-2872
278
Volume 21, 2022
recycled. Deep learning technology has a mature
application case in the field of classification of
various images, so it is feasible to use neural
network for garbage classification technically. At
the same time, the classification accuracy of garbage
image is low by using traditional image processing
methods, but the classification of garbage image by
using deep learning can quickly improve the speed
and accuracy of garbage image classification.
3 Proposed Method
Convolutional neural network is an important
component of current deep learning [15].The
emergence of convolutional neural network and
back propagation algorithm makes deep learning
and artificial intelligence enter a new stage of
development. Convolutional neural network is
designed after the structure of biological neurons. It
is generally divided into convolution layer, pooling
layer, full connection layer, activation function, loss
function and random inactivation.
Convolutional neural network can extract
features through the sliding window in the
convolutional layer, and then summarize the
extracted features through the full connection layer,
which accounts for a large proportion of the
parameters of the whole neural network. Then the
pooling layer is responsible for compressing and
simplifying the matrix of the output of the previous
hidden layer, so as to facilitate feature sampling.
Finally, the output of convolutional neural network
similar to image classification cannot be directly
utilized by us, but the output of the model should be
transformed into various categories through the
model structure similar to classifier.
The loss function, the activation function and
the random inactivation is a part of the model
control effect, loss function is the key to the
convolution back propagation neural network
model, through calculating the loss function, the
model can be error between the predicted value and
actual value, which based on loss function to adjust
the parameters in the model. Activation function is
to prevent only linear changes in the whole model.
The whole network can not change in a linear
direction through activation function. Typical
activation functions include Sigmod function and
Relu function. Random inactivation function will
randomly discard some parameters, so that the
whole network will not overfit in the training
process..
After obtaining the data that can be used for
testing, three models VGG16[16], Xception[17] and
InceptionResnetv2 are respectively used for transfer
learning in order to obtain better detection effect,
and the optimal model is selected by comparison.
Finally, InceptionResnetv2 was selected as the
model according to the average accuracy and
prediction speed of the model.
In order to extract image features more
effectively, Inception module uses a structure that
combines several different convolution operations in
parallel to extract image features more effectively.
But the corresponding tighter module also makes
the parameters of the module larger. At the same
time, the Resnet structure can not only accelerate
the training speed, but also simplify the complexity
of the model and prevent the gradient diffusion.
The author of the model combined Resnet and
Inception structures, so that the model would not
have a large increase in the number of parameters
without reducing the accuracy of the model,
resulting in high training costs. Figure 1 shows the
model structure.
This model is continuously iterated from
Inception series models, and combined with Resnet
residual network, a downsampling structure is added
to increase model parameters so as not to cause
explosive growth of model parameters. The model
starts with a 299×299 pixel RGB image input
through the Stem structure of the first layer, which
includes multiple convolution processes and merge
operations. The matrix data through Stem will enter
the following multiple Inception-resnet structures.
The general principle of these structures is the same.
They are all carried out in parallel by multiple
convolution operations, and then merged. At the
same time, the Inception-resnet module is different
from the previous Inception module in that it adopts
the residual structure, which greatly reduces the
WSEAS TRANSACTIONS on COMPUTERS
DOI: 10.37394/23205.2022.21.34
Feng Li, Lingling Wang
E-ISSN: 2224-2872
279
Volume 21, 2022
Fig.1. Overviewof InceptionResnetv2
time required for training the model and achieves
higher accuracy in fewer epoches.
In the final Average Pooling operation, the
Average Pooling structure carries out the Average
sampling operation on the model of the upper layer,
which replaces the fully connected layer and greatly
reduces the number of parameters of the model.
Finally, the one-dimensional parameters after
average pooling are transferred to the linear
classification layer of the network through Dropout
processing. Finally, Softmax function is used to
normalize the obtained parameters, and finally the
probability values of different types of model
prediction are obtained.
4 Experimental
In this section, we firstly collect the recyclable
garbage data, and then data preprocessing is to
convert the original obtained data into the data
format that meets the requirements of the project
through a series of transformations.
4.1 Data Collection
In order to obtain the common recyclable
garbage data, and the garbage data acquisition and
pretreatment, in order to obtain qualified data set, so
as to carry out the training and construction of
identification system. The main collection methods
are as follows:
(1) Crawler acquisition: Requset + Selenium is
used to obtain image data from large search
websites such as Baidu by directly searching target
items and crawling them with Python crawlers. The
data crawled by crawler are generally messy and
need to be manually cleaned to delete pictures of
non-target objects and repeated pictures.
(2) Related projects: Transplant the data used
in part of the old garbage identification system.
Clean data, do not need too much cleaning, storage
by category.
(3) Data filling: For the above two methods to
obtain a sufficient number of garbage categories, we
use to search some well-known image online and
second crawler to fill the database imbalance.
After obtaining the summary data, we obtained
a total of 17,088 pictures, including 24 categories,
respectively: Pans, cutting boards, leather shoes,
bottle, bag, pillow, beverage bottle, socket, old
clothes, cans, charging treasure, cardboard boxes,
glasses, condiment bottles, plastic bowl bowl,
plastic hangers, plastic toys, plug wire, shampoo
bottle, plush toys, cosmetics bottles, Courier bags,
metal food cans, food cans, are common in daily life
of recycled garbage.
4.2 Data Processing
Data preprocessing is to convert the original
obtained data into the data format that meets the
requirements of the project through a series of
transformations. Whether the data format is correct
or not has a crucial impact on the accuracy of model
WSEAS TRANSACTIONS on COMPUTERS
DOI: 10.37394/23205.2022.21.34
Feng Li, Lingling Wang
E-ISSN: 2224-2872
280
Volume 21, 2022
training. After obtaining 24 categories of data, 24
folders are read respectively, and a series of
operations are carried out on the data in them to
produce data sets that meet the requirements of the
model.
(1) Image renaming. Through traversing each
image under 24 folders, all the images are stored in
the format of category name + serial number, and all
the serial numbers are stored in the format of five
digits (all the insufficient digits are filled with 0).
Data preprocessing is to convert the original
obtained data into the data format that meets the
requirements of the project through a series of
transformations. Whether the data format is correct
or not has a crucial impact on the accuracy of model
training. After obtaining 24 categories of data, 24
folders are read respectively, and a series of
operations are carried out on the data in them to
produce data sets that meet the requirements of the
model.
(2) Image renaming. Through traversing each
image under 24 folders, all the images are stored in
the format of category name + serial number, and all
the serial numbers are stored in the format of five
digits (all the insufficient digits are filled with 0).
4.3 Experiment results
The training results of the model need certain
evaluation standards. Firstly, a new validation data
set should be created in addition to the training data
set of the model to verify the accuracy and loss
value of the model. When verifying the accuracy of
the model, the data set during the training of the
model cannot be used, because the model may have
over-fitting, that is, the model has a very high fitting
degree to the training data, but the prediction
accuracy of the data other than the training data
used is very low, or even cannot be fitted basically.
Therefore, a separate validation dataset needs
to be created to calculate the exact results of the
model. InceptionResnetv2 has a detection accuracy
of 89% and a loss value of 0.8. Compared with the
above two migration models, InceptionResnetv2 has
better detection performance, as shown in Fig.2.
Fig. 2. Experiment results
5 Conclusions
In this paper, we design a garbage image
classification system based on deep learning
method, the main research content is to compare
multiple deep learning neural network models, find
the optimal classifier, develop web applications and
deploy neural networks, which includes image data
acquisition, image pre-processing, and comparison
of VGG16, Inception, and Resnet neural network
model accuracy
Acknowledgment
We thank the anonymous reviewers and editors
for their very constructive comments. This work
was supported in part by the Natural Science
Foundation of the Higher Education Institutions of
Anhui Province under Grant No. KJ2020A0011,
WSEAS TRANSACTIONS on COMPUTERS
DOI: 10.37394/23205.2022.21.34
Feng Li, Lingling Wang
E-ISSN: 2224-2872
281
Volume 21, 2022
Innovation Support Program for Returned Overseas
Students in Anhui Province under Grant No.
2021LCX032. the Science Research Project of
Anhui University of Finance and Economics under
Grant No. ACKYC20085, Undergraduate teaching
quality and teaching reform project of Anhui
University of Finance and Economics under Grant
No. acszjyyb2021035.
References:
[1] Szaky, Tom. Outsmart waste: The modern idea of
garbage and how to think our way out of it. Berrett-
Koehler Publishers, 2014.
[2] Anantharaman, Manisha. "Networked ecological
citizenship, the new middle classes and the
provisioning of sustainable waste management in
Bangalore, India." Journal of Cleaner Production 63
(2014): 173-183.
[3] Okwesili, Joseph, and Chidi Iroko. "Urban solid
waste management and environmental sustainability
in Abakaliki Urban, Nigeria." European Scientific
Journal 12.23 (2016).
[4] Tai, Jun, et al. "Municipal solid waste source-
separated collection in China: A comparative
analysis." Waste management 31.8 (2011): 1673-
1682.
[5] Meng, Xiaoyan, et al. "Investigation on decision-
making mechanism of residents’ household solid
waste classification and recycling behaviors."
Resources, Conservation and Recycling 140 (2019):
224-234.
[6] Gille, Zsuzsa. From the cult of waste to the trash
heap of history: the politics of waste in socialist and
postsocialist Hungary. Indiana University Press,
2007.
[7] Junk, Wolfgang J., et al. "Current state of
knowledge regarding the world’s wetlands and their
future under global climate change: a synthesis."
Aquatic sciences 75.1 (2013): 151-167.
[8] Singh, Jagdeep, and Isabel Ordoñez. "Resource
recovery from post-consumer waste: important
lessons for the upcoming circular economy." Journal
of Cleaner Production 134 (2016): 342-353.
[9] Bircanoğlu, Cenk, et al. "RecycleNet: Intelligent
waste sorting using deep neural networks." 2018
Innovations in intelligent systems and applications
(INISTA). IEEE, 2018.
[10] Sudha, S., et al. "An automatic classification method
for environment: Friendly waste segregation using
deep learning." 2016 IEEE Technological
Innovations in ICT for Agriculture and Rural
Development (TIAR). IEEE, 2016.
[11] Gundupalli, Sathish Paulraj, Subrata Hait, and Atul
Thakur. "A review on automated sorting of source-
separated municipal solid waste for recycling."
Waste management 60 (2017): 56-74.
[12] Villanueva, Alejandro, and Peter Eder. "End-of-
waste criteria for waste plastic for conversion."
Institute for Prospective Technological Studies
(2014).
[13] Neelakanta, Perambur S., and Dolores F. De Groff.
Neural network modeling: Statistical mechanics and
cybernetic perspectives. CRC Press, 2018.
[14] Mascagni, Pietro, et al. "Artificial intelligence for
surgical safety: automatic assessment of the critical
view of safety in laparoscopic cholecystectomy
using deep learning." Annals of surgery 275.5
(2022): 955-961.
[15] Bashar, Abul. "Survey on evolving deep learning
neural network architectures." Journal of Artificial
Intelligence 1.02 (2019): 73-82.
[16] Simonyan, Karen, and Andrew Zisserman. "Very
deep convolutional networks for large-scale image
recognition." arXiv preprint arXiv:1409.1556
(2014).
[17] Chollet, François. "Xception: Deep learning with
depthwise separable convolutions." Proceedings of
the IEEE conference on computer vision and pattern
recognition. 2017.
Sources of funding for research
presented in a scientific article or
scientific article itself
Creative Commons Attribution License 4.0
(Attribution 4.0 International, CC BY 4.0)
This article is published under the terms of the Creative
Commons Attribution License 4.0
https://creativecommons.org/licenses/by/4.0/deed.en_US
WSEAS TRANSACTIONS on COMPUTERS
DOI: 10.37394/23205.2022.21.34
Feng Li, Lingling Wang
E-ISSN: 2224-2872
282
Volume 21, 2022