# Metal Additive Manufacturing Parts Inspection Using Convolutional Neural Network
## 3 Results and Discussion
### Feature Visualization  
To have a better understanding of what the CNN model has learned, the learned filters and the extracted feature maps are visualized in Figure 7. The 32 filters from the first convolutional layers are shown in Figure 7a. Four samples representing crack, lack of fusion, gas porosity, and good quality are present in Figure 7b-e. It seems difficult to interpret those 32 5 \(\times\) 5 filters in Figure 7a, but some low-level features are extracted by reviewing the features maps in Figure 7b-e. For example, these filters were able to identify the edges of the crack, as in Figure 7b. The irregular shape of the lack of fusion was emphasized by the filters, which was different from the round shape in gas porosity. The second and the third convolutional layers are not discussed here, as they contain the high-dimensional information and make it less visually interpretable.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Class** & **Precision** & **Recall** & **F Score** \\ \hline Crack & 0.94 & 0.95 & 0.945 \\ Gas porosity & 0.91 & 0.87 & 0.891 \\ Good quality & 0.96 & 0.94 & 0.949 \\ Lack of fusion & 0.88 & 0.92 & 0.901 \\ \hline \hline \end{tabular}
\end{table}
Table 7: Precision, recall, and F score of the final model on the test dataset.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Alloys** & **Good** & **Lack of Fusion** & **Crack** & **Gas Porosity** \\ \hline AlCoCrFeNi alloy & 93.1\% & 91.2\% & 94.9\% & 88.5\% \\ Ti-6 Al-4V & 95.1\% & 88.7\% & 93.7\% & 88.3\% \\ AISI 304 stainless steel & 96.4\% & 89.3\% & 94.8\% & 90.4\% \\ \hline \hline \end{tabular}
\end{table}
Table 8: Classification accuracy of different alloys in the test dataset.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Method** & **Accuracy** \\ \hline [PERSON] et al. [42] & 79.6\% \\ [PERSON] et al. [36] & 89.3\% \\ This work & 92.1\% \\ \hline \hline \end{tabular}
\end{table}
Table 9: The performance of classification accuracy with different methods.  
Attention maps can be obtained for a given input image with back-propagation on a CNN model. The value of each pixel on the attention map is able to reveal to what extent the same pixel on the input image makes contributions to the final output of the network [18; 19]. Therefore, through the attention maps, it can intuitively analyze which part of the AM build metal images attracts the attention of the network. Figure 8 includes the AM build metallic parts profiles shown in a-d and the corresponding attention maps e-h. The defects were highlighted in the red circles and rectangles in Figure 8a-d. The bright places indicate where the CNN model focuses, as seen in Figure 8e-h, while the dark regions suggest where the network is less interested. Those maps demonstrate that the network pays attention to the defects and verify the effectiveness of our model.  
Figure 7: Visualization of the (**a**) 32 learned filters of the first convolutional layers, (**b**) 32 feature maps for a crack sample, (**c**) 32 feature maps for a lack of fusion sample, (**d**) 32 feature maps for a good sample and (**e**) 32 feature maps for a gas porosity sample.