## 3 Proposed Methodology
### Lightweight Deep Convolutional Neural Network (LDCNN)  
The LDCNN proposed in this paper took an SE block as the backbone and used DSC to extract features of input images and adjust output dimensions. Figure 11 demonstrates the structure of the SE block. The image features went through the PC first to improve the dimensions, and pointwise features were extracted in the space. Next, image features between each pixel channel were extracted by DC and compressed using global average pooling (GAP). Then, the features were multiplied by input images through the ReLU activation function to expand. Therefore, high weights were enhanced while other weights were diminished, and the dimensions of output images were finally changed.  
Figure 10: Images of green coffee beans: (**a**) before normalization, (**b**) after normalization.  
The LDCNN model in this study used the SE block as the backbone (Figure 12). Initially, the input image improved the dimensions of images through a single CL. Later, after undergoing the SE block twice, tiny features were extracted. Then, a skip block was employed to extract features through a skip connection. For instance, residual learning of ResNet can help the model avoid the difficulty of training deep networks due to weight degradation. Therefore, a skip block was added in this paper to improve the model's accuracy. An SE block can extract channel-wise features of image features. However, after feature extraction, the features mainly focus on the correlation between image channels and channels, while feature extraction of global images is lacking. Hence, the model in this study additionally extracted features of the average pooling layer (APL) and CL as the skip block of the model. Two different features were added for classification, and GAP was used to connect CL and FCL on the tail structure of the model. Feature extraction was performed on global images, and the results were then classified.  
Table 1 shows the model structure. As this study targets a lightweight model, the depth of the model was reduced, and a three-layer bottleneck block and ReLU activation function were adopted to minimize the GFLOPS and the parameters of the model. Furthermore, to  
Figure 11: Structure of an SE block.  
Figure 12: Proposed LDCNN framework in the study.  
maintain the model's accuracy, the SE layer was used, and the dimensions of the images were increased. An H-swish (HS) activation function was adopted at both ends of the model structure to reduce GFLOPS and keep the accuracy of the model as opposed to ReLU. A 28 \(\times\) 28 APL was used at the end to reduce the GFLOPS. By combining those models, we believe that high accuracy and a lightweight model could be realized.  
To evaluate the efficiency of the model, fivefold cross-validation was adopted in the experiment to train and evaluate the model. The dataset was randomly divided into five groups, four of which contained 3701 images, and the remaining one included 3700 images. During the training process, one dataset was chosen while the others were used for training. After performing the experiment five times, the average evaluation results were calculated. Due to the limited parameters of the lightweight model and small GFLOPS, the model failed to extract complete features, which may have resulted in overfitting. To solve those issues, RA, LA, and GC were introduced in this lightweight model to optimize the learning rate strategy, weight, optimizer, and gradient. Finally, to evaluate the efficiency of LDCNN and predict reliability, except for calculating evaluation indicators, model size, parameters, GFLOPS, evaluation time, and comparing state of the art, this model was put into embedded systems. Moreover, this work adopted LIME to explain the predictions of LDCNN in model reliability.