# Dual Image-Based CNN Ensemble Model for Waste Classification in Reverse Vending Machine
## 3 Materials and Methods
### The Proposed CNN Ensemble Model  
We propose an ensemble CNN model using the top and front view images to resolve the limitations of previous state-of-the-art RVM studies using a single image-based system [12; 13] or multi-modal network [14]. The main goal of our ensemble approach is to classify fraud objects with high accuracy on a vision-only system. When building an ensemble network, we can use two strategies: picking the models randomly or using the models with a better performance. [PERSON] et al. [47] suggested that both methods show good results, but in small ensembles the same as in our study, the latter approach can derive a better result. Based on this research, we combine the best-fit CNN models from each view with an ensemble scheme. As mentioned in Section 2, typical neural network ensemble techniques are bagging [21], boosting [22], and stacking [23]. All these methods attempt to improve performance by combining weak classifiers to derive robust results. Bagging creates sub-datasets through bootstrap from the original dataset and trains the classifier with the sub-datasets. After the training, the weights for each classifier are set equally, and methods including majority voting produce the final result. Boosting trains the classifiers with the original dataset, and each classifier is weighted differently according to the classifier's prediction result. After this, the final result is derived from weighted voting or weighted average [48; 49]. Stacking or stacked generalization [23] derives the final result through two processes, as illustrated in Figure 7. In the first phase, each classifier is trained with the Level-0 dataset and creates predictions. Then, these predictions become the Level-1 dataset for the meta classifier, and the meta classifier finds the optimal combination of predictions after training. In other words, the meta classifier combines the results obtained by several poor classifiers and derives a robust final result. Figure 6: Building blocks of SqueezeNet and MobileNetV2: (**a**) Fire module of SqueezeNet with three \(1\times 1\) convolutional filters in the squeeze layer, four \(1\times 1\) convolutional filters in the expand layer, and four \(3\times 3\) convolutional filters in the expand layer; (**b**) Bottleneck depthwise separable convolution with residuals, which is a basic building block of MobileNetV2. This figure represents the block where \(stride=1\). General neural network ensemble schemes train each classifier with the same dataset or multiple partial datasets derived from the original dataset. By contrast, we train each classifier on different training sets, that is, a top view and a front view dataset. So, each prediction contains information from a different view. The CNN ensemble model is a small ensemble with two classifiers, and the size of the prediction vectors for each classifier is three. Therefore, we decided that the optimal combination of each classifier with the stacking ensemble scheme fits better than the voting or weighted averaging method in boosting or bagging. We used the single-layer perceptron (SLP) as the meta classifier in our model to combine two classifiers independently trained from the top view and the front view. Since the SLP is a lightweight and straightforward network, the proposed model can operate in a lightweight embedded platform without any performance problems. In the proposed stacking ensemble scheme, datasets for SLP are concatenated vectors of the top view and the front view prediction. Using the class probabilities rather than a single class value is recommended since the probabilities represent the confidence measure for the prediction [50; 51]. The final result vector derived through the trained SLP goes through the softmax layer and becomes the final prediction vector. Since RVM is a system that rewards users, it is essential to collect many target objects and reliably identify them simultaneously. Therefore, we do not select the argmax class that has the highest probability from the final prediction vector.