# Snack Texture Estimation System Using a Simple Equipment and Neural Network Model +
## 5 Cnn  
The spectrogram has rich sound features [12; 13; 14]. To enhance the system capabilities, we considered introducing CNN [15], which deals with images. As a first step, we tried to classify snacks using CNN. Figure 14: Texture evaluations of the samples using data sets of Figure 13: (**a**) The mean of estimated crunchiness degree and (**b**) crispness degree. Figure 13: Data Sets (1)–(10) employed for the neural network model validation. Since we have only 1000 data points, we adopted AlexNet [25], which is a pre-trained CNN. We employed the Neural Network Toolbox in MATLAB developed by MathWorks. We conducted Transfer Learning using AlexNet [26]. Figure 15 shows the CNN classifying the snacks. Note that the ReLU operation, cross-channel normalization, and max-pooling layers are omitted in Figure 15. CNN comprises the input layer for the 227 \(\times\) 227 RGB image and soft-max output layer. The soft-max layer outputs classified values of rice cracker, potato chips, cookies, biscuit, and corn snacks within a range of (0,1). The item with the highest classified value is judged as an inputted snack. For instance, the value of the rice cracker is highest in Figure 15; thereby, the inputted image is classified as a rice cracker. The convolution layers (conv1-conv5) and fully connected layers (fc6 and 7) are original parts which are pre-trained with a massive number of image data. We only attached fc8 and the soft-max layer with original AlexNet. The input image (227 \(\times\) 227 RGB) comprises the spectrogram and visualized load intensity (Figure 16b), which are obtained from extracted 2.0 s signals (Figure 16a). FFT is performed in each section from (1)-(19), as shown in Figure 16a, where the period of each section is 0.2 s, and then there are 0.1 s overlaps between the adjacent sections. FFT results of (1)-(19) are visualized, as shown in Figure 16b. In addition, this image also includes information in the load intensity, which is visualized in the bottom part of the image. Figure 16: Calculation of input image to CNN: (**a**) FFT (Fast Fourier Transform) period and (**b**) spectrogram and load change image. Figure 15: Convolutional neural network (CNN) for classifying snacks. The images of snacks are generated automatically and numbered as shown in Table 4, and then some of the generated images are shown in Figure 17.  
Table 5 enumerates the conditions for validation of CNN. The 10-fold cross-validation in Figure 13 is performed. The result is shown in Table 6. CNN performed very well. The mean of the accuracies in Data Sets (1)-(10) is 98.30%. The CNN is useful to modify or revise the outputted texture values from NN model described in previous Section 4. It is found that incorporating CNN must improve our system. \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline
**Data Set** & **(1)** & **(2)** & **(3)** & **(4)** & **(5)** & **(6)** & **(7)** & **(8)** & **(9)** & **(10)** \\ \hline Accuracy [\%] & 95 & 100 & 98 & 98 & 95 & 99 & 99 & 99 & 100 & 100 \\ Mini-batch Loss & 1.8634 & 2.1723 & 2.1096 & 2.3062 & 1.9875 & 2.2507 & 2.3755 & 2.1629 & 2.1397 & 1.7647 \\ at Epoch 1 & \multirow{2}{*}{0.0034} & \multirow{2}{*}{0.0048} & \multirow{2}{*}{0.0035} & \multirow{2}{*}{0.0080} & \multirow{2}{*}{0.0123} & \multirow{2}{*}{0.0210} & \multirow{2}{*}{0.0042} & \multirow{2}{*}{0.0044} & \multirow{2}{*}{0.0071} & \multirow{2}{*}{0.0110} \\ Mini-batch Loss & & & & & & & & & \\ at Epoch 20 & & & & & & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 6: The result of the 10-fold cross-validation, as shown in Figure 13. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Value/Condition** \\ \hline Solver & sgdm \\ Learning Rate & 0.0001 \\ Max Epochs & 20 \\ Mini Batch Size & 100 \\ Total Iterations & 180 \\ Number of Train Data/Test Data & 900/100 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Transfer learning settings. Figure 17: Images inputted to CNN: (**a**) Rice crackers; (**b**) potato chips; (**c**) cookies; (**d**) bscuits and; (**e**) corn snacks.