## 4 Results
### Machine Learning Results  
The machine learning models rFFNN, mFFNN, kFFNN, CNNG, CNNP, SVM, LSTM, AlexNet, ResNet, VGG-16, and Inception were evaluated to determine which feature vector and network are the best option for shape and quality contour profile classification. According to [1,2,4,15,16] and [39], the metrics used to know the performance are accuracy for training and test (TAcc and PAcc, respectively) and confusion matrices, defined in [13,14]. Moreover, we include computational cost metrics such as frame per second (FPS) and the number of parameters (NPam) to know which network is feasible for real-time processing in industrial environments for inspection applications. **Contour profile classification. ** The NIIM classifies contour calibration pieces into curve, line, and slope categories in terms of quality. The feature vector \(r_{d,\beta}(n)\) has a size of 508 elements. In contrast, the feature vectors \(M_{d,\beta}(k)\) and \(D_{\Delta,\beta}(k)\) have a size of 150 because, according to our experiments, the frequencies \(0<k<100\) are enough to represent the shape in the frequency domain. The networks rFFNN, mFFNN, and kFFNN have six neurons in the hidden layers and were tested with five validation experiments. Table 7 shows the results where the networks rFFNN, mFFNN, kFFNN, CNNG, and CNNP achieved 100% for training and testing. However, mFFNN and kFFNN are faster and have fewer parameters than the others. Figure 30 presents the confusion matrices of rFFNN, mFFNN, kFFNN, CNNG, and CNNP, where the performance is the same. However, kFFNN presents less overfitting during the training. Regarding converging epochs, rFFNN requires 56 epochs, mFFNN 28, kFFNN 25, CNNG 15, and CNNP 10. CNNG and CNNP require fewer epochs to converge than the other networks, but they present more overfitting than kFFNN. SVM, LSTM, AlexNet, VGG-16, ResNet, and Inception networks require 300 epochs. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Network** & **Tacc** & **Pacc** & **FPS** & **NPam** \\ \hline kFFNN & 100\% & 100\% & 10,000 & 903 \\ mFFNN & 100\% & 100\% & 10,000 & 903 \\ rFFNN & 100\% & 100\% & 7600 & 3060 \\ CNNG & 100\% & 100\% & 30 & 8,256,106 \\ CNNP & 100\% & 100\% & 32 & 8,256,106 \\ SVM & 80\% & 78\% & 210 & 753 \\ LSTM & 85\% & 72\% & 5000 & 1250 \\ AlexNet & 95\% & 82\% & 2 & 62,378,344 \\ VGG-16 & 93\% & 82\% & 0.11 & 138,357,544 \\ ResNet-18 & 91\% & 80\% & 4 & 11,174,362 \\ Inception-V3 & 88\% & 72\% & 4 & 21,776,508 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Average results of contour profile classification. CNNG learns features based on the piece surface and the illumination of the vision system, while CNNP learns features of the profile shape. For example, Figure 31 shows the second convolution activation maps, where the propagation of a curve image generates activation divided into the piece surface and the illumination. Figure 32 shows the activation maps of the second convolution layer, where the propagation of a curve image generates activation with similar patterns to Laplacian filtering. rFFNN, mFFNN, CNNG, and CNNP achieve good results because they learn the shape features that have \(r_{d,\beta}(n)\), \(M_{d,\beta}(k)\), \(l_{d,\beta}(x,y)^{G}\), and \(P_{d,\beta}(x,y)\). Additionally, kFFNN generates good results because \(D_{\Delta,\beta}(k)\) has form deviation properties derived from the three machined processes that generate curve, line, and slope profiles. Added to this,  
Figure 31: Feature maps of the second convolution for CNNG contour profile classification. Figure 30: Confusion matrices of ANNs for contour profile classification. Figure 32: Feature maps of the second convolution for CNNP contour profile classification. kFFNN and mFFNN generate the lowest computational cost. The models SVM, LSTM, AlexNet, VGG-16, ResNet, and Inception generate less accuracy than the FFNNs and CNNs proposed in this work. SVM has three lineal discriminant functions, each with 251 parameters (one for each feature vector and the bias).