## 5 Defect Detection Using ML Techniques and Sensors
### Vision Sensor  
In situ monitoring of the L-PBF layerwise is usually achieved using a digital single-lens reflex (DSLR) camera. An unsupervised approach is suggested by [PERSON] et al. [123] for anomaly detection in the powder layer of the L-PBF process. In their study, the authors used images of powder beds as input in the ML model; the objective was to classify the different anomalies that may result in powder spreading. The six anomalies studied, recoater hopper, streaking, debris, superelevation, part failure, and incomplete spreading, are illustrated in Figure 17. The ML approach used is bag-of-key points (or words); the algorithm creates filter banks from the acquired images and clusters similar ones together. Different material types were analyzed, including Ti6 Al4V (four powder types), AlSi10 Mg, Inconel 718 (two powder types), stainless steel 316L, stainless steel 17-4, and a bronze alloy. The accuracy of the developed model was 95% for anomaly detection and 100% for anomaly-free detection. However, the algorithm has a relatively low accuracy of detecting recoater streaking (56%), attributed to a low number of training data, a small area, and the frequent colocation of this anomaly. The algorithm was applied on a Hamerschlag Hall model, using tensile bars and impeller blades to enhance parts orientation and detect potential overhang failure. Due to its relatively low computation burden, this approach might be practical in connecting it to a feedback control system. A supervised approach is more common for layerwise monitoring; [PERSON] et al. [124] compared six different ML methods. The input of the model was layerwise images taken at different light schemes. The objective of the model was to classify parts printed at different quality levels. Ti6 Al4V cylinder specimens were printed having different internal defects by manipulating the process parameters. Several ML algorithms were used to link the extracted features to the process parameters. It was fo  
Figure 16: Different levels of complexity tested by [PERSON] et al. [76]. Figure 17: Six different powder bed anomaly classes chosen by [PERSON] et al. [123]. (**a**) Recoater hopping, (**b**) recoater streaking, (**c**) debris, (**d**), superelevation, (**e**) part failure, and (**f**) incomplete spreading. a combination of spectral graphs, theoretic features, and multi and lacunarity features results in the best classification accuracy of around 90%. [PERSON] et al. [85] demonstrated the effectiveness of using an ensemble classification scheme to detect the discontinuities in stainless-steel parts printed using the L-PBF process, as illustrated in Figure 18. The input images were again layerwise images taken at different light schemes; the objective of the ML algorithm is to classify if the layer contains anomaly or is defect-free. A microCT was used to label the data and identify the exact positions of defects within each layer. The accuracy of the classification increased to 85%, compared to 65% using individual flash modules. [PERSON] et al. [125] used layerwise images as an input, and the objective of applying the ML algorithm was to classify parts as defective (contains flaw) or defect-free. The images were captured before and after laser exposure. The authors demonstrated that images taken post-laser melting were more valuable than those captured after powder recoating for defect detection. The authors also validated that CNN could detect flaws more accurately than NN due to its generalization ability of the dataset. The CNN architecture is shown in Figure 19. An optical microscope was used to identify the ground truth, with the images captured from the powder layer resembling the images captured using a microscope. [PERSON] et al. [126] used 35 different combinations of process parameters to print Inconel 625 cubes. Three surface quality classes were identified according to the smoothness and visible porosities. The model input was layerwise images captured during the printing of the parts.