Keywords

1 Introduction

Waste is one of the common problem that government has been faced from time to time in every city in Indonesia, especially Jakarta. In 2003, Jakarta has produced 5000 tons of waste in a day from their citizen which is approximately 10 million. Even, Indonesia has reached 100.000 tons in a day and it increases every year by 4% [1], and it requires government concern to overcome this problem. It makes the government must work hard to overcome this problem.

Waste is divided into organic and inorganic based on content and degradation level. Organic waste contains organic compound and easy to be degraded like leaf litter and leftovers. While, inorganic waste is the reverse of organic waste, it does not contain organic compound and hard to be degraded like plastics and cans [2]. Organic and inorganic waste should be disposed and placed in different places, because some of the waste may contain any poisonous material which can harm the environment. However, in some place organic and inorganic waste separation has not been handled properly because it is often found waste are mixed in the same bin. It happens because people still have difficulty in determining whether a waste is organic or inorganic. Therefore, it is required a tool that can assist people to separate organic and inorganic waste automatically.

Previous researchers had been proposed some techniques in waste separation. Salmador et al. (2008) proposed K-Nearest Neighbor (KNN) to separate household and industrial waste which is applied in robot. Another researcher proposed mechanical approach to sort solid waste such as metal, plastic, glass, paper and old tiers to be recycled [3]. Intelligent system also be applied by previous researcher to separate inorganic such as aluminum cans, plastic bottles and plastic cutleries. They applied computer vision approach and KNN to identify type of wastes [4]. Waste separation especially in Indonesia, needs a system to recognize organic and inorganic automatically. Based on previous researches, it is found that researchers only proposed technique to recognized inorganic waste. Therefore, this paper presents a technique to identify organic and inorganic by using computational intelligence especially Backpropagation Neural Network (BPNN) and Particle Swarm Optimization (PSO).

BPNN is one of the most popular technique in recognition [5,6,7,8] which is implemented in machine, health, voice recognition and electrical field. BPNN is a suitable approach for modeling behavior of a system even if the data are affected by noise [9, 10]. However, BPNN encounters drawback due to random initial weight which affects to local minimum and bad convergent velocity [11]. Therefore, it is important to optimize initial weight of BPNN to overcome this weakness. PSO is one of the optimization technique that can be used in initial weight optimization.

PSO is a recognition algorithm that can find a set of unknown parameter better [12]. Compared to Genetic Algorithm (GA), PSO has a better performance since PSO has the ability to do global and local search simultaneously [13]. Moreover, PSO has some advantages like easy to be implemented and more flexible in maintaining the balance of global and local search from their search space [14].

This paper presents a technique to recognize organic and inorganic waste by using waste images as the input. Computer vision approach is implemented to process raw image data to obtain features which can be used as input in hybrid PSO-BPNN. This paper is arranged as follows; Section 1 explains problem background and current research in waste identification, Sect. 2 discusses about data collection and analysis, Sect. 3 describes proposed methodology which follows with result and discussion in Sect. 4. Finally, conclusion will be represented in Sect. 5.

2 Image Collection and Preprocessing

This research uses organic and inorganic waste images as the data which is usually found around college. Total data collected are 40 images namely 20 organics and 20 inorganics image with dimension \( 960 \times 700 \). Organic data consist of paper, tissue, leaf and box of milk (see Fig. 1) where inorganic data consist of plastic, can and bottle (see Fig. 2). Each image will pass preprocessing for instances; grayscaling, edge detection and feature extraction before used as input data.

Fig. 1.
figure 1

Organic waste

Fig. 2.
figure 2

Inorganic waste

First step of image pre-processing is Grayscaling, this process will change the image which contain 3 layers of color to grayscale image which contains only one layer of color (see Fig. 3). The formula to convert color image to grayscale image is given as follows [15]:

Fig. 3.
figure 3

Image before grayscaling (a), image after grayscaling (b)

$$ I_{g} \left( {i,j} \right) = \frac{{R \left( {i,j} \right) + G \left( {i,j} \right) + B\left( {i,j} \right)}}{3} $$
(1)

Where

  • \( I_{g} = \) Intensity value of grayscale image at \( i,j \) pixel

  • \( R = \) Intensity value of red color on image at \( i,j \) pixel

  • \( G = \) Intensity value of green color on image at \( i,j \) pixel

  • \( B = \) Intensity value of blue color on image at \( i,j \) pixel

Grayscale image that we got from grayscaling process will through an edge detection process to detect each edge from the image object because training and recognizing will be done based on object shape at the image. Canny Edge Detection algorithm is applied to obtain edge of image (see Fig. 4). This algorithm is well known for its performance in handling noise [16]. Process of canny edge detection is divided into five steps as follows:

Fig. 4.
figure 4

Grayscale image (a) binary image after canny edge detection (b)

Smoothing.

Smoothing is a process of softening image to reduce the noise, usually using Gaussian Filter. Every image that taken from camera will have some noise and to avoid incorrect detection of noise into the edge, smoothing must be done.

Finding Gradient.

Usually, Canny detect edge point on grayscale which had highest intensity value changes. Those areas discovered by determining gradient of an image which is calculated using Gradient Magnitude formula:

$$ G = \sqrt {G_{x}^{2} + G_{y}^{2} } $$
(2)

Where

  • \( {\text{G }} = \) Gradient magnitude

  • \( G_{x} = \) Gradient of horizontal direction (x)

  • \( G_{y} = \) Gradient of vertical direction (y)

As for calculating the angle direction will use the following formula:

$$ \theta = {\text{arctan }}(\frac{{G_{y} }}{{G_{x} }}) $$
(3)

Where

  • \( \theta = \) Gradient of angle direction

  • \( G_{x} = \) Gradient of horizontal direction (x)

  • \( G_{y} = \) Gradient of vertical direction (y)

Angle produced from the calculation will be rounded to 0, 45, 90 and 135° based on closure.

Non Maximum Suppression

The next step is get rid of non-maximum values because only local maximum that will be used as edge. Other pixel which have value that are not local maximum will be lowered to zero.

Double Thresholding.

The remaining edge pixels from the previous step will be marked as strong pixels. Most of them is the real edge on image, but some may be caused by noise or color variations by rough surfaces. So, to distinguish them is by using a threshold value so that only the edge with a strong value will be kept. Canny algorithm uses double thresholding system (upper threshold and lower threshold) where the edges with a value higher than the upper threshold marked as strong point. Edges with a value less than lower threshold will be deleted and edges with value between upper threshold and lower threshold will be marked as weak point and will be deleted, except it is connected to edge which have strong point.

Edge Tracking by Hysteresis.

To know the relation between each edge, edge tracking done using Binary Large Object. Binary Large Object applied by looking at weak point and the 8-Neighborhood. As long as there is a strong pixel on Binary Large Object, the weak pixel could be identified as something that can be included or stored.

2.1 Feature Extraction

Feature extraction is required to reduce number of neuron which be used in recognition process. Original binary image has \( 960 \times 700 \) dimension which will represent as neuron in input layer. Feature extraction is carried out by segmented the original image into \( 48 \times 35 \) dimension and calculate number of element 1 in each segmentation. This segmentation produces \( 20 \times 20 \) features which be represented into 400 input neurons for every image (see Fig. 5).

Fig. 5.
figure 5

Binary image (a) extraction feature result (b)

3 Organic-Inorganic Recognition Technique

Organic-inorganic identification algorithm uses the combination of BPNN and PSO as optimization algorithm. PSO will take part in optimizing weight and bias value where every set of weight and bias will be used as particles in PSO. After PSO performed, the optimized set of weight and bias will be used for BPNN. The scheme of PSO-BPNN is given in a Fig. 6.

Fig. 6.
figure 6

Hybrid PSO-BPNN flowchart

Weight and bias values are taken a randomly in range \( [ - 2,2] \) that will be used as initial position of particle. Fitness function of PSO is obtained from Mean Square Error (MSE) with output \( O \) is obtained from forward process at BPNN which apply binary sigmoid as activation function.

$$ O = \frac{1}{{1 + e^{ - (\mathop \sum \nolimits w \cdot I + b)} }} $$
(4)

Where w and b is set of weights and bias respectively. The algorithm of PSO-BPNN is described in the following steps:

  1. 1.

    Specify the topology of the BPNN to determine number of initial weights as the initial swarm of particle.

  2. 2.

    Let \( (I_{b} ,T_{b} ) \) is the bth input and target pair for BPNN, with \( b = 1,2, \ldots , N_{data} \) and \( N_{data} \) is the number of paired data.

  3. 3.

    Let \( N_{i} , N_{x} \) and \( N_{it} \) is the number of particle, number of dimension and number of iterations respectively, and \( t_{it\,max} \) is maximum iteration.

  4. 4.

    Generate an initial particle. Each particle has dimension which correspond to BPNN random weights.

  5. 5.

    Set \( t = 0 \)

    While \( t \le t_{it\,max} \) do

    Calculate fitness value \( F(x_{i} ) \) of the ith particle in swarm \( S_{i} \).

    $$ F\left( {x_{i} } \right) = E\left( {x_{i} ,I_{b} ,T_{b} } \right)\quad \quad i = 1,2, \ldots ,N_{i} $$
    (5)

    Where \( E\left( {x_{i} ,I_{b} ,T_{b} } \right) \) is the Mean Square Error (MSE) of the ith particle using \( (I_{b} ,T_{b} ) \) pair of data. It is calculated based on the selected BPNN architecture and activation function;

    $$ E\left( {x_{i} ,I_{b} ,T_{b} } \right) = \frac{1}{2}\sum\nolimits_{b = 1}^{{N_{data} }} {(T_{b} - O_{{b(x_{i} )}} )^{2} } $$
    (6)

    Where \( T_{b} \) is Target of the bth input and \( O_{{b(x_{i} )}} \) is Output of the bth input which obtain using ith particle based on the selected BPNN architecture.

    Let \( x_{i} \) denote position of particle ith and \( y_{i} \) denote the best position of particle ith

    $$ v_{ij} \left( {t + 1} \right) = wv_{ij} \left( t \right) + c_{1} r_{1j} \left( t \right)\left[ {y_{ij} \left( t \right) - x_{ij} \left( t \right)} \right] + c_{2} r_{2j} \left( t \right)\left[ {\widehat{y}_{j} \left( t \right) - x_{ij} \left( t \right)} \right] $$
    (7)

    Where \( v_{ij} \left( t \right) \) is the velocity of ith particle in dimension \( j = 1,2, \ldots ,N_{x} \) at iteration \( t \). \( x_{ij} \left( t \right) \) is the position of ith particle in dimension \( j = 1,2, \ldots ,N_{x} \) at iteration \( t \). \( w \) is inertia weight, where this research uses linear decreasing inertia weight [17] \( c_{1} \) and \( c_{2 } \) are positive constant acceleration, \( r_{1j} \left( t \right) \) and \( r_{2j} \left( t \right) \) are random values in range \( [0,1] \).

    Update the position using equation:

    $$ x_{ij} \left( {t + 1} \right) = v_{ij} \left( t \right) + v_{ij} (t + 1) $$
    (8)

    With \( x_{ij} (0) \) in range \( (x_{min} ,x_{max} ) \).

    $$ t = t + 1 $$

    End

  6. 6.

    Apply the best solution in current swarm as the initial weights for BPNN learning.

The BPNN learning from the BPNN part produces recognition of the organic and inorganic waste where its performance is validated by calculating MSE and percentage of accuracy. The performance results of PSO-BPNN algorithms are presented in Sect. 4.

4 Result and Analysis

This section presents performance evaluation of PSO-BPNN and its comparison with individual BPNN and individual PSO in MSE and percentage of accuracy. Percentage of accuracy is defined as follows [18]:

$$ Accuracy\left( \% \right) = \frac{TP + TN}{TP + TN + FP + FN} \times 100\% $$
(9)

Assuming percentage of accuracy above is corresponds to the P class, where TP is true positives, which means that the prediction gives correct classification of P class according to the actual; \( TN \) is true negatives, which means the prediction gives correct label classification for all non-P class;\( FN \) is false negatives, which means the prediction gives incorrect classification label of the actual P class and \( FP \) is false positives, which means the prediction gives incorrect classification labels another class as P class.

Performance evaluation of PSO-BPNN is conducted by using 400-400-1 BPNN architecture, namely 400 neurons in input layer, 400 neurons in hidden layer and 1 neuron in output layer. The data is divided into 80 data for training and 20 data for testing. Training is conducted 5 times for 50 and 100 iterations for each algorithm with learning rate 0.5 for BPNN, 0.3 and 0.5 for \( c_{1} \) and \( c_{2} \) respectively for PSO. The comparison of BPNN, PSP and PSO-BPNN performance is given in Table 1 as follows.

Table 1. Training result

From training result with 50 iterations, it is known that BPNN has MSE 0.051201 and 11.56 s for processing time. While PSO has 0.120857of average error and 49.31 s of average processing time which is 0.069 higher compare with BPNN. Hybrid PSO-BPNN has the lowest MSE with difference 0.04 with BPNN. While for training with 100 iterations, it is obtain that hybrid PSO-BPNN also has the lowest MSE compared with BPNN and PSO. Testing results for 50 and 100 iterations, also shows that Hybrid PSO-BPNN has the highest accuracy and achieve around 22% and 17% higher compare with BPNN for 50 and 100 iteration respectively.

5 Conclusion

This paper presents hybrid PSO-BPNN for organic and inorganic recognition. The experiments result show that PSO is capable to optimize weights of BPNN, such that BPNN learning can achieve good result. From the evaluation PSO-BPNN has higher accuracy compare to individual BPNN with only 2.58 s for additional processing time. This results shows that PSO-BPNN has good performance and can be implemented to develop organic-inorganic separation system.