1. Introduction
Additive manufacturing (AM) is defined in ISO/ASTM 52900:2021 standard [
1] as a process that builds parts by joining a material layer by layer, using 3D model data. The standard defined seven process categories for AM, namely binder jetting, directed energy deposition, material extrusion, material jetting, powder bed fusion, sheet lamination, and vat photopolymerization. AM are also referred to as rapid prototyping, 3D printing, layered manufacturing, and digital manufacturing [
2]. There are two levels for AM processes. The first one is the digital level where the CAD model is prepared, converted to stl.file, and where machine control strategy is generated (e.g., CAM, G code). The second level is the physical level which contains part manufacturing using one of the seven processes mentioned previously [
3]. Initially, AM or 3D printing technologies were used mainly for rapid prototyping, but with improvements in the reliability and efficiency of AM processes, as well as in the material properties of the components produced, they are increasingly used in creating complicated customized parts, visualizing tools in design, and producing serial components with small volume. In the future, it might be used for manufacturing clothes, creating food confections, and human organs [
2].
There are many advantages for using AM processes, such as the flexibility in the producible designs, the facilitated customization of products, and the capability to print highly complex structures. However, many challenges and drawbacks remain. More specifically, some disadvantages are the stair-stepping effect that appeared in the manufactured product, void formation between the layers resulting from binding reduction, and mechanical proprieties and microstructure variation [
4].
The applications for using AM include prototyping during the product development phase, producing products in pilot series production where injection molding costs are high, and creating complex geometry parts which cannot be produced by other means of manufacturing [
5]. This gives the edge to AM among manufacturing processes. For example, it allows the integration of additional functionality in components, such as the production of repeated patterns internally. Thus, AM has the capability for combining internal complex structures with more regular outer geometries, reducing weight while keeping structural and aesthetic integrity, as can be done in the manufacturing of a bike frame. Furthermore, applications are emerging in the context of the highly regulated aerospace and automotive sector. For instance, metal parts suitable for aircraft were directly manufactured using titanium material [
4], reducing lead time by 30–70%, non-recurring fabrication costs by 45%, and reducing the manufacturing cost for producing low-volume parts by 30–35%. However, metal-based AM such as Powder Bed Fusion (PBF) still has many issues such as porosity, part deformation, and cracks formations [
6] that remain to be tackled. Among them, the presence of porosity is particularly critical, as this can have significant effects on the mechanical properties of components, cause failures for the structure, and may decrease the strength and modulus of Young [
7]. Thus, the focus of this paper is to facilitate the study of porosity formation in AM.
A common approach in the study and optimization of emerging manufacturing techniques is the use of Artificial Intelligence (AI) technologies. AI facilitate intelligent systems development [
8] to maximize the efficiency and productivity of manufacturing machines. AI techniques include Artificial Neural Network (ANN), inspired by the biological human brain. It can be used to investigate the complex relationships in big data [
9] and extract meaningful implicit patterns to predict complex systems’ future states [
10].
Deep Learning (DL) techniques are established as an extension to the capabilities of ANN, as they extract features, automatically producing better learning capability [
11]. Convolutional Neural Network (CNN) is one of the most used DL techniques which deals mainly with image data [
9], and it can be integrated with other intelligent swarm optimization algorithms to optimize its parameters to improve CNN performance in analyzing a large number of images for classification and prediction problems [
12]. Thus, CNN is an effective DL network that can be applied in the manufacturing context and therefore, in this paper context, to analyze porosity images related to AM facilitating the optimization of the process.
This study aims at facilitating the accurate prediction of porosity percentage occurring in PBF when analyzing CT scans of parts. This is achieved using a new Regression Convolutional Neural Network (RCNN) algorithm. As the training of such RCNN would require a large amount of costly experimental data to generate real CT scans, it was decided to first train, test, and validate the new algorithm using artificial porosity images mimicking real CT scan slices. Following this, the RCNN was further optimized using the Bees Algorithm (BA), which mimics the behavior of honeybees to produce better prediction accuracy, as was demonstrated by the authors in a previous paper that described the hybrid Bees Regression Convolutional Neural Network (BA-RCNN) [
12].
The paper structure is as follows:
Section 2 summarizes the main AM processes and provides a review of PBF, highlighting the gaps that remain to be addressed to improve the process performance.
Section 3 describes a new method developed to create artificial porosity images that mimic real CT scan slices of finished SLM parts, and
Section 4 presents the predicted percent of porosity using RCNN and proposes a novel hybrid BA-RCNN algorithm in order to improve the prediction accuracy. Finally,
Section 5 concludes the study and suggests the future directions.
3. Artificial Porosity Images Creation for SLM Parts
Training CNN algorithms would require a large amount of experimental data, which is expensive for SLM parts [
23], since there are many types of production costs for pre-processing, processing, and post-processing costs, including preparing geometry data, CAD model, machine setup, material cost, building up the part, and postprocessing cost [
24], so producing a large amount of porosity images to train RCNN is not cost-effective. This section proposes a new efficient approach of creating artificial keyhole porosity images mimicking the real CT scan slices of finished SLM parts that can be used in the research environment effectively and efficiently, in particular to validate the training of an accurate RCNN for the automatic prediction of porosity in CT scans of SLM parts. The steps of creating the artificial porosity images are illustrated in
Figure 11, followed by subsections explaining the steps in detail.
3.1. Establishing Regression Equations
The formulation of two regression equations is based on the laser power and the scanning speed data found in [
6]. The first equation correlates the number of pores (Y) with the laser power (X1) and the scanning speed (X2), and the second equation correlates the pores’ diameters (Y) with the same parameters (X1 and X2). The data used to establish the two equations are related to keyhole porosity and they will be used as a demonstration for an example of pore types’ formation.
Table 2 shows the corresponding number of pores for each combination of laser power and scanning speed.
The Minitab software was used to establish the first regression equation that fits the 24 observations [
6] mentioned in the previous table, thus correlating the number of pores with the laser power and the scanning speed, which results in the following equation:
Similarly, the second regression equation was established to fit pores diameter with laser power and scanning speed data found in [
6], and the dataset is shown in the following
Table 3.
Once again, the Minitab software was used to establish the regression equation that fits the 11 observations [
6] mentioned in
Table 3 correlating the diameter of the pores with the laser power and the scanning speed, which results in the following equation:
3.2. Generating Pores Numbers and Diameters
The two regression equations established in the previous section were used to generate 30 values for the number of pores and pores diameter by substituting the 30 combinations of laser power and scanning speed found in [
6]. The following is an illustrative example using a laser power of 15 W and a scanning speed of 50 mm/s:
Table 4 shows the 30 combinations of laser power and scanning speed found in [
6], along with the corresponding number of pores after scaling down from a 2.6 mm
3 to a 1mm
3 volume, the volume of the cube in which the pores will be positioned and used to train the CNN. Variations of ±10 µm were applied randomly to the generated pore diameters, mimicking variations occurring in real porosity images.
3.3. Creating 3D Cubes
Overall, 30 samples of 3D cubes were created with a volume of 1 mm
3 for each cube, and they contain the number of pores with diameters generated in the previous section (
Table 4). Thus, the first cube has 33 pores with an average diameter of 36.94 µm. In [
25], the position of pores was considered by analyzing the porosity distribution in real images of pores. They observed 975 porosity positions in X and Y. In this research, the Minitab platform was used to conduct a normality test on these observations, as shown in the following
Figure 12 and
Figure 13:
With a
p-value of less than 0.005, the probability that these data are not coming from a normal distribution is very low, so it is concluded that the observed porosity positions are normally distributed, with a mean and a standard deviation of 0.48 and 0.27 for X-positions and 0.44 and 0.26 for Y-positions. Therefore, in this research, it was decided to produce porosity positions with the same statistical distribution, as observed in [
25].
Thus, MATLAB software was used to generate normally distributed porosity positions inside each of the 30 cubes with the mean and the standard deviation mentioned previously in the X and Y positions, while the Z position was arbitrarily given the average between X and Y to produce normal distribution positions in a volume. The pores morphology was created to be similar to the 3D view of the pores shown in
Figure 7 in
Section 2.4.2 [
6]. The following
Figure 14 shows an illustrative example of the cube with 33 pores and an average diameter of 36.94 µm, as mentioned in the first combination of
Table 4.
3.4. Slicing 3D Cubes into 2D Images
Each cube created in the previous step was sliced using the MATLAB platform into 100 slices with a thickness of 0.01 mm, resulting in 3000 slices of 2D images, an illustrative example of the cube, and three non-sequential slices that are shown in the following
Figure 15.
The first slices are expected to be with no pore, as shown at the bottom of the cube. Thereafter, part of a pore is shown in some slices and parts of many pores are shown in other slices. The pore morphology tended to be near-spherical in shape, as described in
Section 2.4.2 [
16].
3.5. Labelling 2D Slices
The slices were labelled with the actual percent of porosity for each slice using MATLAB software, and were calculated by dividing the number of elements with specific pore unique pixel values by the total image size (650 × 630 × 3). The pixel values for the pores were determined by inspecting the pixel values of porosity seen in real CT Scan images [
26], and are between 110 and 124. The first slice has no elements with a pixel value in the range between 110 and 124 so the actual percentage of pore is 0. In slice 31 there are 258 elements with pixel values in the range specified, so the actual percent of pore is (258/(650 × 630 × 3)) × 100 = 0.0210, similarly for slice 59 with 2193 elements of pixel values between 110 and 124, the actual percent of pore is (2193/(650 × 630 × 3)) × 100 = 0.1785, and the average actual percent of pore for 3000 slices is 0.0134.
3.6. Adding Noisy Background
Firstly, image processing in the MATLAB platform was conducted to fuse the noisy background of 100 CT scan images containing porosities with the slices extracted from each cube, resulting in the first version of the filtered artificial images shown in the following
Figure 16.
Secondly, in the artificial images, the edges of the pores have a uniform shading, making them clearly distinguishable from the background. This is not a true representation of porosity seen on real CT scans, where shade variations make it difficult to properly distinguish pores’ edges. Thus, in a second version, image processing in the MATLAB platform was conducted to further filter the artificial porosity images by creating similar noise, so the background of a sample of 100 existing images was inserted into 100 pores slices extracted from 3D cube after reducing the pixel value for its white background from 255 to 155 to convert it to a gray background. The artificial images were overlayed with the noisy background of real images. The degree of overlaying was determined by a factor (between 0 and 1) following the method described in [
27].
Thus, with a factor of 1, the pore image will be shown without noisy background and with a factor of 0, and the noisy background will be shown without pores. After many trial and error experiments, a factor of 0.125 was considered to visually be the best value that combined both pore and noisy background images, as shown in the following
Figure 17.
As shown in the slices, the noise in the background and the pores appear more like real porosity images as the edges are not as clearly defined, but this is a subjective evaluation. The following
Section 3.7 will present quantitative measure for the similarity between real and artificial porosity images to ensure that the artificial images are realistic.
3.7. Measuring the Similarity between Artificial and Real Porosity Images
The created artificial porosity images were compared with real CT scan slices of finished SLM parts [
26] to verify that the simulated images are close the reality. The real images are only used as a demonstration and are not directly linked with the pore formation equations mentioned in
Section 3.1. The following
Figure 18 shows an illustrative example of the slices before and after processing, which was required to focus on the bulk of the material and to obtain images of the same size as the artificial images.
Figure 19 presents the real image along with the first version of the artificial image.
Samples of 100 slices of real images were taken and compared with each of the first versions of 100 artificial images created in the previous section. The comparison was made using a quantitative method called Structural Similarity Index (SSI). It is a measure that assesses the images based on three computational terms, namely the luminance (l), the contrast (c), and the structural terms (s). Multiplying the three terms results in the overall index. If two images are exactly the same, the index should be 1, and if they are totally different the index should be close to zero. The mathematical equations for calculating SSI for images x and y are as follow [
28]:
where:
µx and µy are local means, σx and σy are standard deviations, and σxy is cross-covariance for images x and y. The exponents for luminance, contrast and structural are alpha(α), beta(β), and gamma(γ), while C1, C2, and C3 are constants added to avoid instability for image regions with local mean or standard deviation close to zero.
MATLAB software was used to calculate SSI between the real and first version of artificial porosity images, the average similarity index for 3000 slices was 0.9586. The same 100 samples of real images were used to compare them, with the final version of artificial porosity images shown in the following
Figure 20:
The average similarity index for 3000 slices was improved to 0.9967, which means that the final version of artificial porosity images mimics better real images since the index is closer to 1.
3.8. Study Limitations
The created artificial porosity images in this section will be used only to test the proposed CNN algorithms that will be developed in
Section 4. The study did not aim to study the porosities in depth, so no experiments have been conducted, but the paper proposes a method that will enhance such studies, particularly in predicting the percent of porosity as will be demonstrated in
Section 4. In the future, real experiments can be conducted in order to produce real porosity images.
4. Predicting the Porosity in Selective Laser Melting Parts
Using the artificial images created in
Section 3, this section will show three methods for predicting the percentage of porosity in SLM parts. The first one is the existing image binarization method, which is one of the main methods for measuring porosity along with the Archimedes method [
22]. Archimedes’ principle might be used in the case of producing real SLM parts, and this paper uses artificial porosity images, so the image binarization method will be conducted and explained in
Section 4.1. The second and third methods are Regression Convolutional Neural Network (RCNN) and hybrid Bees Regression Convolutional Neural Network (BA-RCNN), which will be explained in detail in
Section 4.2.
4.1. Predicting the Porosity Using Image Binarization
There is a problem related to accurately assessing the porosity in SLM parts [
21]. The problem is the difficulty and subjectivity in selecting an appropriate grayscale threshold for binary image conversion to highlight defective regions and determine the true level of porosity, as mentioned previously in
Section 2.5.
The first version of created artificial images presented in the previous section were binarized using an adaptive thresholding algorithm provided in the MATLAB platform, which selects the threshold based on local mean intensity in the pixel neighborhood, and is determined by a sensitivity factor, between 0 and 1, that indicates the sensitivity toward thresholding more pixels as a foreground [
29]. This sensitivity factor is selected manually. The following
Figure 21 shows the first version of the artificial image, along with the binarized image with an arbitrarily selected sensitivity factor of 0.66.
As can be seen in the figure, there are tiny undesired black spots in different positions in the binarized image, and the undesired spots also appear in slices with no pores, as shown in the following
Figure 22.
The average actual percent of pore for 3000 slices was 0.0134, while the average percent of pore for 3000 binarized images is overestimated with a value of 0.0578, so the absolute error is 0.0444. The prediction accuracy with a difference of less than a threshold of 0.02 (percent of observations with error less than 0.02) is 64.47%.
The same approach was followed for the final version of artificial porosity images, and the following
Figure 23 shows the artificial image along with the binarized image, with a sensitivity factor of 0.66.
As can be seen in the figure, there are tiny undesired black spots in different positions in the binarized image, confirming the problem stated in [
21], which is a result of inconsistent grayscale in CT scan slices because of the mutual influence of CT setup and radiodensity variation. Removing these spots using image processing is time-consuming since they appear in different positions in each slice without a simple pattern, so the processing needs to be performed image by image to distinguish between the undesired black spots and the pores first. Following that, unwanted spots need to be replaced with a white background because they are counted in the porosity calculation which overestimates the percent of porosity. Such an issue also occurs in the pores, as tiny white spots would alter their morphological feature and slightly reduce the percentage of porosity. However, the effect of this on porosity calculations is negligible when compared to the effect of the small black spots occurring in the large background. Depending on the sensitivity factor used, the black spots also appear in slices with no pores, as shown in the following
Figure 24.
Experimenting with different sensitivity factors between 0.63 to 0.74 resulted in the following binary images with different percentages of porosity as shown in
Figure 25.
As can be seen from the images, increasing the sensitivity factors reduces the black spots resulting from the noisy background, but it alters the pore’s morphological features dramatically. A sensitivity factor of 0.69 seems relatively better and it will be selected to binarize all 3000 slices since it yielded the most accurate percent of porosity of 0.17%, which is close to the actual percent of pore for the original slice with a value of 0.1785%. It is worth noting that in the case of producing real porosity images, sensitivity factor selection will be subjective and difficult since the actual percentage of porosity will be unknown. The average percent of pore for 3000 slices was 0.0203, while the average percent of pore for 3000 binarized images is overestimated with a value of 0.0424, so the absolute error is 0.0221. The prediction accuracy with a difference less than a threshold of 0.02 (percent of observations with error less than 0.02) is 68.60%.
4.2. Predicting the Porosity Using RCNN and BA-RCNN
CNN can be used for regression problems to predict numerical values based on images, so regression CNN will be used to predict the percent of porosity based on created artificial porosity images in the previous section. As mentioned previously (in
Section 3.5), the images were labelled using the actual percent of porosity calculated during the creation process by dividing the number of elements with specific pore unique pixel values by the total image size. CNN learns the porosity pattern in artificial porosity images that mimic CT scan images of the finished SLM part and predict the percent of porosity without the need for subjective difficult thresholding determination to convert the single slice to a binary image, which ultimately achieves automized quality assessment.
4.2.1. RCNN and BA-RCNN Architecture
The CNN architecture for predicting the percent of porosity is composed of 22 layers with one input layer, five convolutional layers, five rectified linear unit layers, five batch normalization layers, four average pooling layers, one fully connected layer, and one regression layer.
The input layer is represented by a matrix with height by width size (650 × 630). It contains pixel brightness values between 0 for black regions to 255 for white regions. The convolutional layers contain filters represented by weight matrix slide along the pixel brightness matrix using a special dot product to create a feature map matrix [
30]. The rectified linear unit layer comes after each convolutional layer to increase the effectiveness and speed of the training by maintaining positive values and mapping negative values to zero [
31]. In addition, the batch normalization layer comes after each convolutional layer as a supplement layer mitigating the overfitting risk [
32]. Pooling layers are used between the convolutional layers for output dimensionality reduction [
33] without losing the important image features, which helps in minimizing the computational time. Regression and fully connected layers are the output layers that show the predicted percentage of pores.
The normal number of convolutional layers to start is between two to three layers with a filter size of 3 × 3 or 5 × 5 as advised in [
31], CNN was designed with five convolutional layers with four average pooling layers in between, with the number of filters ranging between 8 for the first layer and 128 for the last one. Each layer has twice the number of filters of the previous layer [
34]. The filter size is 5 × 5, the section depth is 3, and the padding that detects the image edges is set as ‘same’, so the padding size is automatically calculated at the training time, producing output size equivalent to input size when the stride (number of pixel shift) is one.
The pooling type is ‘average’ which takes the average presence of the feature, while the max pooling layer takes the most activated feature, so the average pooling is used with light background and max pooling is better with dark background [
35], the default size of pooling layer is 2 × 2 [
30], but it yielded high computational cost since the image input size is big (650 × 630). The size was changed to 4 × 4 with a stride value of 4 to minimize the training time.
CNN was trained using SGDM, which is the most common training algorithm [
32]. The default values for this algorithm are an initial learning rate of 0.01, a momentum of 0.9, a regularization of 1 × 10
−4, and the maximum number of epochs is 20, as presented in [
36]. After applying some experiments and monitoring the validation accuracy, the momentum was changed to 0.8, and with regularization became 1 × 10
−10.
The RCNN algorithm will train the artificial porosity images of the SLM part to predict the percent of porosity without the need for subjective difficult threshold determination to convert the single slice to a binary image, as mentioned in [
21].
The hybrid algorithm (BA-RCNN) uses BA to optimize the parameter values for section depth that controls the network depth, the initial learning rate that is used for features learning, the momentum that performs the hyperparameters update and regularization that prevents overfitting [
37] to reach the minimum prediction error on the validation set.
The BA consists of global and local searches. The global search is done by the scout bees that evaluate random positions based on the fitness value. In the local search, the best sites are selected, and the remaining sites are abandoned. The intense search is done to select the elite sites, which are the best among the best sites selected in the local search. The next step is recruiting more bees for the elite sites based on the size of the neighborhood search space and recruiting lower bees for other sites to conduct the local search [
38]. The stopping conditions for this iterative process are:
Finding the optimal solution
Exceeding the iteration number
No improvement over specified sequential iterations
The values of BA hyperparameters are assigned based on the capability of the computer and equations in [
39]:
Scout bees (n) = 4
Selected bees (m) = 0.5 × n = 2
Elite bees (e) = 1
Recruited bees for e (nep) = 2 × m = 4
Recruited bees for other best sites (nsp) = 0.5 × n = 2
Neighborhood size (ngh) = 0.1 × (Maximum − Minimum):
- ∘
Section Depth: 0.1 × (3 − 1) = 0.1 × 2 = 0.2
- ∘
Initial Learning Rate: 0.1 × (1 − 1 × 10−2) = 0.1 × 0.99 = 0.099
- ∘
Momentum: 0.1 × (0.98 − 0.8) = 0.1 × 0.18 = 0.018
- ∘
Regularization: 0.1 × (1 × 10−2 − 1 × 10−10) = 0.1 × 0.01 = 0.001
The following
Figure 26 shows the pseudo-code for the BA-RCNN algorithm:
The following
Figure 27 summarizes the task for hybrid regression CNN:
4.2.2. RCNN and BA-RCNN Results
MATLAB is the platform used to apply RCNN and BA-RCNN on the newly created 3000 artificial porosity images, of which 1800 images are for training and 600 are for each of the validation and testing sets to predict the percent of porosity without the need for subjective difficult thresholding determination to convert the single slice to a binary image, which ultimately achieves automized quality assessment. The following
Table 5 shows the average percent of porosity error (the difference between the actual and predicted percent of porosity on average) for the first version of artificial porosity images.
The minimum percent of porosity error value of 0.0160 comes with the validation set in BA-RCNN, and the following
Table 6 shows the optimal CNN parameters values optimized using BA.
The minimum error value of 0.0160 was achieved with a section depth of 3, 0.0118 initial learning rate, a momentum value of 0.8229, and a regularization parameter of 0.0091, which is less than the error value of 0.0444 for the image binarization method. The following
Table 7 shows the prediction accuracy with a difference less than a threshold of 0.02 (percent of observations with error less than 0.02) for all three sets, along with computational time for all algorithms.
The existing original RCNN produced 78.83% prediction accuracy in the testing set, which is approximately 14% better than the accuracy resulting from the image binarization method with a value of 64.47%. The novel hybrid BA-RCNN produced better prediction accuracy in all training, validation, and testing sets, which means it has better generalization capability than RCNN. The accuracy in the testing set has a value of 80.67%, which is approximately 16% better than the existing image binarization method, and the computational time is almost similar in both algorithms. The following
Table 8 shows the prediction accuracy for all three methods.
The same approach is followed to predict the percent of porosity for the final version of artificial porosity images. The following
Table 9 shows the average percent of porosity error (the difference between the actual and predicted percent of porosity on average) for the first version of artificial porosity images.
The minimum percent of porosity error value of 0.0214 comes with the validation set in BA-RCNN, and the following
Table 10 shows the optimal CNN parameters values optimized using BA.
The minimum error value of 0.0214 comes with a section depth of 1, 0.0101 initial learning rate, a momentum parameter of 0.9568, and a regularization value of 0.0097, and is less than the error value of 0.3167 for the image binarization method. The following
Table 11 shows prediction accuracy for training, validation, and testing sets with a difference less than a threshold of 0.02 (percent of observations with error less than 0.02), along with computational time for best iteration for all algorithms.
The existing original RCNN produced 75.50% prediction accuracy in the testing set, which is approximately 7% better than the accuracy resulting from the image binarization method with a value of 68.60%. The novel hybrid BA-RCNN produced better prediction accuracy in all training, validation, and testing sets, which means it has better generalization capability than RCNN. The accuracy in the testing set has a value of 85.33% which is approximately 17% better than the existing image binarization method, and the hybrid BA-RCNN is cost-effective since the computational time is reduced by approximately 2 min. The following
Table 12 shows the prediction accuracy for all three methods.
The contribution of the paper is developing a new approach based on the use of a Regression Convolutional Neural Network (RCNN) algorithm to predict the percent of porosity in CT scans of finished SLM parts, without the need for subjective difficult thresholding determination to convert a single slice to a binary image, the model achieved better prediction accuracy than the existing image binarization method by 17%. In order to test the algorithm, as the training of the RCNN would require a large amount of experimental data, artificial porosity images mimicking real CT scan slices of the finished SLM part were created with a similarity index of 0.9976 with real images.