## 4 Key Enablers in the HDL Model
### The Lower-Level Customized CNN Module for Diamond Tool Wear Prediction  
Based on the principle of convolutional neural network and GASF images obtained by time series imaging, an HDL is proposed for diamond-tool wear prediction. At the same time, to classify the tool wear state, it is necessary to collect the machining data after tool wear. According to the morphology quality obtained by processing, the DTW can be divided into three states, namely, no wear, slight wear, and severe wear, as shown in Figure 4. The structural parameters of the HDL model designed in this paper are shown in Table 2.  
The function of the convolutional layer is to extract high-dimensional features from the input data. The convolution kernel will carry out a cross-correlation operation between the input data and the weight coefficient in the convolution kernel, and then superimpose the corresponding bias quantity, to realize the convolution operation in this region, as follows:  
\[ \begin{split}\mathbf{Z}^{l+1}(i,j)=\Big{[}\mathbf{Z}^{l}\otimes\mathbf{w}^{l+1} \Big{]}(i,j)+\mathbf{b}=\sum\limits_{k=1}^{K_{l}}\sum\limits_{k=1}^{f}\sum\limits_{ y=1}^{f}\Big{[}\mathbf{Z}^{l}_{k}(s_{0}i+x,s_{0}j+y)\mathbf{w}^{l+1}_{k}(x,y)\Big{]}+\mathbf{b}, \\ s.t.:\ (i,j)\in\{0,1,\cdots,L_{l+1}\},\end{split}  \tag{10}\]  
where \(\mathbf{b}\) represents the bias of the convolution kernel; \(\mathbf{Z}^{l}\) and \(\mathbf{Z}^{l+1}\) represent the input and output, respectively, of the convolution operation at the \(l+1\) level; \(L_{l+1}\) represents the size of the output data of \(\mathbf{Z}^{l+1}\); \(\mathbf{Z}(i,j)\) represents the value of the pixel point corresponding to row \(i\) and column \(j\) on the pixel image; \(K\) represents the number of channels in the picture; and \(f\) is the size of the convolution kernel. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Items** & **Kernel/Step Size** & **Input** & **Output** & **Activation Function** \\ \hline \multirow{4}{*}{Hidden Layer} & Input Layer & / & \(512\times 512\times 1\) & \(512\times 512\times 1\) & / \\ \cline{2-5}  & Convolution layer 1 & \(5\times 5/1/1\) & \(512\times 512\times 1\) & \(512\times 512\times 64\) & ReLU \\ \cline{2-5}  & Maximum pooling layer 1 & \(3\times 3/2/1\) & \(512\times 512\times 64\) & \(256\times 256\times 64\) & / \\ \cline{2-5}  & Convolution layer 2 & \(5\times 5/1/1\) & \(256\times 256\times 64\) & \(128\times 128\times 64\) & ReLU \\ \cline{2-5}  & Maximum pooling layer 2 & \(3\times 3/2/1\) & \(128\times 128\times 64\) & \(128\times 128\times 64\) & / \\ \cline{2-5}  & Fully connected layer 1 & / & 1,048,576 & 384 & ReLU \\ \cline{2-5}  & Fully connected layer 2 & / & 384 & 192 & ReLU \\ \hline \multicolumn{2}{c}{Output Layer} & / & 192 & 3 & softmax \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of lower-level customized CNN module for diamond-tool wear prediction. Figure 4: Shape of the workpiece and cutting-tool edge under different levels of wear. The size of the convolutional kernel, the size of the convolutional step, and the number of filling layers are the parameters of the convolutional layer, which together affect the output size of the convolutional layer. The influence of the hyperparameter on the output size is formulated as follows:  
\[L_{l+1}=\frac{L_{l}+2p-f}{s_{0}}+1, \tag{11}\]  
where \(L_{l+1}\) represents the size of the output data of \(\mathbf{Z}^{l+1}\); and \(f\), \(s_{0}\), and \(p\) represent the size of the convolution kernel, the convolution step, and the number of filling layers, respectively. Meanwhile, activation functions (sigmoid function, tanh function, and ReLU function) need to be added after the hidden layer, whose expression is as follows:  
\[\mathbf{A}^{l}_{i,j,k}=f\big{(}\mathbf{Z}^{l}_{i,j,k}\big{)}. \tag{12}\]  
The function of the pooling layer is to reduce the dimension of the output data of the convolutional layer and carry out feature selection and information filtering.