# Dual Image-Based CNN Ensemble Model for Waste Classification in Reverse Vending Machine
## 3 Materials and Methods
### Candidate CNN Models  
Ensemble model-based classification generally achieves better accuracy but takes a longer processing time. Therefore, the size of the classifier is crucial when building a lightweight model for the embedded AI platform suggested in our study. For this reason, we chose the candidate CNNs among the popular models used in image classification, considering the number of parameters representing the model size. The candidate models addressed in this study are ResNet-50, DenseNet, SqueezeNet, MobileNetV2, and EfficientNet-B0/B1/B2.  
Training deep and complex models is difficult due to the vanishing gradient. Residual neural network (ResNet) [41] and Dense Convolutional Network (DenseNet) [42] are the efficient deep CNNs for addressing the vanishing gradient problem. As shown in Figure 5, ResNet and DenseNet rely on the heaped residual blocks and the stacked dense block, respectively. In addition, both models use shortcut connections to strengthen the gradients. The difference is that ResNet and DenseNet use element-wise addition and concatenation for a shortcut connection, respectively.  
Although embedded devices have very limited computing resources, they need to achieve similar accuracy to conventional models, so lightweight and efficient deep learning models should be used. SqueezeNet [43] and MobileNetV2 [44] are widely used lightweight models for embedded or mobile environments. Figure 6 shows the core modules of SqueezeNet and MobileNetV2. As illustrated in Figure 5(a), SqueezeNet [43] consists of the network based on the Fire module that reduces the overall model size. The number of parameters is reduced by 50\(\times\) compared to AlexNet, but the accuracy on ImageNet has similar or better results. MobileNetV2 [44] aimed to operate real-time in resource-constrained environments where heavy CNN models cannot be used due to weak computational powers. MobileNetV2 uses an inverted residual block and a linear bottleneck to the depthwise separable convolution [45], shown in Figure 5(b). The inverted residual block uses a narrow-wide-narrow structure to reduce memory consumption. MobileNetV2 gives similar or better results with fewer parameters and faster inference speed than NasNet-A and ShuffleNet on ImageNet.  
Figure 5: Building blocks of ResNet and DenseNet: (**a**) Bottleneck building block for ResNet 50/101/152 where the \(1\times 1\) layers reduce and increase dimensions, and \(3\times 3\) layer extracts features; (**b**) Simple dense block of DenseNet. The multiple dense blocks are connected with the transition layers and compose the DenseNet.  
Modifying the resolution, depth, or width of CNNs is widely used for enhancing the performance of CNNs. One of the main issues is to decide an adequate factor and its degree for better performance after scaling up. However, this process requires trial and error that causes inefficiency and often results in sub-optimal performance. To overcome such handcrafting, EfficientNet [46] proposed compound scaling, which is a principled way to scale up the model for better performance and efficiency. Compound scaling uniformly scales the three dimensions of depth, width, and resolution with a constant ratio. The experimental result showed that the EfficientNet-B3 achieved better Top-1 accuracy than ResNeXt-101 with 18\(\times\) fewer FLOPS.