Next Article in Journal
Comparison of Porosity and Thermal Conductivity of Concrete and Alkali-Activated Hybrid Binders in 3D-Printed Fiber-Reinforced Foamed Composites
Previous Article in Journal
Quasi-Static and High Strain-Rate Behavior of Carbon Fiber Reinforced Modified BOFS Concrete
Previous Article in Special Issue
Structure–Property Linkage in Alloys Using Graph Neural Network and Explainable Artificial Intelligence
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Leveraging Machine Learning for Porosity Prediction in AM Using FDM for Pretrained Models and Process Development

1
National Institute for Aviation Research, Wichita, KS 67260, USA
2
Department of Aerospace Engineering, Wichita State University, Wichita, KS 67260, USA
*
Author to whom correspondence should be addressed.
Materials 2025, 18(19), 4499; https://doi.org/10.3390/ma18194499
Submission received: 18 August 2025 / Revised: 23 September 2025 / Accepted: 24 September 2025 / Published: 27 September 2025

Abstract

Additive manufacturing involves numerous independent parameters, often leading to inconsistent print quality and necessitating costly trial-and-error approaches to optimize input variables. Machine learning offers a solution to this non-linear problem by predicting optimal printing parameters from a minimal set of experiments. Using Fused Deposition Modeling (FDM) as a case study, this work develops a machine learning-powered process to predict porosity defects. Specimens in two geometrical scales were 3D-printed and CT-scanned, yielding raw datasets of grayscale images. A machine learning image classifier was trained on the small-cube dataset (~2200 images) to distinguish exploitable images from defective ones, averaging over 97% accuracy and correctly classifying more than 90% of the large-cube exploitable images. The developed preprocessing scripts extracted porosity features from the exploitable images. A repeatability study analyzed three replicate specimens printed under identical conditions, and quantified the intrinsic process variability, showing an average porosity standard deviation of 0.47% and defining an uncertainty zone for quality control. A multi-layer perceptron (MLP) was independently trained on 1709 data points derived from the small-cube dataset and 3746 data points derived from the large-cube dataset. Its accuracy was 54.4% for the small cube and increased to 77.6% with the large-cube dataset, due to the larger sample size. A rigorous grouped k-fold cross-validation protocol, relying on splitting data per cube, strengthened the ML algorithms against data leakage and overfitting. Finally, a dimensional scalability study further assessed the use of the pipeline for the large-cube dataset and established the impact of geometrical scaling on defect formation and prediction in 3D-printed parts.

1. Introduction

Additive manufacturing (AM) offers significant advantages in design complexity and flexibility, driving its adoption in aerospace, automotive, and other industries seeking lightweight and intricate components. However, persistent challenges in repeatability, variable mechanical properties, and quality control continue to hinder certification and large-scale production.
In general, developing an optimal AM build requires generating comprehensive datasets and often entails resource-intensive trial-and-error. In particular, for costly processes such as powder bed fusion (PBF), material consumption, operational demands, and the need for an extensive multiscale characterization result in expensive experimental studies and limit the number of repetitions, the investigated scale, and the quantity of coupons that can be produced without major defects. Fused Deposition Modeling (FDM), though based on different material and process physics, exhibits analogous porosity defects (e.g., inter-bead gaps or intra-layer voids) to those observed in PBF. This morphological similarity positions FDM as a potential proxy for the initial study of defect formation and for validating machine learning pipelines for layer-wise prediction. While inferences from the study cannot be directly extended to predict the mechanical performance of PBF-produced parts, this work instead seeks to establish and validate a pipeline for defect types arising from process variability using ML. Because data structures and patterns associated with flaw detection are often agnostic to the specific material system, the focus here is on the geometry, distribution, and topological description of porosity.
FDM illustrates both the potential and limitations of AM. Its affordability and ease of use enable the rapid production of complex designs. The process involves depositing molten thermoplastic beads onto a heated bed, guided by CAD-derived toolpaths, with bead thickness (0.1–0.8 mm) determined by nozzle diameter. However, as with other AM processes, the quality of FDM parts is highly sensitive to input variables, with porosity emerging as an internal defect that critically undermines mechanical performance and hinders certification viability. The existing guidelines define allowable defect levels based on application-specific requirements [1]. The relationships between porosity, mechanical properties, and process parameters remain poorly understood.
The quality of FDM outputs is governed by numerous variables that interact without established physical laws and significantly influence performance. Kechagias et al. [2] reviewed experimental studies on the impact of process parameters on 3D-printed parts: most investigations considered only a few printing variables, were limited to identifying optimal parameter sets through batches of test coupons, and evaluated quality primarily at the coupon level. Few studies addressed numerical optimization, and those focusing on a single part’s characteristics did not yield solutions that could be realistically implemented at an industrial scale. Moreover, not all FDM printers provide full access to or a complete range of process parameters. While considering all parameters and running every combination would be a rigorous strategy, it remains prohibitively time- and cost-intensive. In addition, focusing only on coupon-level builds fails to capture the impact of process parameters on the anisotropic structure of printed parts. Kristiawan et al. [3] further reviewed the factors and input parameters affecting the quality and mechanical properties of FDM parts. They concluded that the relationships between process parameters remain poorly understood, ongoing investigations lack conclusive analytical models, and multiple interlinking variables can either mitigate or exacerbate defects in the resulting parts.
Most current research on FDM focuses on the impact of printing process parameters on the properties of printed parts. Chacón et al. [4] studied the effect of build orientation, layer thickness, and feed rate on the mechanical properties of PLA samples manufactured with a low-cost desktop 3D printer. Because only scattered input values were tested, the results were relevant only to the specific range of variables used. Using a design-of-experiments scheme and focusing on five main parameters, Gebisa et al. [5] found that raster angle and raster width strongly influenced the flexural properties of 3D-printed parts made of ULTEM 9085. However, their results cannot be generalized to other raw materials or mechanical properties, since they rely on a selective subset of input values. Similarly, Durgun et al. [6] investigated different raster angles for principal part orientations and tested specimens for surface roughness, tensile, and flexural strength. Rankouhi et al. [7] examined multiple prints and correlated the elastic modulus and ultimate strength with layer thickness. Their results are useful for decision-making when layer thickness is the key parameter. Other studies have examined printer brands (Stratasys, HP, and EOS) [8], infill percentages [9], and material/temperature effects [10,11], but such results lack generalization due to non-linear parameter interactions and dataset specificity. Conventional physics-based models struggle to capture all these interplaying dynamics, underscoring the need for data-driven approaches.
Machine learning (ML) addresses these gaps by generalizing non-linear functions from limited data and has become a widely used predictive and classification tool in AM. Several studies have reported promising results in materials science for property prediction [12], design [13], and smart manufacturing [14], reducing reliance on costly experimentation. ML methods such as kernel ridge regression have been used to map a material’s fingerprint with its known properties [14]. Frameworks have been developed to predict the properties of a wide variety of materials using decision trees [15] or the wear timeline of tools and the maintenance requirements using different types of neural networks [16,17,18].
FDM defects, in particular porosity, are, therefore, strong candidates for ML investigations, given the number of process parameters and the interactions between them (e.g., print speed, infill density, and temperature; see Figure 1). The existing parameter optimization methods—such as Taguchi designs [19,20,21,22], genetic algorithms [23], and hybrid approaches [24]—focus on dimensional accuracy [25,26,27,28] or mechanical performance [29,30,31]. However, defect prediction, especially porosity, currently relies heavily on statistical models focused on volumetric data (e.g., ANOVA and response surface methodology [32]) or combinatorial algorithms (e.g., BES and PSO [33]), which are limited by experimental scope and material heterogeneity, and do not give insight into the layer-wise buildup of porosity.
For defect investigation, machine learning combined with computed tomography (CT) has become a powerful approach for analyzing porosity [35]. Most published studies to date focus on metal AM, with few directly addressing FDM. For example, Pak et al. [36] applied deep convolutional models to map thermal imaging streams to CT-measured porosity in laser powder bed fusion (LPBF) parts, demonstrating that CNN architectures can localize and quantify porosity with high fidelity against CT data. Similarly, Mohammed et al. [37] trained neural networks directly on CT volumes to predict porosity distribution in LPBF specimens. Wang et al. [38] further introduced a defect-driven, physics-informed neural network framework that embeds melt-pool physics into the learning process, producing more physically consistent defect predictions than black-box ML. In contrast, for FDM processes, published ML studies on internal defects are scarce and have concentrated on in situ anomaly detection rather than CT-based porosity mapping. For instance, Goh et al. [39] implemented real-time ML anomaly detection in fused filament fabrication using thermal and visual sensors, underscoring the feasibility of applying image-based ML for internal defect prediction.
Investigations in metal AM validate the capability of ML architectures—including CNNs, MLPs, and physics-informed models—to predict defects from both imaging and process data. Building on this foundation, the present study focuses on coupling ML architectures with porosity analysis in FDM components. The outcome is an ML-powered pipeline, capable of predicting porosity metrics from experimental batches without requiring extensive or costly testing.

2. Materials and Methods

2.1. Experimental 3D Printing Work

2.1.1. Printing Using FDM

Porosity analysis was conducted using the following coupons:
  • The 5 mm × 5 mm × 5 mm cubes: Referred to as ‘small’ in the rest of this study, it is the standard specimen size for defect assessment in metal additive manufacturing.
  • The 10 mm × 10 mm × 10 mm cube: Referred to as ‘large’ in the rest of this study, it is printed under identical process parameters to evaluate dimensional scalability effects.
A MatterHackers Pulse XE printer (MatterHackers, Inc., Lake Forest, CA, USA) was used to fabricate the coupons, as it is cost-effective, user-friendly, and open-source. Table 1 summarizes the printer’s operational ranges for key variables. The printing material was a PolyLactic Acid (PLA) filament [40] from the MatterHackers Build Series, selected for its wide availability and reliability.
To isolate defect-induced porosity (as opposed to designed porosity), several variables were held constant due to their known or limited impact on print quality:
  • Material: PLA was the only material explored through this investigation. It is widely used, recyclable, and does not require special storage conditions.
  • Bed Temperature: The recommended value for PLA is 80 °C [40].
  • Infill density: Fixed at 100%, since it is mainly for scaffolds and metamaterials with intentional voids.
  • Printing orientation: Z-axis.
The remaining parameters—print temperature, layer height, infill overlap, speed, infill type—were varied within PLA-compatible ranges [41], and within the operational limits of the printer [42], as illustrated in Figure 2. of the 45 theoretically possible combinations, 11 were selected (Table 2) to balance the high cost of CT scanning with the need to sample a diverse region of the parameter space, focusing on combinations expected to produce a broad spectrum of porosity outcomes.

2.1.2. Test Coupons

The coupons were modeled in CATIA V5 Release 31, sliced using the free MatterControl 3D Printing software, version 2.19, and then printed with the combinations of process parameters listed in Table 2. CT scanning was performed using a North Star Imaging X7000 system (North Star Imaging, Inc., Rogers, MN, USA). Initial scans at 10 µm (~4 h per scan) validated file processing workflows, and a 30 µm resolution was ultimately chosen as a compromise between cost and detail (1.5 h per scan). Given the defect tolerances in aerospace (hundreds to thousands of µm), this resolution was sufficient. The CT scan team conducted windowing and gray thresholding, and delivered 3D files readable by the efx-viewer software (Version 2.4.2.2. North Star Imaging, Inc., Rogers, MN, USA). Table 3 summarizes the main scanning features and values.
Each scan produced an efx 3D file, which was processed in efX-viewer to extract cross-sectional slices along the Z-axis (printing direction). Table 4 summarizes the number of slices per specimen set.
Figure 3 summarizes the data pipeline: The CT scanner’s proprietary software efX-ct v2.3.6.0 reconstructs a 3D volume from 2D radiographic projections. The images were exported as 8-bit RGB PNGs, the available option in the efx-viewer, which are compatible with standard CNN libraries and still capture basic porosity defects accurately enough for the current investigation.

2.2. A Convolutional Neural Network for Image Classification

2.2.1. Image Selection

The CT-scanned images varied in quality: some captured the background while others contained incomplete initial layer pixels (Figure 4a,b). Additional images exhibited defective pixels or uneven graying that skewed porosity calculations (Figure 4c). Only images showing complete cross-sections at the center with closed contours (Figure 4d) provided reliable porosity measurements.
Manual sorting of exploitable images is time-consuming and prone to error, often introducing outliers. Increasing the number or size of specimens would exacerbate this problem due to the larger number of slices requiring evaluation. To automate classification, a Convolutional Neural Network (CNN) [43] was selected for its robustness in image classification and ease of implementation and troubleshooting. Figure 5 illustrates the intended workflow of the classifier after training.

2.2.2. Data Preparation

The dataset consists of 226 × 246 RGB PNG images, manually categorized into the following:
  • Defective: Black, overly dark, or incomplete layers, where porosity analysis fails.
  • Exploitable: Center of slice visible and well-formed, complete with closed contours, where porosity analysis succeeds.
To strengthen the CNN’s validation, all the slices from a given cube ID were kept entirely within either the training or testing set. This ensured a rigorous testing of the model’s generalization to unseen prints and prevented data leakage. Table 5 summarizes the number of data points per folder and scale. Most discarded slices primarily originated from the top and bottom layers.

2.2.3. Model Construction

The CNN was implemented in Python 3.12.3 using TensorFlow 2.13 [44] and Keras 2.13 [45] (Google-supported, open-source ML libraries). The sequential architecture comprised convolutional and pooling layers for feature extraction, and fully connected layers for classification. The model was trained using the dataset split per cube ID.
To mitigate potential overfitting or learning issues arising from noise or the limited dataset size, k-fold cross-validation, an established statistical analysis method [46] and standard machine learning evaluation technique [47], was employed. This approach rigorously evaluates the model’s ability to generalize to independent data subsets.
The cross-validation procedure partitions the complete dataset into n equally sized subsets with comparable statistical characteristics. In each iteration, the CNN model is trained on n − 1 combined subsets and tested on the remaining holdout subset. This exhaustive process ensures that every data point is used exactly once for testing while contributing to n − 1 training cycles. Final performance metrics are computed by averaging results across all the folds, with the variance between folds serving as an indicator for model stability.

2.3. Extraction of Porosity Metrics

Porosity is defined as formation of voids or air pockets within a solid material. It compromises mechanical performance by creating stress concentrations at void boundaries. In FDM, porosity typically appears as follows:
  • Inter-bead porosity: Gaps between deposited beads, aligned with the deposition direction (Figure 6a) [48].
  • Inner-bead porosity: Voids within individual beads, generally negligible in homogeneous filaments compared to inter-bead defects (Figure 6b) [49].
Porosity arises when the molten bead exits the print head and pressure is no longer controlled or oriented. Rapid cooling affects viscosity, flowability, and diffusion, leading to the formation of voids.
Traditional porosity analysis, often integrated into CT reconstruction softwares, typically provides a single volumetric porosity percentage for an entire specimen. This scalar value accounts for all defects, including large-scale print failures such as warping, poor bed adhesion, or incomplete layers at the extremities. While useful for quantifying total void content, it offers no information on the spatial distribution or morphology of individual voids, which is critical for understanding mechanical performance and process-induced anomalies. Moreover, it does not provide layer-wise insights into porosity variations. In this study, porosity was calculated on a layer-by-layer basis using the extracted cross-section slices.

2.3.1. Porosity Percentage

Exploitable RGB images sorted by the CNN classifier contain closed-contour cross-sections. The following workflow was used to quantify porosity:
Pixel Analysis: The focus is on internal, isolated porosity defects. For initial segmentation, a global threshold of 50 (RGB scale) was applied to differentiate light pixels (material) from dark pixels (void) within the closed contour. The pixel values were exported to a matrix for quantification (Figure 7).
Sensitivity analysis: To evaluate threshold sensitivity, porosity percentages were recalculated using thresholds of 40 and 60.
Porosity calculation: For each slice, porosity percentage was computed as the ratio of dark pixels to total pixels within the contour. The results were saved as a .csv file with image names, Z-heights, and porosity values according to the workflow described in Figure 8. The Z-height for each slice was calculated as the slice index generated by the efx-viewer multiplied by the slice spacing.
The code is available in the project’s GitHub repository (https://github.com/). The full results are in Appendix A [50].

2.3.2. Porosity Distribution

As discussed in the introduction, studies on AM defects consistently emphasize the importance of correlating porosity distribution characteristics (including location and shape) with the resulting mechanical properties of printed components. To address this systematically, a streamlined algorithm was developed for porosity categorization. This methodology supports the current FDM analysis and establishes a foundation for future defect impact studies across both FDM and other AM processes.
Analysis of the exploitable images revealed two predominant porosity features, which can be effectively characterized using basic geometric shapes:
  • Elliptical voids: These elongated voids typically appear stretched along a primary axis. They arise when two parallel extruded filaments fail to fuse completely during deposition, leaving an interstitial gap aligned with the bead deposition path.
  • Circular voids: These approximately symmetrical voids appear with similar dimensions along all axes. They most often occur in central cross-sections due to insufficient cohesion between adjacent material regions, interlayer bonding deficiencies, or incomplete merging of filament paths.
To quantify these porosity distribution patterns systematically, a specialized image-processing algorithm was developed (Figure 9) with the following workflow:
  • Image Preprocessing:
    • Converts the input RGB image to grayscale.
    • Applies intensity thresholding to isolate porosity features.
    • Performs contour extraction to precisely delineate void regions.
  • Geometric Classification:
    • Employs two distinct mathematical approaches to approximate extracted contours: Covariance matrix analysis combined with eigenvalue decomposition, and Principal Component Analysis (PCA).
    • These methods collectively determine the major/minor axes and spatial orientation of each void.
    • Calculates aspect ratios to classify voids as either elliptical or circular
  • Data Output and Visualization:
    • Generates comprehensive .csv files containing:
      Source image identifiers.
      Corresponding Z-height positions.
      Complete listings of all the classified porosity features with their geometric parameters.
    • Includes optional visualization modules that plot:
      Original extracted contours.
      Mathematically fitted ellipses and circles.
      Comparative overlays showing approximation accuracy.
    • Calculates IoU and plots results:
      Shows how well the elliptical and circular voids capture the morphology of the void.
      Plots indicators.
The algorithm processes entire directories of images in batch mode, ensuring consistent analysis while allowing inspection of individual images when required. This dual capability supports both large-scale statistical analysis and detailed examination of specific porosity formations.

2.3.3. Repeatability Study

Three-dimensional printing is known to produce variable results for the same part, even under identical conditions. To quantify the intrinsic process variability under controlled conditions and establish a preliminary tolerance threshold for porosity variation, a repeatability study was conducted. Due to CT scanning cost and specimen availability, this analysis was limited to three specimens. The study provides initial insights while establishing the methodology. For better compliance with the statistical guidelines of aerospace standards, established sources such as NCAMP [51] recommend 10–15 specimens per batch for 3–5 batches. These guidelines are for mechanical characterization at the coupon level, however, and do not address defect quantification.
The three small cubes (see Figure 10) were printed using identical process parameters (see Table 6) under consistent ambient conditions. Each specimen underwent the following:
  • Fabricated in separate print jobs (first/mid/last prints of the day).
  • CT scanned individually at 30 µm resolution (1 h 15 min per scan).
  • Reconstructed as 3D models using the scanner’s proprietary software.

2.4. A Multi-Layer Perceptron for Porosity Prediction

Predicting porosity based on independent variables with no established analytical correlation and using a finite dataset requires a robust regression approach. A multi-layer perceptron (MLP) was selected for its ability to model complex, non-linear relationships between printing parameters and porosity. Implemented using Keras [45], the feedforward neural network (Figure 11) is flexible and scalable for regression tasks.

2.4.1. Data Preparation

Exploitable images filtered by the CNN classifier were processed to generate porosity percentages per Z-height, resulting in tabulated input–output pairs (Table 7).
Table 8 illustrates an example dataset combining printing parameters with the corresponding porosity measurements.

2.4.2. Model Construction

The MLP was implemented using the Scikit-Learn library [52], one of the most widely adopted and documented ML libraries for Python. This MLP functions as a regression model, accepting the comprehensive set of printing variables (Table 6) as inputs and predicting porosity percentage as its single output. As a rule-of-thumb, the initial architecture is a simple one (2 hidden layers, 100 neurons), and complexity is progressively added as needed, based on performance evaluation and fine-tuning. The Adam optimizer was used with a default learning rate η = 0.001, known for stable convergence. Key aspects of the network initialization included the following:
  • Data-Determined Parameters: Certain features were explicitly defined by the structure of the experimental data, such as the output layer—it consists of precisely one neuron, corresponding directly to the single output variable (porosity percentage).
  • Empirically validated defaults: Other parameters were selected based on their established performance in similar regression applications:
    ReLU (Rectified Linear Unit) as the activation function, effective in regression tasks.
    Mean Squared Error (MSE) as the loss function, a standard for continuous value prediction tasks.
  • Computationally optimized choices: The remaining configuration options were implemented to balance model performance with practical computational constraints:
    Adam optimizer (η = 0.001) for efficient gradient-based weight updates.
    A total of 1000 iterations specified as the initial training cycle count.
    Random seed fixed at 42 to ensure reproducibility.
This initialization ensures baseline configurations while allowing flexibility for hyperparameter tuning.
The model construction workflow is summarized in Figure 12:
  • Preprocessing:
    Normalization/scaling of input features.
    Categorical encoding of string variables (e.g., infill type).
    Randomized training.
  • Cross-Validation:
    k-fold partitioning to assess generalization.
    Iterative training on k-1 subsets with testing on held-out data.
    Averaged metrics across all folds.
  • Bias Mitigation:
    Script-enforced random sampling.
    Validation against parameter variability (scale/type/range).
Consistent with the CNN dataset splitting strategy, MLP training data was organized by cube ID to prevent data leakage between training and testing sets, and k-fold cross-validation was used to further strengthen the training and testing.

2.5. Dimensional Scalability Investigation

To evaluate the effect of scaling dimensions on porosity defects and explore potential correlations across sizes, a dimensional scalability study was performed using data from the large cubes. The CNN classifier, trained on small cubes, was used to classify the large-cube slices. The same methodology for porosity analysis of the small cubes was replicated for the larger specimens to ensure consistency and comparability of results (Table 9).
The MLP initial configuration mirrored the one used for small cubes. Initial training iterations typically did not yield optimal results, necessitating careful fine-tuning to develop an accurate predictor while minimizing information loss. The final architecture of the MLP for large cubes is in Table A3.

3. Results

3.1. CNN Image Classifier

To automate classification of CT slices into ‘exploitable’ and ‘defective’ categories, a Convolutional Neural Network (CNN) was developed. The small-cube dataset was composed of approximately 2200 images, with 75% labeled as ‘exploitable’, and the remainder as ‘defective’. The CNN underwent several training iterations for hyperparameter fine-tuning and employed transfer learning to leverage pre-learned features for improved generalization. The VGG16 architecture [53], pre-trained on ImageNet [54], was used as the feature extraction backbone.
The classifier consisted of a global average pooling layer followed by two dense layers (128 and 1 neurons). To mitigate overfitting, a dropout layer (rate = 0.5) was applied. The model was compiled with the Adam optimizer and used binary cross-entropy as the loss function. Final architectural and training parameters are provided in Table A1.
Four metrics were used to assess the performance of the CNN classifier: precision, recall, F1-score, and overall accuracy, averaged across five folds. The CNN demonstrated high and consistent performance, as detailed in Table 10, achieving an average accuracy of 97.2% ± 0.014 in the classification task. The ‘exploitable’ class showed slightly higher performance metrics than the ‘defective’ class. This was likely due to the larger number of ‘exploitable’ images. Confusion matrices for each fold (see Figure A1) further confirm the model’s classification capability across both classes.
The optimized classifier was subsequently applied to the large-cube images, yielding satisfactory results. Table 11 summarizes the classification outcomes: The overall average error in identifying defective images was 12.7% compared to 2.6% for the exploitable ones. As with the small-cube dataset, the large-cube dataset contains more exploitable than defective images, explaining the higher prediction accuracy for the exploitable class.

3.2. Porosity Analysis

Following the CNN classification, porosity analysis was performed on the exploitable images from both the small- and large-cube datasets. The developed scripts successfully quantified porosity percentages and spatial distributions per slice. As an example, Figure 13 summarizes the porosity characteristics for small cube ID 1-190-100-35-30-Grid. Most porosity instances fell within 1.5–1.75%, while the highest porosity values, exceeding 2.5%, occurred in the central layers and after the initial ones.
The sensitivity analysis confirmed the robustness of the porosity measurements: variations across threshold values were less than 0.12%, validating the segmentation approach and supporting the use of 50 as a global threshold value.
The visualization in Figure 14 allows qualitative assessment of porosity distributions and comparison of the void morphology to idealized elliptical or circular shapes. Quantitatively, the intersection over union (IoU) was used to evaluate model prediction performance. For small cube ID 1-190-100-35-30-Grid, the IoU ranged from within 0.2–0.4 for circular fits and was near 0.0 for elliptical fits, indicating that basic geometric approximations, while qualitatively capturing spatial distributions, poorly fit the void morphologies, particularly for the elliptical ones.

3.3. Investigation on Repeatability

Even under identical printing parameters and controlled environmental conditions, other uncontrolled process phenomena may influence porosity. To evaluate this, a repeatability framework was implemented using three small printed specimens produced under the same conditions.
The workflow generated images for each specimen, revealing two dominant porosity morphologies:
  • Elliptical voids (Table 12 column 1): Elongated inter-bead voids resulting from insufficient cohesion between parallel deposited beads.
  • Circular voids (Table 12 column 2): Localized spherical voids forming at bead boundaries due to incomplete interlayer fusion.
Figure 15 illustrates cases of predominant elliptical porosity, predominant circular porosity, and mixed morphologies in the cross-sections of specimens 11-1, 11-2, and 11-3. After CNN-based image classification, the porosity analysis scripts processed all qualified cross-sections, producing a comprehensive .csv with porosity percentage and distribution. Table 12 summarizes the main findings from the data.
Key observations from the repeatability analysis include the following:
  • Maximum porosity variation of 0.5% between specimens.
  • Consistently low variance values, at 0.0001.
  • Average porosity ranging from 1.85% to 2.36%.
The initial height at which reliable porosity measurements could be obtained varied across specimens. Specimen 11-3 exhibited valid measurements as early as 297 μm, compared to 11-1 (540 μm) and 11-2 (432 μm). This discrepancy may be attributed to inconsistent initial layer deposition, as illustrated in Figure 16, which compares cross-sections at 297 μm:
  • Specimen 11-1 exhibits incomplete layer formation.
  • Specimen 11-2 lacks closed contours.
  • Specimen 11-3 demonstrates ideal contour integrity.
Smoothing splines with cross-validated regularization were used to characterize the scattered porosity measurements across the build height. Model-to-model variability was quantified by evaluating the three independently fitted splines at a common set of N = 200 points along the height axis. The standard deviation σ(z) at each height z was calculated as the sample standard deviation of the three spline-predicted porosity values following Equation (1):
σ ( z )   =   i = 1 M ( y i z   μ ( z ) ) 2 M 1
where M = 3 is the number of samples, yi(z) is the spline-predicted porosity for sample i at height z, and μ(z) is the mean porosity across samples at that height. This approach generates an average porosity distribution along with a corresponding uncertainty zone (±1σ).
Figure 17 summarizes the repeatability study findings: Cross-validation identified an optimal smoothing parameter of s = 0.01 for all three datasets, indicating consistent data structure and noise levels. The spline fits achieved strong agreement with the uncertainty metrics, summarized in Table 13. The mean standard deviation was 0.47% with a maximum standard deviation of 1.49% porosity across the build height. The relative uncertainty, expressed as the ratio of the standard deviation to the mean porosity, was 21.55%. The pairwise RMS differences between the datasets were low, ranging from 0.0066 to 0.0087, with an average of 0.0074. These quantitative results indicate a high degree of consistency and repeatability in the porosity measurement process across different samples printed under identical conditions.
These patterns suggest a significant thermal influence during printing, particularly in interlayer cooling dynamics. While precise thermal control falls beyond this study’s scope, the data provide a quantitative basis for defining porosity variation thresholds.
Current aerospace validation protocols lack standardized frameworks for defect quantification. Existing specifications, such as MSFC-STD-3716 [55], mandate less than a few percent variation for critical additively manufactured components, while NCAMP guidelines [51] only address coupon levels and recommend statistical evaluation across 10–15 specimens per batch for 3–5 batches during mechanical characterization. Although no standard explicitly addresses defect distribution within a multiscale frame, the observed ±0.47% variation margin can inform machine learning models, enabling data-driven process optimization while maintaining quality control during production scaling.

3.4. Porosity Prediction

The developed MLP model demonstrated the capability for porosity prediction. The final features of the small-cube MLP are available in the Table A2. The overall cross-validation MSE is 0.200 ± 0.135, and the R2 for the small-cube full dataset is 0.544. Figure 18 shows a comparison between the predicted porosity and the actual one.
The large-cube dataset was then used to train the MLP. Increased data points improved the results. The model achieved an overall cross-validation MSE is 0.125 ± 0.275, while the full dataset R2 increased to 0.776. The final architecture for the MLP trained on the large-cube dataset is reported in Table A3, with the updated prediction–observation comparison shown in Figure 19.
Overall, the finalized MLP framework trained on the large-cube dataset provides more accurate porosity percentage predictions across the parameter space of input printing variables and layer height coordinates. These results establish a robust computational foundation for quality assessment in additive manufacturing applications.

3.5. Scalability Investigation

The developed CNN and MLP models and the porosity analysis scripts demonstrated successful applicability to 10 mm × 10 mm × 10 mm specimens, confirming the pipeline’s adaptability for larger geometries and enabling rapid porosity analysis at increased scales.
To enable direct comparison of porosity profiles between cubes of different sizes (5 mm and 10 mm), and potentially different measurement resolutions, a two-step normalization strategy was followed. The physical height of each cube was min–max normalized to a dimensionless range of [0, 1], representing the relative position from the bottom (0) to the top (1) of each sample, according to Equation (2)
Z n o r m = Z Z m i n Z m a x Z m i n
Independently, each cube’s porosity values were min–max normalized to a [0, 1] range based on their respective observed minima and maxima, following Equation (3).
P n o r m = P P m i n P m a x P m i n
To ensure equal sampling resolution, porosity data from the larger cubes was linearly interpolated onto the normalized height coordinates of the smaller cube. This allowed robust, scale-invariant statistical comparison of porosity distribution morphologies.
Figure 20 illustrates the normalized porosity profiles for representative small and large cube IDs. No systematic trend was observed linking porosity behavior between the small and large specimens. Instead, each process-parameter combination produced distinct porosity distributions, further emphasizing process sensitivity.
Statistical analysis, summarized in Table 14 and Table 15, further highlights this lack of scalability. The average correlation coefficient was only 0.34, while the consistently extreme T-statistics (avg. 4.52) and p-values averaging 0.15 further confirm that differences between small- and large-cube porosity distributions are statistically significant and not due to random variation. Moreover, small cubes exhibited 69% higher mean porosity, quantitatively demonstrating a pronounced scale effect in defects within the FDM-printed components.
Considering the lack of standardized thresholds for porosity distribution in current aerospace and AM standards, the observed scale effect (small cubes having ~69% higher mean porosity) and repeatability margin (±0.47%) offer an empirical basis for defining component-specific tolerances. These could align with existing reporting and inspection standards (such as FAA AC 33.15-3 [56] and ASTM F2971 [57]) to strengthen qualification protocols, especially as AM parts are scaled up.

4. Conclusions and Future Prospects

This work established a machine learning framework for porosity analysis and prediction in FDM, demonstrating that data-driven approaches can reduce trial-and-error costs while addressing scale-dependent defect formation. The pipeline, initially developed for small cubes and later applied to larger cubes, proved adaptable to new data and represents a first step toward a digital twin for porosity analysis and prediction, with quantified uncertainty for every model.

4.1. Key Findings

The investigation yielded five principal outcomes:
  • Porosity Analysis: Development of a modular algorithmic framework capable of layer-specific porosity quantification (percentage, void location, and classification into ellipse- or circle-like geometries), offering insight into the anisotropic and heterogeneous nature of FDM components.
  • Repeatability study: Establishment of a methodology to assess process variability under identical parameters, showing consistent porosity measurements within ±0.47% variation bounds.
  • Porosity Prediction: Implementation of convolutional and perceptron networks, achieving over 90% classification accuracy for CNN, an R2 of 54.4% for MLP on small cubes, increasing to 77.6% on the large ones.
  • Dimensional Scalability Effects: Component scale significantly influences porosity characteristics. Despite identical printing conditions, 10 mm × 10 mm × 10 mm specimens exhibited distribution patterns distinct from their 5 mm × 5 mm × 5 mm counterparts. Statistical analysis confirmed systematic differences, with an average correlation coefficient of 0.34, consistently extreme T-statistics (avg. 4.52) and p-values (avg. 0.15), thus confirming porosity distributions between small and large cubes are fundamentally different.
  • Industrial Relevance: Development of practical predictive tools to reduce empirical parameter optimization and enable model transfer to higher-cost AM processes.

4.2. Limitations of the Present Research

The following work exhibits four primary constraints:
  • Dataset Diversity: The multiscale analysis was restricted to cubic geometries at micro/meso-scales, limiting direct extrapolation to full-scale components.
  • Vertical porosity distribution: Exported slices were along the vertical direction. Including additional orthogonal orientations would strengthen porosity distribution assessment.
  • Model Complexity: The CNN-MLP framework may not capture all porosity formation mechanisms under non-standard printing conditions or atypical defect morphologies.
  • Validation scope: The repeatability assessment would benefit from a larger sample size to strengthen variation quantifications.
  • Material Focus: While PLA was used to establish a cost-effective methodological pipeline, the framework is material-agnostic and should be validated on other polymers such as ABS and Nylon.

4.3. Recommendations for Future Work

  • Expanding datasets to include more materials, geometries, and machine parameters, while incorporating geometric descriptors (e.g., volume, surface-area-to-volume ratio, and critical distances from edges) to improve model robustness and generalizability.
  • Enhance ML capabilities to predict void morphologies and their distribution along the build height.
  • Develop data-driven models to explore parameter interactions and establish phenomenological laws for cross-scale porosity prediction.
  • Extend the framework to PBF processes, where datasets are more expensive to obtain, allowing exploration of the assumption that low-cost AM data can inform defect prediction in high-cost processes.

4.4. Industry Impact

Based on the research conducted so far, the following recommendations are proposed:
  • Parameter Optimization: Applying identified process windows to minimize porosity, with validation for specific material-machine combinations.
  • ML System Integration: Deployment of the trained models as quality control modules within existing AM workflow softwares for continuous monitoring.
  • Knowledge Transfer: Testing the transfer of porosity prediction between different FDM machines.
Impact would then be measured in the following areas:
  • Quality Assurance: The integration of ML models provides real-time predictive insights, allowing proactive parameter adjustments to enhance part reliability.
  • Cost Efficiency: By replacing trial-and-error methods with data-driven approaches, production costs and time can be minimized.
  • Methodological Innovation: The hybrid ML framework establishes a scalable template for quality assessment across AM technologies and materials.
  • Cross-Sectoral Applicability: The findings demonstrated capabilities directly addressing stringent reliability requirements in aerospace and medical device manufacturing.

Author Contributions

K.O.: Writing—original draft, conceptualization, validation, methodology, investigation, and formal analysis. J.E.S.: Supervision, formal analysis, methodology, investigation, and writing—review and editing. G.O.: Supervision, investigation, funding acquisition, resources, and writing—review and editing. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

The authors thank the financial support of the Advanced Virtual & Engineering Testing Laboratories of NIAR. They are also grateful for the work of Brian Matzen from NIAR, as well as his team of students, who conducted the CT scan of specimens.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
BESBald Eagle Search
PSOParticle Swarm Optimization
MLMachine Learning
AMAdditive Manufacturing
FDMFused Deposition Modeling
CNNConvolutional Neural Network
MLPMulti-Layer Perceptron
MSEMean Squared Error
PCAPrincipal Component Analysis
ReLURectified Linear Unit

Appendix A

Table A1. Final CNN architecture and training parameters.
Table A1. Final CNN architecture and training parameters.
FeatureValueComment
Classes2 (Defective, Exploitable)Binary classification task
CNN Network’s TypeSequentialLinear layer stack for straightforward image processing
Convolutional Layers3Initial depth for feature extraction
Pooling Layers3Downsampling to reduce spatial dimensions
Fully Connected Layers2Final layers for classification
Batch size10Balances memory usage and gradient stability
Epoch15Initial training cycles
Activation Function 1ReLUFor non-linearity
Activation Function 2SigmoidFor binary probabilities.
Dataset size2282Number of images
Figure A1. Confusion matrices of the CNN classifier over 5-fold grouped cross-validation for the small-cube dataset.
Figure A1. Confusion matrices of the CNN classifier over 5-fold grouped cross-validation for the small-cube dataset.
Materials 18 04499 g0a1
Table A2. Final MLP configuration for small cubes.
Table A2. Final MLP configuration for small cubes.
Network’s FeaturesValueComments
hidden_layer_sizes(200, 100)Two hidden layers with 200 and 100 neurons, respectively
activationReLUBest candidate for empirical success in regression
output LayerOne neuronSingle output (porosity)
optimizerAdamStochastic gradient-based optimization
learning_rate_init0.00597Initial learning rate for Adam optimizer
alpha0.001835L2 Regularization
batch_size32Batch size for stochastic optimization
beta_10.99Exponential decay rate for first moment estimates
beta_20.999Exponential decay rate for second moment estimates
early_stoppingTrueValidation-based early stopping
n_iter_no_change20Number of iterations with no improvement to wait before stopping
max_iter1000Maximum number of iterations
Random seed42Reproducibility
Total number of data1708Full dataset
Epoch100Total number of iterations of all the training data in one cycle
Table A3. Final MLP configuration for large cubes.
Table A3. Final MLP configuration for large cubes.
Network’s FeaturesValueComments
hidden_layer_sizes(200, 100)Two hidden layers with 200 and 100 neurons, respectively
activationReLUBest candidate for empirical success in regression
output LayerOne neuronSingle output (porosity)
optimizerAdamStochastic gradient-based optimization
learning_rate_init0.0066Initial learning rate for Adam optimizer
alpha0.0069L2 Regularization
batch_size32Batch size for stochastic optimization
beta_10.95Exponential decay rate for first moment estimates
beta_20.999Exponential decay rate for second moment estimates
early_stoppingTrueValidation-based early stopping
n_iter_no_change20Number of iterations with no improvement to wait before stopping
max_iter1000Maximum number of iterations
Random seed42Reproducibility
Total number of data3745Full dataset
Epoch100Total number of iterations of all the training data in one cycle

References

  1. Jonas, P.; Tomblin, J.; Lovingfoss, R.; Andrulonis, R.; Davies, C. Polymer Additive Manufacturing Materials, Machine, Processing and Quality Requirements Specification for ULTEM 9085 and Stratasys Inc. Fortus 900mc Machine. 2019. Available online: https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.wichita.edu/industry_and_defense/NIAR/Documents/NPS-89085-Rev-C-Process-Spec-March-12-2019.pdf&ved=2ahUKEwin1OPbnfWPAxUyj68BHUxKKe4QFnoECBoQAQ&usg=AOvVaw2tCjiR7PMBY-gqbaryI80J (accessed on 22 September 2025).
  2. Kechagias, J.; Zaoutsos, S. Effects of 3D-printing processing parameters on FFF parts’ porosity: Outlook and trends. Mater. Manuf. Process. 2024, 39, 804–814. [Google Scholar] [CrossRef]
  3. Kristiawan, R.B.; Imaduddin, F.; Ariawan, D.; Ubaidillah; Arifin, Z. A review on the fused deposition modeling (FDM) 3D printing: Filament processing, materials, and printing parameters. Open Eng. 2021, 11, 639–649. [Google Scholar] [CrossRef]
  4. Chacón, J.M.; Caminero, M.A.; García-Plaza, E.; Núñez, P.J. Additive manufacturing of PLA structures using fused deposition modelling: Effect of process parameters on mechanical properties and their optimal selection. Mater. Des. 2017, 124, 143–157. [Google Scholar] [CrossRef]
  5. Gebisa, A.; Lemu, H. Investigating Effects of Fused-Deposition Modeling (FDM) Processing Parameters on Flexural Properties of ULTEM 9085 using Designed Experiment. Materials 2018, 11, 500. [Google Scholar] [CrossRef]
  6. Durgun, I.; Ertan, R. Experimental investigation of FDM process for improvement of mechanical properties and production cost. Rapid Prototyp. J. 2014, 20, 228–235. [Google Scholar] [CrossRef]
  7. Rankouhi, B.; Javadpour, S.; Delfanian, F.; Letcher, T. Failure Analysis and Mechanical Characterization of 3D Printed ABS with Respect to Layer Thickness and Orientation. J. Fail. Anal. Prev. 2016, 16, 467–481. [Google Scholar] [CrossRef]
  8. Reindl, T.; Meisner, D.; Hierl, S. Benchmarking of Plastic-Based Additive Manufacturing Processes. RTe J. 2023, 1–20. [Google Scholar] [CrossRef]
  9. Kamaal, M.; Anas, M.; Rastogi, H.; Bhardwaj, N.; Rahaman, A. Effect of FDM process parameters on mechanical properties of 3D-printed carbon fibre–PLA composite. Prog. Addit. Manuf. 2021, 6, 63–69. [Google Scholar] [CrossRef]
  10. Ding, S.; Zou, B.; Wang, P.; Ding, H. Effects of nozzle temperature and building orientation on mechanical properties and microstructure of PEEK and PEI printed by 3D-FDM. Polym. Test. 2019, 78, 105948. [Google Scholar] [CrossRef]
  11. Sehhat, M.H.; Mahdianikhotbesara, A.; Yadegari, F. Impact of temperature and material variation on mechanical properties of parts fabricated with fused deposition modeling (FDM) additive manufacturing. Int. J. Adv. Manuf. Technol. 2022, 120, 4791–4801. [Google Scholar] [CrossRef]
  12. Zhou, T.; Song, Z.; Sundmacher, K. Big Data Creates New Opportunities for Materials Research: A Review on Methods and Applications of Machine Learning for Materials Design. Engineering 2019, 5, 1017–1026. [Google Scholar] [CrossRef]
  13. Paul, A.; Acar, P.; Liao, W.; Choudhary, A.; Sundararaghavan, V.; Agrawal, A. Microstructure optimization with constrained design objectives using machine learning-based feedback-aware data-generation. Comput. Mater. Sci. 2019, 160, 334–351. [Google Scholar] [CrossRef]
  14. Sharp, M.; Ak, R.; Hedberg, T. A survey of the advancing use and development of machine learning in smart manufacturing. J. Manuf. Syst. 2018, 48, 170–179. [Google Scholar] [CrossRef]
  15. Pilania, G.; Wang, C.; Jiang, X.; Rajasekaran, S.; Ramprasad, R. Accelerating materials property predictions using machine learning. Sci. Rep. 2013, 3, 2810. [Google Scholar] [CrossRef] [PubMed]
  16. Ward, L.; Agrawal, A.; Choudhary, A.; Wolverton, C. A general-purpose machine learning framework for predicting properties of inorganic materials. npj Comput. Mater. 2016, 2, 1–7. [Google Scholar] [CrossRef]
  17. Wang, J.; Ma, Y.; Zhang, L.; Gao, R.X.; Wu, D. Deep learning for smart manufacturing: Methods and applications. J. Manuf. Syst. 2018, 48, 144–156. [Google Scholar] [CrossRef]
  18. Wu, D.; Jennings, C.; Terpenny, J.; Gao, R.X.; Kumara, S. A Comparative Study on Machine Learning Algorithms for Smart Manufacturing: Tool Wear Prediction Using Random Forests. J. Manuf. Sci. Eng. 2017, 139, 71018. [Google Scholar] [CrossRef]
  19. Taguchi, G. Introduction to Quality Engineering: Designing Quality into Products and Processes; Quality Resources: Cleveland, OH, USA, 1986. [Google Scholar]
  20. Heidari-Rarani, M.; Ezati, N.; Sadeghi, P.; Badrossamay, M. Optimization of FDM process parameters for tensile properties of polylactic acid specimens using Taguchi design of experiment method. J. Thermoplast. Compos. Mater. 2022, 35, 2435–2452. [Google Scholar] [CrossRef]
  21. Anitha, R.; Arunachalam, S.; Radhakrishnan, P. Critical parameters influencing the quality of prototypes in fused deposition modelling. J. Mater. Process. Technol. 2001, 118, 385–388. [Google Scholar] [CrossRef]
  22. Wang, C.C.; Lin, T.; Hu, S. Optimizing the rapid prototyping process by integrating the Taguchi method with the Gray relational analysis. Rapid Prototyp. J. 2007, 13, 304–315. [Google Scholar] [CrossRef]
  23. Thrimurthulu, K.; Pandey, P.M.; Reddy, N.V. Optimum part deposition orientation in fused deposition modeling. Int. J. Mach. Tools Manuf. 2004, 44, 585–594. [Google Scholar] [CrossRef]
  24. Nancharaiah, T.; Raju, D.; Raju, V. An experimental investigation on surface quality and dimensional accuracy of FDM components. Int J Emerg Technol 2010, 1, 106–111. [Google Scholar]
  25. Akande, S. Dimensional Accuracy and Surface Finish Optimization of Fused Deposition Modelling Parts using Desirability Function Analysis. Int. J. Eng. Res. 2015, 4, 196–202. [Google Scholar] [CrossRef]
  26. Zhang, J.W.; Peng, A.H. Process-Parameter Optimization for Fused Deposition Modeling Based on Taguchi Method. Advanced Materials Research 2012, 538–541, 444–447. [Google Scholar] [CrossRef]
  27. Zhang, Y.; Chou, K. A parametric study of part distortions in fused deposition modelling using three-dimensional finite element analysis. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2008, 222, 959–968. [Google Scholar] [CrossRef]
  28. Sood, A.K.; Ohdar, R.K.; Mahapatra, S.S. Improving dimensional accuracy of Fused Deposition Modelling processed part using grey Taguchi method. Mater. Des. 2009, 30, 4243–4252. [Google Scholar] [CrossRef]
  29. Lee, B.H.; Abdullah, J.; Khan, Z. Optimization of Rapid Prototyping Parameters for Production of Flexible ABS Object. J. Mater. Process. Technol. 2005, 169, 54–61. [Google Scholar] [CrossRef]
  30. Torres, J.; Cotelo, J.; Karl, J.; Gordon, A.P. Mechanical Property Optimization of FDM PLA in Shear with Multiple Objectives. JOM 2015, 67, 1183–1193. [Google Scholar] [CrossRef]
  31. Garg, A.; Tai, K. An Ensemble Approach of Machine Learning in Evaluation of Mechanical Property of the Rapid Prototyping Fabricated Prototype. Appl. Mech. Mater. 2014, 575, 493–496. [Google Scholar] [CrossRef]
  32. Mohamed, O.A.; Masood, S.H.; Bhowmik, J.L. Mathematical modeling and FDM process parameters optimization using response surface methodology based on Q-optimal design. Appl. Math. Model. 2016, 40, 10052–10073. [Google Scholar] [CrossRef]
  33. Chandrashekarappa, M.P.G.; Chate, G.R.; Parashivamurthy, V.; Kumar, B.S.; Bandukwala, M.A.N.; Kaisar, A.; Giasin, K.; Pimenov, D.Y.; Wojciechowski, S. Analysis and Optimization of Dimensional Accuracy and Porosity of High Impact Polystyrene Material Printed by FDM Process: PSO, JAYA, Rao, and Bald Eagle Search Algorithms. Materials 2021, 14, 7479. [Google Scholar] [CrossRef]
  34. Equbal, A.; Equbal, M.; Sood, A.K.; Ravindrannair, P.; Equbal, M. A Review and Reflection on Part Quality Improvement of Fused Deposition Modelled Parts. IOP Conf. Ser. Mater. Sci. Eng. 2018, 455, 12072. [Google Scholar] [CrossRef]
  35. Al-Maharma, A.Y.; Patil, S.P.; Markert, B. Effects of porosity on the mechanical properties of additively manufactured components: A critical review. Mater. Res. Express 2020, 7, 122001. [Google Scholar] [CrossRef]
  36. Pak, P.M.-W.; Ogoke, F.; Polonsky, A.; Garland, A.; Bolintineanu, D.S.; Moser, D.R.; Heiden, M.J.; Farimani, A.B. ThermoPore: Predicting Part Porosity Based on Thermal Images Using Deep Learning. arXiv 2024, arXiv:2404.16882. [Google Scholar] [CrossRef]
  37. Mohammed, A.S.; Almutahhar, M.; Sattar, K.; AlHajeri, A.; Nazir, A.; Ali, U. Deep learning based porosity prediction for additively manufactured laser powder-bed fusion parts. J. Mater. Res. Technol. 2023, 27, 7330–7335. [Google Scholar] [CrossRef]
  38. Wang, L.; Zhu, S.-P.; Luo, C.; Niu, X.; He, J.-C. Defect-driven physics-informed neural network framework for fatigue life prediction of additively manufactured materials. Philos. Trans. R. Soc. A Math. Phys. Eng. Sci. 2023, 381, 20220386. [Google Scholar] [CrossRef]
  39. Goh, G.D.; Hamzah, N.M.B.; Yeong, W.Y. Anomaly Detection in Fused Filament Fabrication Using Machine Learning. 3D Print. Addit. Manuf. 2023, 10, 428–437. [Google Scholar] [CrossRef]
  40. Ultimaker. Technical Data Sheet: PLA. MatterHackers. Available online: https://www.matterhackers.com/downloads/AMIfv94gLougK1mY_0WwRUphoscP3graPFaxdGJFrDA0eh-kG-OqeFXz9tiU9QQNfIIB9zldfqy5IfV-oSHeoIEwcvui5_r3gDVHy5IIYGsHa52OJCSSlJrqnfNE0KYcdPJfo8_Ojh3chdeG0JALLK9s1UwzA3OAIclUQ8atpJDZXB1vaSOUe04.pdf (accessed on 23 September 2025).
  41. MatterHackers. Technical Data Sheet—Build Series PLA. MatterHackers. Available online: https://www.matterhackers.com/r/d0cX8m (accessed on 23 September 2025).
  42. MatterHackers. Pulse 3D Printer. Available online: https://www.matterhackers.com/store/l/pulse-3d-printer (accessed on 19 September 2025).
  43. Schmidhuber, J. Deep Learning in Neural Networks: An Overview. Neural Netw. 2015, 61, 85–117. [Google Scholar] [CrossRef]
  44. Pang, B.; Nijkamp, E.; Wu, Y.N. Deep Learning with TensorFlow: A Review. J. Educ. Behav. Stat. 2020, 45, 227–248. [Google Scholar] [CrossRef]
  45. Ketkar, N. Introduction to Keras in Deep Learning with Python: A Hands-on Introduction; Ketkar, N., Ed.; Apress: Berkeley, CA, USA, 2017; pp. 97–111. [Google Scholar] [CrossRef]
  46. Fisher, R.A. Statistical Methods for Research Workers. In Breakthroughs in Statistics; Kotz, S., Johnson, N.L., Eds.; Springer: New York, NY, USA, 1992; pp. 66–70. [Google Scholar] [CrossRef]
  47. Kohavi, R. A Study of Cross-Validation and Bootstrap for Accuracy Estimation and Model Selection. In Proceedings of the 14th International Joint Conference on Artificial Intelligence—Volume 2, Montreal, QC, Canada, 20–25 August 1995; ACM Digital Library: New York, NY, USA, 1995. Available online: https://dl.acm.org/doi/10.5555/1643031.1643047 (accessed on 30 October 2024).
  48. Vieweger, D.; Diel, S.; Schweiger, H.-G.; Tetzlaff, U. Mechanical Properties of Raw Filaments and Printed Specimens: Effects of Fiber Reinforcements and Process Parameters. Polymers 2024, 16, 1576. [Google Scholar] [CrossRef]
  49. Keleş, Ö.; Anderson, E.H.; Huynh, J.; Gelb, J.; Freund, J.; Karakoç, A. Stochastic fracture of additively manufactured porous composites. Sci. Rep. 2018, 8, 15437. [Google Scholar] [CrossRef] [PubMed]
  50. Ouajjani, K. Leveraging Machine Learning for Porosity Prediction in Additive Manufacturing: Case of Fused Deposition Modeling. Ph.D. Thesis, Wichita State University, Wichita, KS, USA, 2024. Available online: https://hdl.handle.net/10057/29169 (accessed on 19 September 2025).
  51. Clarkson, E. Stratasys Certified ULTEMTM 9085 Fortus 900mc Additively Manufactured Polymer Material Qualification Statistical Analysis Report; Wichita State University: Wichita, KS, USA, 2019. [Google Scholar]
  52. Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-learn: Machine Learning in Python. J. Mach. Learn. Res. 2011, 12, 2825–2830. [Google Scholar]
  53. Simonyan, K.; Zisserman, A. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv 2015, arXiv:1409.1556. [Google Scholar] [CrossRef]
  54. Deng, J.; Dong, W.; Socher, R.; Li, L.-J.; Li, K.; Fei-Fei, L. ImageNet: A large-scale hierarchical image database. In Proceedings of the 2009 IEEE Conference on Computer Vision and Pattern Recognition, Miami, FL, USA, 20–25 June 2009; pp. 248–255. [Google Scholar] [CrossRef]
  55. MSFC-STD-3716; Standard for Additively Manufactured Spaceflight Hardware by Laser Powder Bed Fusion in Metals. Marshall Space Flight Center: Huntsville, Alabama, 2017. Available online: https://standards.nasa.gov/standard/MSFC/MSFC-STD-3716 (accessed on 17 September 2025).
  56. Federal Aviation Administration. AC 33.15-3—Powder Bed Fusion Additive Manufacturing Process for Aircraft Engine Parts; Federal Aviation Administration (FAA): Washington, DC, USA, 2023. Available online: https://www.faa.gov/regulations_policies/advisory_circulars/index.cfm/go/document.information/documentID/1041938 (accessed on 17 September 2025).
  57. ASTM F2971; Standard Practice for Reporting Data for Test Specimens Prepared by Additive Manufacturing. ASTM International: West Conshohocken, PA, USA, 2021. Available online: https://store.astm.org/f2971-13r21.html (accessed on 17 September 2025).
Figure 1. Main input variables impacting FDM print outcome (the impact of properties marked with * is unknown) [34] (available via CC BY).
Figure 1. Main input variables impacting FDM print outcome (the impact of properties marked with * is unknown) [34] (available via CC BY).
Materials 18 04499 g001
Figure 2. Varied process parameters for printing.
Figure 2. Varied process parameters for printing.
Materials 18 04499 g002
Figure 3. Process of image extraction: (a) 3D-printed cube, (b) digital file from the CT scan software, (c) generated 2D images of the cross-section along the z-axis.
Figure 3. Process of image extraction: (a) 3D-printed cube, (b) digital file from the CT scan software, (c) generated 2D images of the cross-section along the z-axis.
Materials 18 04499 g003
Figure 4. Examples of scan images: (a,b) are not exploitable. (c) presents defective pixels that mislead porosity analysis. (d) represents a suitable cross-section for porosity measurement.
Figure 4. Examples of scan images: (a,b) are not exploitable. (c) presents defective pixels that mislead porosity analysis. (d) represents a suitable cross-section for porosity measurement.
Materials 18 04499 g004
Figure 5. Principle of the CNN classifier.
Figure 5. Principle of the CNN classifier.
Materials 18 04499 g005
Figure 6. Main types of porosity encountered in FDM: (a) Inter-bead porosity [48], (b) Inner-bead porosity [49] (available via CC BY).
Figure 6. Main types of porosity encountered in FDM: (a) Inter-bead porosity [48], (b) Inner-bead porosity [49] (available via CC BY).
Materials 18 04499 g006
Figure 7. Breakdown of how the code manipulates an image through RGB values within a matrix on a spreadsheet.
Figure 7. Breakdown of how the code manipulates an image through RGB values within a matrix on a spreadsheet.
Materials 18 04499 g007
Figure 8. Porosity computation flowchart.
Figure 8. Porosity computation flowchart.
Materials 18 04499 g008
Figure 9. Porosity distribution flowchart.
Figure 9. Porosity distribution flowchart.
Materials 18 04499 g009
Figure 10. The 3D-printed cubes for repeatability study.
Figure 10. The 3D-printed cubes for repeatability study.
Materials 18 04499 g010
Figure 11. Principle of the MLP porosity predictor.
Figure 11. Principle of the MLP porosity predictor.
Materials 18 04499 g011
Figure 12. MLP Regressor model flowchart.
Figure 12. MLP Regressor model flowchart.
Materials 18 04499 g012
Figure 13. Example of data extracted from exploitable images of the CT-scanned coupon—small cube ID 1-190-100-35-30-Grid: (a) is a plot of the instances of porosity percentage, (b) is a scatter plot of the porosity percentage along the height, (c) is a graph of the ECDF of porosity across three thresholds.
Figure 13. Example of data extracted from exploitable images of the CT-scanned coupon—small cube ID 1-190-100-35-30-Grid: (a) is a plot of the instances of porosity percentage, (b) is a scatter plot of the porosity percentage along the height, (c) is a graph of the ECDF of porosity across three thresholds.
Materials 18 04499 g013
Figure 14. Example of data extracted from exploitable images of the CT-scanned coupon—small cube ID 1-190-100-35-30-Grid: (a) is a graph of the condensed layers of the specimen with the types and location of porosity, (b) is the fit quality of the idealized porosity shapes vs. height.
Figure 14. Example of data extracted from exploitable images of the CT-scanned coupon—small cube ID 1-190-100-35-30-Grid: (a) is a graph of the condensed layers of the specimen with the types and location of porosity, (b) is the fit quality of the idealized porosity shapes vs. height.
Materials 18 04499 g014
Figure 15. Example of cross-sections from specimens 11-1, 11-2, and 11-3.
Figure 15. Example of cross-sections from specimens 11-1, 11-2, and 11-3.
Materials 18 04499 g015
Figure 16. Cross-sections of the three specimens around 297 µm with red circle highliting problem areas: 11-1 exhibits an incomplete layer. 11-2 does not have a closed contour. 11-3 presents an ideal closed contour.
Figure 16. Cross-sections of the three specimens around 297 µm with red circle highliting problem areas: 11-1 exhibits an incomplete layer. 11-2 does not have a closed contour. 11-3 presents an ideal closed contour.
Materials 18 04499 g016
Figure 17. (a) Raw porosity data by height of the cubes 11-1, 11-2, and 11-3 with spline fits. (b) Mean model with uncertainty area. (c) Uncertainty profile across the height.
Figure 17. (a) Raw porosity data by height of the cubes 11-1, 11-2, and 11-3 with spline fits. (b) Mean model with uncertainty area. (c) Uncertainty profile across the height.
Materials 18 04499 g017
Figure 18. MLP prediction vs. actual porosity, trained on small-cube dataset.
Figure 18. MLP prediction vs. actual porosity, trained on small-cube dataset.
Materials 18 04499 g018
Figure 19. MLP prediction vs. actual porosity, trained on large-cube dataset.
Figure 19. MLP prediction vs. actual porosity, trained on large-cube dataset.
Materials 18 04499 g019
Figure 20. Example of normalized plots of porosity comparison between small and large cubes.
Figure 20. Example of normalized plots of porosity comparison between small and large cubes.
Materials 18 04499 g020
Table 1. Ranges of main 3D printing properties for Pulse XE.
Table 1. Ranges of main 3D printing properties for Pulse XE.
ParameterRange
Infill Density [%]0–100%
Printing OrientationX–Y–Z–XY–YZ–XZ
Bed Temperature [°C]80 °C–115 °C ± 5 °C
MaterialPLA–ABS–Nylon
Print Temperature [°C]190–290 °C ± 5 °C
Layer Height [µm]100–300
Infill Overlap [%]0–100%
Printing Speed [mm/s]0–100
Infill TypeGrid–Gyroid–Concentric–Hexagon–Triangle–Lines
Table 2. Summary of combinations of process parameters for coupon printing.
Table 2. Summary of combinations of process parameters for coupon printing.
DesignationPrint TLayer HeightInfill OverlapPrinting SpeedInfill Type
-[°C][µm][%][mm/s]-
1-190-100-35-30-Grid1901003530Grid
2-190-200-65-70-Hexagon1902006570Hexagon
3-190-300-90-100-Lines19030090100Lines
4-200-100-65-70-Hexagon2001006570Hexagon
5-200-200-90-100-Lines20020090100Lines
6-200-300-35-30-Grid2003003530Grid
7-210-100-90-100-Lines21010090100Lines
8-210-200-35-30-Grid2102003530Grid
9-210-300-65-70-Hexagon2103006570Hexagon
10-210-300-30-35-Grid2103003035Grid
11-210-300-90-100-Lines *21030090100Lines
* two additional cubes with the same combination of printing parameters were manufactured. They are part of the repeatability study.
Table 3. Summary of combinations of scanning features for small and large coupons.
Table 3. Summary of combinations of scanning features for small and large coupons.
Scanning FeaturesValue
Reconstructed pixel pitch0.02991 mm
Slice spacing29.91 µm
Pixel size X, Y, Z29.91 µm/pixel
Voxel size29.91 µm × 29.91 µm × 29.91 µm
Table 4. Number of slices extracted from the 3D file per specimen.
Table 4. Number of slices extracted from the 3D file per specimen.
DesignationNumber of Slices [Small]Number of Slices [Large]
1-190-100-35-30-Grid215382
2-190-200-65-70-Hexagon216376
3-190-300-90-100-Lines211397
4-200-100-65-70-Hexagon229369
5-200-200-90-100-Lines197384
6-200-300-35-30-Grid181392
7-210-100-90-100-Lines211372
8-210-200-35-30-Grid198416
9-210-300-65-70-Hexagon213371
10-210-300-30-35-Grid213375
11-210-300-90-100-Lines198367
Table 5. Number of slices for small coupons per folder.
Table 5. Number of slices for small coupons per folder.
DesignationN. of SlicesN. of Exploitable SlicesN. of Defective SlicesPercentage of Defective Slices
----[%]
1-190-100-35-30-Grid2151625324.65%
2-190-200-65-70-Hexagon2161575927.31%
3-190-300-90-100-Lines2111624923.22%
4-200-100-65-70-Hexagon2291606930.13%
5-200-200-90-100-Lines1971277035.53%
6-200-300-35-30-Grid1811621910.50%
7-210-100-90-100-Lines2111615023.70%
8-210-200-35-30-Grid1981574120.71%
9-210-300-65-70-Hexagon2131476630.99%
10-210-300-30-35-Grid2131605324.88%
11-210-300-90-100-Lines1981534522.73%
Table 6. Printing variables and dimensional measurements for repeatability specimens.
Table 6. Printing variables and dimensional measurements for repeatability specimens.
ID-11-111-211-3
Print Temp[°C]210
Layer height[µm]300
Infill Overlap[%]90
Printing Speed[mm/s]100
Infill Type-Lines
x-length *[mm]5.655.65.29
y-length *[mm]5.625.775.62
z-length *[mm]5.45.135.22
Printing Time-Mid-Print of the day1st print of the dayLast print of the day
* dimensions were measured with a Clockwise Tools (Valencia, CA, USA) IP54 caliper of ± 0.03 mm accuracy.
Table 7. Neural network input/output structure.
Table 7. Neural network input/output structure.
Input DataOutput
Print Temperature
Layer Height
Infill Overlap
Printing Speed
Infill Type
Z-Height
Porosity
Table 8. Example of dataset (small cube) used for porosity prediction.
Table 8. Example of dataset (small cube) used for porosity prediction.
Cube IDInputOutput
Print TemperatureLayer HeightInfill OverlapPrinting SpeedInfill TypeZ-HeightPorosity
-[°C][µm][%][mm/s]-[µm][%]
11901003530Grid1351.64
11901003530Grid2161.92
21902006570Hexagon35640.01
21902006570Hexagon35910.03
102103003035Grid45364.27
102103003035Grid45634.64
721010090100Lines37800.01
721010090100Lines38070.01
62003003530Grid33212.03
62003003530Grid33482.26
Table 9. Example of dataset from the large cubes used for porosity prediction.
Table 9. Example of dataset from the large cubes used for porosity prediction.
Cube IDInputOutput
Print TemperatureLayer HeightInfill OverlapPrinting SpeedInfill TypeZ-HeightPorosity
-[°C][µm][%][mm/s]-[µm][%]
11901003530Grid8706.38
21902006570Hexagon35401.05
21902006570Hexagon35701.17
102103003035Grid69600.95
102103003035Grid69901.36
721010090100Lines74100.00
721010090100Lines74400.00
62003003530Grid25801.84
62003003530Grid26102.64
Table 10. CNN classifier performance metrics from 5-fold grouped cross-validation.
Table 10. CNN classifier performance metrics from 5-fold grouped cross-validation.
Performance MetricDefective ClassExploitable ClassTotal
Mean ± StdMean ± StdMean ± Std
Precision0.977 ± 0.0260.970 ± 0.021-
Recall0.925 ± 0.0520.992 ± 0.009-
F1-Score0.949 ± 0.0260.981 ± 0.010-
Accuracy--0.972 ± 0.014
Table 11. Number of datapoints for large cubes per folder.
Table 11. Number of datapoints for large cubes per folder.
DesignationPredicted ExploitableActual Exploitable SlicesPredicted DefectiveActual Defective
1-190-100-35-30-Grid 3283255457
2-190-200-65-70-Hexagon3253195157
3-190-300-90-100-Lines3253117286
4-200-100-65-70-Hexagon3283224147
5-200-200-90-100-Lines3303265458
6-200-300-35-30-Grid3203187274
7-210-100-90-100-Lines3293194353
8-210-200-35-30-Grid3273258991
9-210-300-65-70-Hexagon3173035468
10-210-300-30-35-Grid3263224953
11-210-300-90-100-Lines3243004367
Table 12. Overview of general features from the cube data.
Table 12. Overview of general features from the cube data.
Cube ID11-111-211-3
Number of generated images198205228
Exploitable images153152157
First height for porosity from exploitable cross-section [µm]540432297
Last height for porosity from exploitable cross-section [µm]464445094509
Min porosity [%]0.33%0.77%0.12%
Max porosity [%]5.55%6.63%5.30%
Avg. porosity [%]2.22%2.36%1.85%
Range0.05220.05860.0518
Variance0.00010.00010.0001
Table 13. Uncertainty metrics calculated over 11-1, 11-2, and 11-3.
Table 13. Uncertainty metrics calculated over 11-1, 11-2, and 11-3.
MetricsValue
Mean standard deviation0.0047
Maximum standard deviation0.0149
Relative uncertainty (std/mean)21.55%
RMS difference between datasets 1 and 20.0069
RMS difference between datasets 1 and 30.0087
RMS difference between datasets 2 and 30.0066
Average pairwise difference0.0074
Table 14. Statistical analysis of porosity sets (mean, standard deviation, and correlation).
Table 14. Statistical analysis of porosity sets (mean, standard deviation, and correlation).
SpecimenN of Data PointsSmall CubesLarge CubesComparisonCorrelation *
MeanStandard DeviationMeanStandard DeviationMeanStandard Deviation
1-190-100-35-30-G1620.480.250.210.230.560.08−0.01
2-190-200-65-70-H1570.120.180.490.21−3.08−0.17−0.18
3-190-300-90-100-L1610.290.250.060.130.790.480.08
4-200-100-65-70-H1600.090.140.080.110.110.210.80
5-200-200-90-100-L1270.150.190.020.100.870.47−0.12
6-200-300-35-30-G1620.180.190.220.17−0.220.110.61
7-210-100-90-100-L1610.100.260.030.140.700.460.06
8-210-200-35-30-G1570.190.170.100.150.470.120.58
9-210-300-65-70-H1600.260.190.110.170.580.11−0.06
10-210-300-30-35-G1470.240.170.090.150.630.120.68
11-210-300-90-100-L1530.360.220.060.160.830.270.43
Min Value1270.090.140.020.10−3.08−0.17−0.18
Max Value1620.480.260.490.230.870.480.80
Average Value155.180.220.200.130.160.200.210.34
* negative values indicate inverse relationships.
Table 15. Statistical analysis of porosity datasets (T-statistic, p-value, and area).
Table 15. Statistical analysis of porosity datasets (T-statistic, p-value, and area).
SpecimenN of DatapointsT-Statisticp-ValueArea Between Curves
190-100-35-30-Grid1629.7580.0000.36
190-200-65-70-Hex157−16.7010.0000.42
190-300-90-100-Lines1619.9710.0000.27
200-100-65-70-Hex1600.2100.8340.05
200-200-90-100-Lines1277.2300.0000.16
200-300-35-30-Grid162−2.2030.0280.13
210-100-90-100-Lines1613.2570.0010.11
210-200-35-30-Grid1575.2740.0000.12
210-300-65-70-Hex1607.5760.0000.23
210-300-30-35-Grid1478.4730.0000.17
210-300-90-100-Lines15313.3030.0000.30
Min Value127−16.700.000.05
Max Value16213.300.830.42
Average Value155.184.520.150.18
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ouajjani, K.; Steck, J.E.; Olivares, G. Leveraging Machine Learning for Porosity Prediction in AM Using FDM for Pretrained Models and Process Development. Materials 2025, 18, 4499. https://doi.org/10.3390/ma18194499

AMA Style

Ouajjani K, Steck JE, Olivares G. Leveraging Machine Learning for Porosity Prediction in AM Using FDM for Pretrained Models and Process Development. Materials. 2025; 18(19):4499. https://doi.org/10.3390/ma18194499

Chicago/Turabian Style

Ouajjani, Khadija, James E. Steck, and Gerardo Olivares. 2025. "Leveraging Machine Learning for Porosity Prediction in AM Using FDM for Pretrained Models and Process Development" Materials 18, no. 19: 4499. https://doi.org/10.3390/ma18194499

APA Style

Ouajjani, K., Steck, J. E., & Olivares, G. (2025). Leveraging Machine Learning for Porosity Prediction in AM Using FDM for Pretrained Models and Process Development. Materials, 18(19), 4499. https://doi.org/10.3390/ma18194499

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop