## 4 Predicting the Porosity in Selective Laser Melting Parts
### Predicting the Porosity Using RCNN and BA-RCNN
#### 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. Figure 27: Illustrative diagram for hybrid regression CNN. \begin{table}
\begin{tabular}{c c c} \hline  & **Original RCNN** & **Hybrid BA-RCNN** \\ \hline Average Percent of Porosity & 0.0164 & 0.0169 \\ Error in Training Set & & \\ \hline Average Percent of Porosity & 0.0171 & 0.0160 \\ Error in Validation Set & & \\ \hline Average Percent of Porosity & 0.0189 & 0.0191 \\ Error in Testing Set & & \\ \hline \end{tabular}
\end{table} 
Table 5: Average percent of porosity error (first version). 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. \begin{table}
\begin{tabular}{c c} \hline \hline  & **Value** \\ \hline Optimal Section Depth & 3 \\ Optimal Initial Learning Rate & 0.0118 \\ Optimal Momentum & 0.8229 \\ Optimal Regularization & 0.0091 \\ Validation Error & 0.0160 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Optimal CNN parameters values using BA (first version). \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Original RCNN** & **Hybrid BA-RCNN** \\ \hline Training Accuracy & 81.22\% & 82.06\% \\ Validation Accuracy & 81.50\% & 81.67\% \\ Testing Accuracy & 78.83\% & 80.67\% \\ Computational Time & 18 min 17 s & 18 min 13 s \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Prediction accuracy and computational time for algorithms (first version). \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Image Binarization** & **Original RCNN** & **Hybrid BA-RCNN** \\ \hline Porosity Prediction & 64.47\% & 78.83\%. & 80.67\% \\ Accuracy & & \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Porosity prediction accuracy (first version).