The Development of Real-Time Mobile Garbage Detection Using Deep Learning

Received November 24, 2021 Revised December 30, 2021 Accepted January 02, 2022 The problem of garbage in the world is a serious issue that must be solved. Good garbage management is a must for now and in the future. Good garbage management is accompanied by a system of classification and sorting of garbage types. This study aims to create a mobile-based application that can select the type of garbage and enter the garbage data into a database. The database used is a Google SpreadSheet that will accommodate data from the output issued by the garbage detection mobile application. The image data used in this study amounted to 10108 images and was divided into six different garbage classes. This study uses a deep learning platform called densenet121 with an accuracy rate of 99.6% to train the image data. DenseNet121 has been modified and added an optimization based on a genetic algorithm. The genetic algorithm applied in the optimization uses four generations. The model resulting from the training of the two approaches is converted into a model that mobile applications can access. The mobile application based on a deep learning model accommodates the detection data of the type of garbage, the level of detection accuracy, and the GPS location of the garbage. In the final experiment of the mobile application, the delay time in sending data was very fast, which was less than one second (0.86s).


INTRODUCTION
Garbage and waste management have complex problems. World data shows that garbage production throughout 2018 reached 2.01 billion metrics [1]. Processing and handling garbage is an essential aspect in reducing the growth rate of garbage production. Garbage processing is based on [2] using biochemical methods that utilize the performance of enzymes. In line with that, based on [3], the research of garbage treatment use biological creatures for garbage management. However, before processing either biologically, mechanically, or chemically, it is necessary to filter the types of garbage based on their characteristics. Several garbage classification approaches have been used in recent years, including [4][5] [6] [7][8] that uses artificial intelligence implementation, and the fuzzy approach [9]. In line with garbage image classification, ref. [10] uses artificial intelligence to detect garbage with objects detection systems with aerial vehicle devices.
Garbage classification methods become more efficient when they can be directly applied in daily use. Some implementations of garbage sorting applications are using IoT [11], mixing fuzzy and IOT [12], and merging deep learning and IoT [13]. The merger between deep learning and deep IoT-based [13] requires many devices and tends to be less practical for direct implementation. The database for IoT in the study of [14] uses MySQL, which tends not to be widely used. As in [15], other database storage models use PostGIS as the database platform. The platform is centralized on a server and has high complexity.
On the other hand, many waste selection systems use applications with a relatively high difficulty level. As in the paper [16], it uses many sensors to identify garbage. This tends to reduce the user's level of practicality. Another implementation, according to [17], another performance collects the garbage using a mobile robot. Although the driverless robot approach has several benefits, it tends to be less practical for the wider community. Data from [18], mobile cellular users globally in 2016 reached 7 billion users. According to [19], many people have always checked and used mobile phones in recent times that can be concluded that most people use mobile phones or smartphones. Using a mobile application as a garbage detector is very practical because the broader community worldwide uses mobile phones.
Based on the research studies carried out on the garbage detection method, the researchers used a deep learning approach and a real-time database as the basis for the mobile application. The database used is a database that can be used widely and is easy to use. The database used is Google SpreadSheet, which is integrated with Google Scripts. Combining these models is expected that the resulting application will have a high classification level and good practicality value. Therefore, the contribution of this research is to create a mobile-based application to classify and store the garbage data found.

METHOD
The research method in this paper uses a deep learning approach and a database approach. The main components in this system are models of deep learning training results, Google Script programs, and Android applications. The flowchart of the two methods can be seen in Fig. 1(a) and Fig. 1 As shown in Fig. 1, the flowchart is divided into two methods, namely the deep learning approach method and the Android application performance. The first method, deep learning training, uses a DenseNet platform that has been programmed with a genetic optimization algorithm. The images used in this training are 10108 images divided into 9095 as training and 1013 as testing. During the cycle, GA delivers and stores the best models of each generation. This best model is used as a reference model, which is converted to .tflite so that Android applications can use it.
Meanwhile, the working process of the android application starts by asking for permission to access GPS, Camera, and network. Then, an android application based on a deep learning model is run by classifying the images obtained from the camera in real-time. The classification data is sent together with GPS data where the garbage is located. The data will later trigger Google Script on Google SpreadSheet as data storage.

Data Acquisition
The data acquisition in this study used a database based on [20]. The original image in the database reached 2527, consisting of 6 different classes (cardboard, glass, metal, paper, plastic, and trash). Following the research flow on [4], the images are given treatment in rotation and reversal. Thus, the total number of images used in the training data will be 10108. The data distribution for training and testing is 9095 images for training or 90%, and 1013 images for tests, or 10%. A sample image of the garbage dataset is shown in Fig. 2.   Fig. 2. Example images of garbage database

Deep Learning
One of the methods in artificial intelligence is deep learning. Deep learning is gaining momentum and spreading rapidly to solve digital image and video problems [21]. Deep learning in recent years has been used in image classification tasks [22][23] [24], and object detection [25][26] [27]. This study uses DenseNet, based on [24], to conduct deep learning training. The accuracy and loss of deep learning algorithm based on [28] can be calculated using formula as follow: (2)

Genetic Algorithm
In a competitive environment, the genetic algorithm (GA) is the natural way for the stronger creature to win in a competing nature. There are three essential operations in GA, including Selection, Crossover, Mutation [29]. The generation iteration will be completed in the genetic algorithm approach when the best solution is obtained. In this study, the authors used four generations for the genetic algorithm. The genetic algorithm is used to search and give an initial configuration of the flattening layer in deep learning.

Android Application and Google Script Database
The process of making android applications in this study uses Android Studio software. The android application uses the TensorFlow lite base platform, which is available openly. The update innovation in this application is found in Google Script as a data input trigger for the database. The data sending from the Android application to the database using the Jason format data type.

RESULTS AND DISCUSSION
This study uses the same model as [4] with DenseNet121 and GA. DenseNet121 has four Dense Blocks. Each Dense Block has two sizes of a convolutional layer, and each convolutional layer has three sequences of Batch Normalization, ReLu, and Convolutional. The densenet121 structure with GA optimized can be seen in Fig. 3. The DenseNet architecture in Fig. 3. depicts a general DenseNet architecture with four output layers. The genetic algorithm will later assign these four output layers an initial value. This initial value will undergo mutation and crossover for four generations. Therefore, the DenseNet accuracy value will vary based on the configuration. The accuracy with the highest value will be concluded as the best configuration of a generation. This accuracy model will be used as a reference model for the application.  Table 1 shows that denseNet121 from previous research [4] overcomes other research according to the garbage database. The model with the higher results was obtained using Python programming to convert it into a TensorFlow Lite model. This converted model is used as a reference model for the mobile application. 95% 2527 10+100 DenseNet169 [33] 95% 2527 7+120 Inception V4 [33] 89% 2527 10+200 Inception V4 [33] 94% 2527 7+120 MobileNet [33] 84% 2527 10+200 DenseNet121 + GA model [4]

99.60%
10108 image 40 94.02% 2527 image 40 The Android application development begins by converting the best model results that have been trained by densenet121 and optimized by GA. This model conversion is done using python programming, consisting of several libraries to make the final result a TensorFlow Lite model. The model results in a TensorFlow lite file are used as a reference for the android application model.
The Android-based mobile application is developed using the Android Studio software and refers to the sample program from TensorFlow. Next, a script from Google Script is added and used as a database input trigger. The database system will automatically record the location of the garbage, the type of garbage, and the percentage of detection. Fig. 4. (d)-(f) illustrates the image capture process from an application that has been installed on a mobile phone and automatically sends classification data to the database.  The speed of sending data in the Google SpreadSheet database is less than 1 second on average. The average and the results of the data transmission rate on Google SpreadSheet can be seen in Table 2. The data transmission speed is calculated based on the time of receiving and sending garbage data from the application to the database. In Fig. 5, ten original objects from different garbage dataset categories were tested for classification. As a result, there were three misclassification images and seven well-detected images. So, it can be concluded that the actual detection accuracy reaches 70%.

CONCLUSION
A real-time mobile garbage detection using deep learning and a simple database has been successfully developed. The model was used in this research is achieve higher accuracy with 99.6%. However, the actual detection only reaches 70% when implemented in a mobile phone with a garbage detection application installed. The mobile garbage application stored the detection data on the Google SpreadSheet with an average time of 0.86 s. Furthermore, the mobile garbage application can be further invented using another deep learning approach or database storage.