I have focused my research on the rapid prediction of casting defects, especially shrinkage porosity and shrinkage cavity defects, because these casting defects strongly influence the mechanical integrity, pressure tightness, fatigue life, and final acceptance rate of cast components. In my work, I treat the casting process plan as a three-dimensional image and treat the final distribution of casting defects as a semantic segmentation result. By doing so, I transform the conventional numerical simulation problem of casting defect prediction into a fully convolutional network problem that can be trained, validated, and deployed with high computational efficiency. I introduce a specialized data preprocessing pipeline, a multimodal input strategy, and a fully convolutional network architecture that together form a fast prediction method for casting defects.
Traditional numerical simulation methods can calculate the distribution of casting defects with high fidelity. However, they require fine mesh generation, small time steps, and repeated solution of coupled thermal, fluid, and stress fields. As a result, the calculation time for one casting defect prediction task often ranges from hours to tens of hours. This long calculation time limits the number of process plans that can be evaluated and slows down process optimization. I therefore propose a data-driven method that learns the mapping from a casting process plan to the final casting defect distribution. The method does not resolve the transient filling and solidification process step by step. Instead, it estimates the final casting defect pattern directly from the process geometry and selected process variables.

I define the core problem as follows. Given a casting process plan that contains the casting, riser, runner, gate, sand mold, sand core, chiller, riser sleeve, and air regions, I predict whether each location in the final casting will contain a casting defect. I use a fully convolutional network to assign each voxel or pixel to one of two classes: defect or non-defect. This is a pixel-level classification task, and it is closely related to semantic segmentation in computer vision. The use of a fully convolutional network allows the model to accept arbitrary input sizes and to produce dense predictions without fully connected layers. The network learns hierarchical features from low-level boundaries and shapes to high-level thermal and feeding relationships that govern casting defect formation.
Problem Transformation and Multimodal Representation
I introduce the concept of a three-dimensional image for casting process representation. In a conventional two-dimensional image, each pixel has an intensity or color value. In my three-dimensional casting image, each voxel has a material class value. The material class values describe the shape, size, and relative position of each component in the casting process plan. I map the original material identifiers to five combined material groups to reduce complexity and improve learning stability. The mapping is given in the following table.
| Symbol | Material group | Original components |
|---|---|---|
| \(\alpha\) | Liquid metal region | Casting, runner, riser, gate |
| \(\beta\) | Mold and core | Sand mold, sand core |
| \(\gamma\) | Chiller | External or internal chiller |
| \(\delta\) | Riser sleeve | Insulating or exothermic sleeve |
| \(\epsilon\) | Air | Empty space |
I encode each voxel as a multidimensional process vector. The first five dimensions describe the basic process geometry, while the last two dimensions describe height and pouring temperature. The vector is written as
$$ m = \{ \alpha, \beta, \gamma, \delta, \epsilon, h, t \} $$
where \(\alpha, \beta, \gamma, \delta, \epsilon\) are one-hot material indicators, \(h\) is the normalized height coordinate, and \(t\) is the normalized pouring temperature. This multimodal representation allows the fully convolutional network to consider not only the local geometry but also the vertical position and thermal condition that affect casting defect formation.
The height dimension is normalized between 0 and 100. For a voxel at vertical position \(z\), I compute
$$ h = \frac{z – z_{\min}}{z_{\max} – z_{\min}} \times 100 $$
The temperature dimension is normalized with respect to a reference maximum pouring temperature. I use
$$ t = \frac{T}{T_{\max}} \times 100 $$
where \(T\) is the actual pouring temperature and \(T_{\max}\) is a reference upper bound. In my experiments, I set \(T_{\max} = 1600^\circ\text{C}\). This normalization keeps the temperature input in a similar numerical range as the height input, which helps the optimizer converge.
The final casting defect distribution is also converted into a three-dimensional matrix. Each voxel stores a shrinkage porosity percentage. I binarize this percentage into a defect label. If the shrinkage porosity percentage is greater than or equal to 50%, I assign a defect label of 1. Otherwise, I assign a defect label of 0. This threshold balances the positive and negative samples and simplifies the output layer of the fully convolutional network. The binarization rule is
$$ y(i,j,k) =
\begin{cases}
1, & \text{if } p(i,j,k) \ge 50\% \\
0, & \text{if } p(i,j,k) < 50\%
\end{cases} $$
where \(p(i,j,k)\) is the original shrinkage porosity percentage at voxel \((i,j,k)\), and \(y(i,j,k)\) is the binary casting defect label. This label is used as the ground truth during supervised training. The original numerical simulation result is treated as the teacher, and the fully convolutional network learns to imitate the final casting defect distribution.
Specialized Data Preprocessing for Casting Defects
I designed a specialized data preprocessing pipeline for casting defect prediction because casting process data are not directly compatible with standard image datasets. The raw data include a process plan file and a simulation result file. I decode both files into three-dimensional matrices. The process plan matrix stores material identifiers, and the result matrix stores shrinkage porosity percentages. I call this step three-dimensional matrixization.
The process plan file contains three parts: dimensions, comments, and material attributes. The dimensions part stores the length, width, and height of the computational domain. The comments part is reserved for software extensions and is discarded in my preprocessing. The material attributes part stores a one-dimensional array of material identifiers. I reshape this array into a three-dimensional matrix using the dimension order length, width, and height. The material identifiers are then mapped to the five material groups described above.
The result file also contains dimensions, comments, and shrinkage porosity results. I reshape the shrinkage porosity array into a three-dimensional matrix and then binarize it into casting defect labels. The casting defect matrix is used only as the label. It is not used as an input feature, because the purpose of the method is to predict casting defects from the process plan alone.
Because the number of voxels in a casting process plan can exceed one million, I introduce a two-dimensional slicing technique. I slice the three-dimensional matrix along the length, width, and height directions at regular intervals. Each slice becomes a two-dimensional matrix. This reduces the computational burden and increases the number of training samples. The slicing operation is lossy but preserves the most important geometric and thermal features for casting defect prediction. I also apply normalization and data augmentation to the slices.
| Preprocessing step | Purpose | Effect on casting defect prediction |
|---|---|---|
| 3D matrixization | Convert raw process and result files into matrices | Preserves geometry, material, and shrinkage porosity information |
| Material grouping | Reduce material classes from nine to five | Simplifies input channels and improves training speed |
| Binarization | Convert shrinkage porosity percentage to defect label | Creates balanced classes for supervised learning |
| 2D slicing | Reduce matrix size and increase sample count | Makes fully convolutional network training feasible |
| Normalization | Scale height and temperature to similar ranges | Improves convergence and stability |
| Data augmentation | Expand training set with geometric transformations | Improves generalization and robustness |
I use three data augmentation techniques: translation, stretching, and scaling. I do not use rotation because rotation changes the gravity direction and alters the filling and feeding behavior. In casting defect formation, gravity strongly affects shrinkage cavity and shrinkage porosity. A rotated casting process plan would not correspond to the same physical process. Therefore, I restrict augmentation to transformations that preserve the vertical orientation. The augmentation parameters are listed in the following table.
| Augmentation | Range | Reason for use |
|---|---|---|
| Translation | 30%–80% of slice length in horizontal and vertical directions | Simulates small positioning variations |
| Stretching | 80%–120% of slice length | Simulates slight geometric differences |
| Scaling | 50%–150% of original slice size | Simulates different casting scales |
| Rotation | Not used | Avoids changing gravity direction and feeding behavior |
After preprocessing, I split the dataset into training, validation, and test subsets with a ratio of 7:2:1. The training subset is used to update the network weights. The validation subset is used to monitor overfitting and to select the best model. The test subset is used only for final evaluation. Each input sample is a two-dimensional slice with seven channels: five material channels, one height channel, and one temperature channel. Each label sample is a two-dimensional binary map of casting defects.
Fully Convolutional Network Architecture
I build the prediction model on a fully convolutional network. The network has an encoder path and a decoder path. The encoder path extracts hierarchical features from the input process representation. The decoder path restores the feature maps to the original slice size and produces a dense casting defect prediction. I use convolution, pooling, deconvolution, and unpooling operations. The convolution operation is defined as
$$ S(i,j) = (I * K)(i,j) = \sum_{m} \sum_{n} I(i+m, j+n) K(m,n) $$
where \(I\) is the input feature map, \(K\) is the convolution kernel, and \(S\) is the output feature map. The pooling operation reduces spatial resolution. I use average pooling, which is computed as
$$ P(i,j) = \frac{1}{k^2} \sum_{u=0}^{k-1} \sum_{v=0}^{k-1} S(i k + u, j k + v) $$
where \(k\) is the pooling window size. The deconvolution operation reverses the convolution by mapping a low-resolution feature map to a higher-resolution feature map. The unpooling operation reverses the pooling operation by expanding the spatial dimensions. The decoder combines multiple feature maps from different encoder stages to recover fine spatial details that are important for casting defect localization.
The network architecture I use contains five encoder stages and five decoder stages. Each encoder stage contains a convolution layer followed by a pooling layer. Each decoder stage contains a deconvolution layer followed by an unpooling layer. The final layer is a \(1 \times 1\) convolution that maps the feature channels to the number of classes. I use two classes: casting defect and non-defect. The layer parameters are summarized in the following table.
| Layer index | Layer type | Kernel size | Number of kernels | Output size |
|---|---|---|---|---|
| 0 | Input | – | – | \(224 \times 224\) |
| 1 | Convolution | \(3 \times 3\) | 3 | \(224 \times 224\) |
| 2 | Pooling | – | 2 | \(112 \times 112\) |
| 3 | Convolution | \(3 \times 3\) | 3 | \(112 \times 112\) |
| 4 | Pooling | – | 2 | \(56 \times 56\) |
| 5 | Convolution | \(3 \times 3\) | 3 | \(56 \times 56\) |
| 6 | Pooling | – | 2 | \(28 \times 28\) |
| 7 | Convolution | \(3 \times 3\) | 3 | \(28 \times 28\) |
| 8 | Pooling | – | 2 | \(14 \times 14\) |
| 9 | Convolution | \(3 \times 3\) | 3 | \(14 \times 14\) |
| 10 | Pooling | – | 2 | \(7 \times 7\) |
| 11 | Deconvolution | \(3 \times 3\) | 3 | \(7 \times 7\) |
| 12 | Unpooling | – | 2 | \(14 \times 14\) |
| 13 | Deconvolution | \(3 \times 3\) | 3 | \(14 \times 14\) |
| 14 | Unpooling | – | 2 | \(28 \times 28\) |
| 15 | Deconvolution | \(3 \times 3\) | 3 | \(28 \times 28\) |
| 16 | Unpooling | – | 2 | \(56 \times 56\) |
| 17 | Deconvolution | \(3 \times 3\) | 3 | \(56 \times 56\) |
| 18 | Unpooling | – | 2 | \(112 \times 112\) |
| 19 | Deconvolution | \(3 \times 3\) | 3 | \(112 \times 112\) |
| 20 | Unpooling | – | 2 | \(224 \times 224\) |
| 21 | Convolution | \(1 \times 1\) | 1 | \(224 \times 224\) |
| 22 | Output | – | – | \(224 \times 224\) |
The encoder extracts features at multiple scales. The first convolution layer detects low-level features such as edges, corners, and material boundaries. The deeper convolution layers detect higher-level features such as thermal centers, feeding paths, and the interaction between risers and thick sections. The decoder combines these features and produces a casting defect probability map. The final \(1 \times 1\) convolution converts the feature vector at each pixel into class scores. I apply a softmax function to obtain probabilities:
$$ \hat{y}_c(i,j) = \frac{\exp(z_c(i,j))}{\sum_{c’=1}^{C} \exp(z_{c’}(i,j))} $$
where \(z_c(i,j)\) is the score for class \(c\) at pixel \((i,j)\), \(\hat{y}_c(i,j)\) is the predicted probability, and \(C=2\) for the casting defect classification. The predicted class is the one with the highest probability. I use cross-entropy loss for training:
$$ L = -\sum_{i,j} \sum_{c=1}^{C} y_c(i,j) \log(\hat{y}_c(i,j)) $$
where \(y_c(i,j)\) is the ground truth label. Because the number of non-defect pixels is usually larger than the number of casting defect pixels, I use hard negative mining to improve learning. Hard negative mining collects pixels that are repeatedly misclassified and adds them to subsequent mini-batches. This helps the model focus on difficult casting defect samples and reduces the bias toward the majority class.
Network Training and Parameter Update
I initialize the network weights using a Gaussian distribution centered at zero. The standard deviation is scaled by the input size to keep the output variance stable. For a layer with \(n\) inputs, I use
$$ W \sim 0.001 \times \frac{\mathcal{N}(0,1)}{\sqrt{n}} $$
When I use ReLU activation, I adjust the initialization as
$$ W \sim 0.001 \times \frac{\mathcal{N}(0,1)}{\sqrt{2/n}} $$
I also use a convolutional autoencoder to pretrain the lower convolution layers. The autoencoder encodes the input slice into a latent representation and then decodes it back to the original slice. If the reconstruction is accurate, the convolution layers have learned useful feature extractors. I then transfer these pretrained weights to the fully convolutional network. This initialization improves convergence stability and reduces the training time for casting defect prediction.
I use mini-batch stochastic gradient descent with backpropagation. The weight update rule is
$$ w \leftarrow w – \eta_w \frac{\partial E}{\partial w} $$
where \(E\) is the loss, \(w\) is a weight, and \(\eta_w\) is the learning rate. I use Adagrad to adapt the learning rate for each parameter:
$$ \eta_w = \frac{\eta}{\sqrt{\sum_{i=0}^{t} \left( \frac{\partial E}{\partial w} \right)^2 + \epsilon}} $$
where \(\eta\) is the initial learning rate and \(\epsilon\) is a small constant for numerical stability. I also use Nesterov accelerated gradient to improve convergence. The momentum update is
$$ m_{i+1} = \beta m_i + g(w_i – \eta \beta m_i) $$
$$ w_{i+1} = w_i – \eta m_{i+1} $$
where \(\beta\) is the momentum coefficient and \(g(\cdot)\) is the gradient of the loss. I set \(\beta = 0.9\). The training hyperparameters are listed in the following table.
| Hyperparameter | Value | Purpose |
|---|---|---|
| Mini-batch size | 16 | Controls gradient noise and memory use |
| Initial learning rate | 0.005 | Sets the initial step size |
| Learning rate method | Adagrad | Adapts the step size per parameter |
| Momentum method | Nesterov accelerated gradient | Improves convergence and escapes local minima |
| Momentum coefficient | 0.9 | Controls the contribution of previous updates |
| Training iterations | 50,000 | Ensures convergence of the casting defect model |
| Data split | 70% training, 20% validation, 10% test | Evaluates generalization and prevents overfitting |
I use a GPU with 16 GB memory for training. The fully convolutional network is trained on two-dimensional slices derived from the three-dimensional casting process matrices. The model learns to predict casting defects at the pixel level. After training, I save the network structure and the trained weights. During inference, I load the saved model and process a new casting process plan. The preprocessing steps are identical to those used during training, except that data augmentation is not applied. The inference time is on the order of seconds, which is several orders of magnitude faster than conventional numerical simulation.
Case Study on a Bearing Housing Casting
I apply the proposed method to a bearing housing casting. The casting has a symmetric structure and is made of cast steel. The overall dimensions are approximately \(1430\,\text{mm} \times 1160\,\text{mm} \times 810\,\text{mm}\). The weight is about 2600 kg. The maximum wall thickness is 220 mm, and the minimum wall thickness is 12 mm. The process plan includes a sand core, chiller, riser, and riser sleeve. I use a phenolic resin sand mold. The casting defect of interest is shrinkage porosity and shrinkage cavity.
I compare the fast prediction method with the traditional numerical simulation method. The comparison is shown in the following table.
| Method | Calculation time | Accuracy |
|---|---|---|
| Fully convolutional network | 2.8 s | 87.15% |
| Numerical simulation | 2.15 h | Baseline |
The fast prediction method reduces the calculation time from hours to seconds. The predicted casting defect distribution agrees with the numerical simulation result in most regions. In the top gate and open riser regions, the model correctly predicts casting defects because these regions solidify late and tend to accumulate shrinkage cavities. The multimodal input provides the height and temperature information that helps the model identify these late-solidifying regions. In the blind riser regions, the model predicts casting defects with good agreement. The material channels allow the network to distinguish riser sleeves, risers, and the casting itself. The height channel allows the network to understand the vertical position of each riser. The temperature channel provides the thermal condition of the pouring process.
In one internal hot spot region, the prediction is less accurate. The model identifies the location but does not reproduce the exact morphology of the casting defect. This is because the receptive field of the convolution kernels is limited. The feeding effect of a nearby blind riser depends on a large region of the process plan, and the low-level convolution layers cannot fully capture this long-range interaction. The result is that the model underestimates the casting defect area in that region. This observation suggests that increasing the kernel size or adding dilated convolution could improve the prediction of casting defects in complex hot spots.
Case Study on an Oil Cylinder Casting
I also apply the method to an oil cylinder casting. The material is ductile iron. The overall dimensions are approximately \(830\,\text{mm} \times 680\,\text{mm} \times 500\,\text{mm}\). The weight is about 690 kg. The maximum wall thickness is 140 mm, and the minimum wall thickness is 50 mm. The process plan includes self-hardening resin sand for the mold and core, a simple gating system, and a feeding system. The casting defect of interest is again shrinkage porosity and shrinkage cavity.
The comparison between the fast prediction method and numerical simulation is shown in the following table.
| Method | Calculation time | Accuracy |
|---|---|---|
| Fully convolutional network | 1.8 s | 80.25% |
| Numerical simulation | 1.64 h | Baseline |
The fast prediction method again reduces the calculation time by several orders of magnitude. The predicted casting defect distribution is similar to the numerical simulation result. In the gate region, the model predicts casting defects because the gate solidifies late. In the blind riser regions, the model predicts the correct locations of casting defects, although the shape differs slightly. The model also identifies some hot spots in the casting. However, in regions where the feeding effect of a blind riser is controlled by a narrow neck, the model has difficulty. The narrow neck may solidify early and reduce the feeding effect, which promotes casting defect formation. The fully convolutional network can detect the narrow neck, but the limited receptive field makes it difficult to balance the neck geometry and the overall riser volume. As a result, the predicted casting defect area may be smaller or larger than the numerical simulation result.
In another region, the model predicts casting defects because the local geometry is complex and contains a hot spot. However, the actual process plan fills and solidifies early in that region, so no casting defect forms. The model overpredicts casting defects in this case. This error is related to the limited training data and the limited receptive field. With more training samples and a larger receptive field, the model could learn the filling and solidification sequence more accurately. The temperature channel and height channel already provide useful information, but additional process variables such as pouring pressure and mold material could further improve the casting defect prediction.
Discussion of Accuracy and Efficiency
I evaluate the fast prediction method using pixel-wise accuracy. The accuracy is defined as
$$ \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} $$
where \(TP\) is the number of true positive casting defect pixels, \(TN\) is the number of true negative pixels, \(FP\) is the number of false positive pixels, and \(FN\) is the number of false negative pixels. The method achieves high accuracy in regions where the casting defect formation is dominated by local geometry and thermal condition. The method is less accurate in regions where long-range feeding and complex solidification sequences dominate. This is consistent with the nature of the fully convolutional network, which learns local and hierarchical features but may struggle with global constraints.
I also evaluate the efficiency. The numerical simulation method requires mesh generation, solving the heat transfer equation, solving the fluid flow equation, and solving the stress equation. The fully convolutional network requires only a forward pass. The inference time is independent of the time step and the solidification duration. The computational cost is dominated by the number of convolution operations, which is fixed for a given network architecture and input size. Therefore, the fast prediction method provides a predictable and low-latency solution for casting defect prediction.
The following table summarizes the main advantages and limitations of the method.
| Aspect | Observation |
|---|---|
| Speed | Seconds per prediction instead of hours |
| Accuracy | High in riser, gate, and hot spot regions; lower in complex feeding regions |
| Input | Multimodal 3D image with material, height, and temperature channels |
| Output | Pixel-level casting defect probability map |
| Training data | Labeled by numerical simulation results |
| Limitation | Limited receptive field and limited data diversity |
I conclude that the fully convolutional network is a promising tool for fast prediction of casting defects. It does not replace numerical simulation during process development, but it can serve as a rapid screening tool. Process engineers can use it to evaluate many process plans in a short time and then select the most promising ones for detailed numerical simulation. This hybrid workflow combines the speed of machine learning with the accuracy of numerical simulation. It can significantly reduce the lead time for casting process optimization and improve the efficiency of casting defect control.
Future Improvements
I plan to improve the method in several directions. First, I will increase the number of convolution kernels and enlarge the receptive field. This can be done by using dilated convolution or by adding a spatial pyramid pooling module. A larger receptive field will help the network capture long-range feeding effects and better predict casting defects in complex regions. Second, I will collect more casting process data from different casting geometries, materials, and pouring conditions. A larger and more diverse dataset will improve the generalization of the casting defect prediction model. Third, I will add more input channels such as pouring pressure, mold material, chiller material, and ambient temperature. These variables influence casting defect formation and can improve the predictive accuracy. Fourth, I will extend the method to other casting defects such as cold shut, misrun, slag inclusion, and cracks. Each casting defect has different formation mechanisms, so I will need to design appropriate input features and output labels. Fifth, I will integrate the method into a cloud-based casting simulation platform. This will allow users to upload a process plan, run the fast prediction, and visualize the casting defect map in a web browser. The integration will make the method more accessible to industry users and will support collaborative process design.
In summary, I have developed a fast prediction method for casting defects based on a fully convolutional network. I transformed the casting defect prediction problem into a multimodal three-dimensional semantic segmentation problem. I designed a specialized data preprocessing pipeline, introduced height and temperature modalities, and trained a fully convolutional network using numerical simulation results as labels. The method achieves second-level inference time and reasonable accuracy for shrinkage porosity and shrinkage cavity casting defects. The case studies on a bearing housing and an oil cylinder demonstrate the feasibility and efficiency of the method. I believe that this approach can contribute to the digitalization and intelligentization of casting process design and can help reduce casting defect rates in industrial production.
