In the field of metal casting, the formation of casting defect remains a critical challenge that directly impacts product quality and manufacturing efficiency. Among various types of casting defect, shrinkage porosity and shrinkage cavity are the most prevalent and harmful. Traditional numerical simulation methods, such as finite element analysis and finite difference methods, can accurately predict the distribution of these defects. However, they are computationally expensive and time-consuming, often requiring several hours or even days to complete a single analysis. This inefficiency severely limits their practical use in industrial production, where rapid process optimization is essential.
To overcome this limitation, I have developed a novel fast prediction method for casting defect based on fully convolutional networks (FCN). The core idea is to transform the prediction task of shrinkage defects into a semantic segmentation problem of three-dimensional volumes. By treating the casting process layout as a three-dimensional image and the defect distribution as pixel-wise labels, I leverage the powerful feature extraction capabilities of deep convolutional neural networks to learn the complex mapping between process parameters and defect outcomes. This approach bypasses the time-consuming iterative computation of solidification and filling, directly predicting the final defect distribution in a matter of seconds.
The proposed method involves several specialized data processing techniques, including 3D matrix conversion, 2D slicing, and multimodal data fusion. I introduce multiple input modalities that capture not only the geometric arrangement of molds, risers, chills, and other components but also crucial manufacturing parameters such as pouring temperature and pouring height. These factors significantly influence the formation of casting defect, and their inclusion greatly enhances the predictive accuracy.
In the following sections, I detail the methodology, data preprocessing, network architecture, training strategy, and validation results of the proposed fast prediction system. Through case studies on bearing housing and oil cylinder castings, I demonstrate that the method achieves over 80% accuracy compared to traditional simulation while reducing computation time from hours to a few seconds. This advancement paves the way for real-time iterative design and optimization of casting processes, ultimately contributing to the intelligent and efficient manufacturing in the foundry industry.
1. Introduction
The casting industry has served as a cornerstone of modern manufacturing for thousands of years. Despite its long history, controlling the quality of cast products remains difficult due to the complex interactions among molten metal properties, mold materials, process parameters, and geometric configurations. Shrinkage defects, including macro-porosity and micro-porosity, are among the most common types of casting defect. They arise when liquid metal solidifies with inadequate feeding, leading to internal voids that weaken the structural integrity of the finished component. In automotive, aerospace, and heavy machinery applications, even minor shrinkage can cause premature failure.
Traditional numerical simulation tools have been developed to predict these defects by solving the governing equations of heat transfer, fluid flow, and solidification. These methods are capable of high accuracy, but they require extensive computational resources and long runtimes. A typical industrial casting simulation may take anywhere from several hours to tens of hours, depending on the mesh density and time step resolution. As a result, the adoption of numerical simulation in small and medium-sized foundries remains below 5% in many countries. The emergence of machine learning, especially deep learning, offers a promising alternative to accelerate casting defect prediction.
In recent years, deep convolutional neural networks (CNNs) have achieved remarkable success in image classification, object detection, and semantic segmentation. The fully convolutional network (FCN) introduced by Shelhamer et al. enables pixel-level classification by converting fully connected layers to convolutional layers and using transposed convolutions for upsampling. This architecture is particularly suitable for tasks where the output has the same spatial resolution as the input, such as semantic segmentation of medical images or satellite imagery.
I recognized the analogy between image segmentation and defect prediction in casting. A casting plan consists of various regions (casting, riser, runner, chill, mold, etc.) that can be represented as different pixel intensities in a 3D volume. The predicted shrinkage defect distribution can be treated as a binary label map. Thus, the problem of casting defect prediction becomes a semantic segmentation problem. This novel perspective allows me to reuse the rich toolset of deep learning while developing a custom-tailored framework that accounts for the physical aspects of casting.

Although several studies have applied machine learning to detect defects in X-ray images of castings, no published work has directly used deep learning to predict shrinkage defects based on the process plan. The key challenges include the lack of standard datasets, the high dimensionality of the input data, and the need to incorporate physical parameters into the model. My research addresses these challenges by proposing a specialized preprocessing pipeline and a multimodal input scheme, resulting in a practical and efficient solution.
The remainder of this paper is organized as follows. Section 2 describes the overall framework of the fast prediction method. Section 3 details the data preprocessing techniques, including 3D matrix conversion and 2D slicing. Section 4 presents the multimodal data input methodology that integrates geometric, temperature, and height information. Section 5 explains the network architecture and training procedure, including parameter initialization and optimization. Section 6 demonstrates the effectiveness of the method through two industrial case studies. Finally, Section 7 concludes the paper and outlines future improvements.
2. Fast Prediction Method Framework
The proposed fast prediction method follows a supervised learning paradigm. The entire workflow is divided into three stages: data preparation, model training, and inference deployment. In the data preparation stage, I collect a large number of casting process plans and their corresponding shrinkage defect results obtained from high-fidelity numerical simulations. These pairs serve as training data, with the process plan being the input and the defect map being the label. The training stage builds a fully convolutional network model that learns the mapping from the input space to the label space. Once trained, the model can predict the casting defect distribution for a new casting plan almost instantly.
The overall architecture of the method is illustrated in a conceptual diagram. The input is a 3D volume that encodes the material types and additional modal features. The network consists of a contraction path (encoder) and an expansion path (decoder). The contraction path repeatedly applies convolutions and max-pooling to extract hierarchical features. The expansion path uses transposed convolutions and unpooling to recover the spatial resolution. A final 1×1 convolution produces the segmentation map.
Mathematically, let \(\mathbf{X}\) denote the input volume of size \(W \times H \times D \times C\), where \(C\) is the number of channels. Each channel represents a specific modality or a one-hot encoding of material categories. Let \(\mathbf{Y} \in \{0,1\}^{W \times H \times D}\) be the binary label volume indicating the presence (1) or absence (0) of shrinkage defects at each voxel. The goal is to learn a function \(f(\mathbf{X};\boldsymbol{\theta})\) parameterized by \(\boldsymbol{\theta}\) that minimizes a loss function \(\mathcal{L}(f(\mathbf{X};\boldsymbol{\theta}),\mathbf{Y})\). The training process updates \(\boldsymbol{\theta}\) using backpropagation and stochastic gradient descent.
One of the main advantages of this approach is that during inference, the forward pass through the network only involves a series of convolution and deconvolution operations, which are highly optimized on modern GPUs. This allows prediction times on the order of seconds, a speedup of several orders of magnitude compared to conventional simulation. Moreover, the model can be retrained or fine-tuned as new data become available, enabling continuous improvement.
3. Data Preprocessing for Casting Process Data
Raw data from casting simulation software are not directly suitable for training deep learning models. I therefore developed a set of preprocessing techniques specifically tailored to the casting domain. These techniques convert the raw geometry and result files into clean, structured matrices that can be consumed by the fully convolutional network.
3.1 3D Matrix Conversion
The casting process plan and the corresponding shrinkage defect result are stored in specific file formats. Taking the in-house casting simulation software as an example, the process file contains three parts: dimensions, comments, and material properties. The dimension section provides the overall length, width, and height of the domain. The material property section stores a one-dimensional array where each element is an integer indicating the material type at that voxel location. A typical mapping is: 100 for casting alloy, 200 for mold, 300 for chill, 400 for gate, 500 for riser sleeve, 600 for riser, 700 for air, and 800 for runner.
Similarly, the defect result file records the shrinkage defect percentage at each voxel. I reshape this one-dimensional array into a 3D matrix using the known dimensions, resulting in a volumetric map of defect intensity. The process matrix is then converted into a one-hot encoded representation. Instead of retaining the original integer codes, I create five binary channels corresponding to five fundamental categories: metal regions (combining casting, runner, riser, and gate), mold and core, chill, riser sleeve, and air. This one-hot encoding is more suitable for convolution operations because it avoids arbitrary numeric order and allows the network to learn distinctive features for each material.
For the defect matrix, I binarize the data. After analyzing the distribution of defect percentages, I found that using a threshold of 50% yields a balanced split between positive and negative examples. Values above 50% are set to 1, indicating a defect, while all other values are set to 0. This binary mapping simplifies the learning task and effectively predicts the presence or absence of casting defect without ranking severity.
3.2 2D Slicing for Data Lightweighting
Casting simulation models often contain millions of voxels. A 3D volume of dimensions 200×200×200 already contains 8 million voxels, leading to excessive memory and computational requirements. To make the data manageable for deep learning, I employ a 2D slicing technique. I extract equally spaced slices along each of the three principal axes (length, width, and height). Each slice is a 2D matrix from the corresponding 3D volume. This reduction drastically lowers the data size, enabling efficient training on conventional hardware. Moreover, slicing increases the number of training samples, which improves the generalization ability of the network.
For example, a 3D matrix of size 100×120×80 can be sliced into 100 slices along the length direction, 120 along the width direction, and 80 along the height direction, yielding 300 2D slices. Each slice is paired with its corresponding defect label slice, providing a rich dataset for training. While slicing discards some 3D context, the network can still learn useful spatial relationships by considering multiple intersecting slices. To mitigate information loss, I also incorporate height information as an explicit input channel, as described in the next section.
3.3 Data Normalization and Encoding
In addition to material type, I normalize the coordinates and feature values to a consistent range. For the height modality, I scale the actual height of each voxel to a value between 0 and 100, representing the relative vertical position within the casting domain. This normalization ensures that slices from different parts and different castings have comparable ranges. For the temperature modality, I normalize the pouring temperature using the formula:
$$t = \left( \frac{T}{1600} \right) \times 100$$
where \(T\) is the pouring temperature in degrees Celsius and 1600 is the assumed maximum temperature. This yields a scalar value between 0 and 100 that is attached to every voxel of the casting process volume. The temperature is constant across the entire volume for a single process plan, but it varies among different examples.
Thus, each voxel becomes a 7-dimensional vector \(\mathbf{m}\) defined as:
$$\mathbf{m} = \{ \alpha, \beta, \gamma, \delta, \epsilon, h, t \}$$
where \(\alpha,\beta,\gamma,\delta,\epsilon\) are the five one-hot encoding components for the material categories, \(h\) is the normalized height, and \(t\) is the normalized temperature. This multi-dimensional representation is then reshaped into slices. A 2D slice therefore has depth 7 (channels), where the first five channels encode material, the sixth channel encodes height, and the seventh channel encodes temperature. The input to the network is a tensor with dimensions \(S \times S \times 7\), where \(S\) is the slice size.
4. Multimodal Data Input
The formation of casting defect is influenced by many factors beyond the simple arrangement of components. In my model, I emphasized three key modalities: the geometric layout (material channels), the vertical position (height channel), and the pouring temperature (temperature channel). This multimodal approach enables the network to learn how the height of a region affects feeding paths and how temperature influences solidification timing.
4.1 Geometric Modality
The geometric modality is represented by the five one-hot material channels. This provides the exact shape and position of all components in the casting process. Convolutional layers can easily detect edges, boundaries, and local patterns that correspond to risers, chills, or thin sections. The position of a hot spot relative to a riser is a critical indicator for potential shrinkage. By stacking multiple slices, the network can infer three-dimensional relationships from correlated 2D slices. The geometric modality forms the backbone of the input data.
4.2 Height Modality
In gravity casting, the height of a region has a direct impact on the feeding pressure. Higher regions experience greater metallostatic pressure, which generally improves feeding. However, the highest points of the casting are often where liquid metal is last to solidify, making them prone to shrinkage. The height channel provides this contextual information. For each slice, the height channel contains the normalized height value of the corresponding voxel in the original 3D volume. This allows the network to distinguish between defects occurring at the top of a riser versus defects occurring at the bottom of a casting. This information is crucial for accurately predicting casting defect locations.
4.3 Temperature Modality
Pouring temperature affects the solidification range and the feeding behavior of the molten metal. Higher temperatures keep the metal liquid for a longer time, allowing better feeding. Conversely, lower temperatures may lead to premature solidification and increased shrinkage. The temperature channel is constant across all voxels for a single process plan, but it varies between different examples. By including this channel, the network learns a global parameter that controls the overall behavior of the defect map. The temperature normalization formula I used is:
$$t = \left( \frac{T – T_{\text{min}}}{T_{\text{max}} – T_{\text{min}}} \right) \times 100$$
Here, \(T_{\text{min}}\) and \(T_{\text{max}}\) are the minimum and maximum pouring temperatures in the dataset, ensuring a continuous scaling across all cases. In practice, I found that using the fixed maximum of 1600°C works well for steel and iron alloys.
Table 1 summarizes the seven input channels and their physical meanings.
| Channel | Symbol | Description |
|---|---|---|
| 1 | \(\alpha\) | Metal region (casting, runner, riser, gate) |
| 2 | \(\beta\) | Mold and core |
| 3 | \(\gamma\) | Chill |
| 4 | \(\delta\) | Riser sleeve |
| 5 | \(\epsilon\) | Air |
| 6 | \(h\) | Normalized height (0–100) |
| 7 | \(t\) | Normalized pouring temperature (0–100) |
5. Network Architecture and Training
5.1 Fully Convolutional Network Model
I adopted a fully convolutional network architecture that consists of an encoder and a decoder. The encoder has five convolutional stages, each followed by a max-pooling layer that reduces the spatial dimensions by half. The decoder has five corresponding deconvolutional stages that upsample the feature maps back to the original resolution. A final 1×1 convolution produces the output segmentation map.
Detailed parameter settings are listed in Table 2.
| Layer ID | Type | Kernel size | Channels | Stride/Pool | Output size |
|---|---|---|---|---|---|
| 0 | Input | – | 7 | – | 224×224 |
| 1 | Convolution | 3×3 | 3 | 1 | 224×224 |
| 2 | Max-pool | 2×2 | – | 2 | 112×112 |
| 3 | Convolution | 3×3 | 3 | 1 | 112×112 |
| 4 | Max-pool | 2×2 | – | 2 | 56×56 |
| 5 | Convolution | 3×3 | 3 | 1 | 56×56 |
| 6 | Max-pool | 2×2 | – | 2 | 28×28 |
| 7 | Convolution | 3×3 | 3 | 1 | 28×28 |
| 8 | Max-pool | 2×2 | – | 2 | 14×14 |
| 9 | Convolution | 3×3 | 3 | 1 | 14×14 |
| 10 | Max-pool | 2×2 | – | 2 | 7×7 |
| 11 | Deconvolution | 3×3 | 3 | 1 | 7×7 |
| 12 | Unpool | 2×2 | – | 2 | 14×14 |
| 13 | Deconvolution | 3×3 | 3 | 1 | 14×14 |
| 14 | Unpool | 2×2 | – | 2 | 28×28 |
| 15 | Deconvolution | 3×3 | 3 | 1 | 28×28 |
| 16 | Unpool | 2×2 | – | 2 | 56×56 |
| 17 | Deconvolution | 3×3 | 3 | 1 | 56×56 |
| 18 | Unpool | 2×2 | – | 2 | 112×112 |
| 19 | Deconvolution | 3×3 | 3 | 1 | 112×112 |
| 20 | Unpool | 2×2 | – | 2 | 224×224 |
| 21 | Convolution | 1×1 | 1 | 1 | 224×224 |
| 22 | Output | – | 1 | – | 224×224 |
During training, the input slices are resized to 224×224 to match the network input size. The output of the network is a probability map indicating the likelihood of a defect at each pixel. The cross-entropy loss function is used:
$$\mathcal{L} = -\frac{1}{N} \sum_{i=1}^{N} \left[ y_i \log(p_i) + (1 – y_i) \log(1 – p_i) \right]$$
where \(y_i\) is the ground truth label (0 or 1) for pixel \(i\), \(p_i\) is the predicted probability, and \(N\) is the total number of pixels. The network parameters are optimized using mini-batch stochastic gradient descent with a batch size of 16. The initial learning rate is set to 0.005, and it is dynamically adjusted using the Adagrad algorithm to ensure stable convergence. To avoid local minima, I incorporate Nesterov accelerated gradient (NAG) with a momentum parameter of 0.9. The update rules are:
$$m_{i+1} = \beta m_i + g(w_i – \eta \beta m_i)$$
$$w_{i+1} = w_i – \eta m_{i+1}$$
where \(m\) is the momentum term, \(\beta = 0.9\) is the momentum coefficient, \(\eta\) is the learning rate, \(g(\cdot)\) is the gradient of the loss, and \(w\) represents the model weights. The model is trained for 50,000 iterations, after which the parameters converge satisfactorily.
5.2 Data Augmentation
To prevent overfitting and improve generalization, I applied several data augmentation techniques. Unlike natural image classification tasks, rotating a casting process is physically questionable because gravity orientation changes the feeding behavior. Therefore, I only used translation, scaling, and stretching augmentations. Specifically, I randomly translated each slice by 30% to 80% of its dimensions along the horizontal and vertical axes. I also stretched slices by factors between 80% and 120%. Additionally, I resized slices to 50%–150% of their original sizes. These augmentations artificially increase the size of the training set and make the model robust to variations in slice positions and scales.
5.3 Handling Class Imbalance
In typical castings, the number of voxels containing shrinkage defects is much smaller than the number of defect-free voxels. This class imbalance can bias the network toward predicting “no defect”. To mitigate this issue, I employed a hard negative mining strategy. During training, I accumulate a list of “hard” examples—pixels that were consistently misclassified in previous iterations. These hard examples are then added to the next mini-batch, effectively giving them higher weight in the gradient updates. This technique forces the network to focus on the more challenging regions, leading to improved recall of casting defect areas.
5.4 Parameter Initialization
Proper initialization of network weights is critical for stable and fast convergence. I initialized all weights using a Gaussian distribution with zero mean and standard deviation scaled by the square root of the number of input connections. The formula is:
$$W \sim \frac{0.001 \cdot \mathcal{N}(0,1)}{\sqrt{n}}$$
where \(n\) is the number of input units to a layer. For layers followed by ReLU activation, I used a modified initialization:
$$W \sim \frac{0.001 \cdot \mathcal{N}(0,1)}{\sqrt{2/n}}$$
Furthermore, I used a convolutional autoencoder to pretrain the lower convolutional layers. This unsupervised pretraining reconstructs the input slices through an encoder-decoder structure, allowing the lower layers to learn useful feature detectors before the full supervised training. The pretrained weights serve as an excellent starting point, accelerating convergence and yielding better final performance.
6. Case Studies and Validation
To assess the effectiveness of my proposed method, I conducted experiments on two industrial castings: a bearing housing and an oil cylinder. Both components are widely used and present challenging geometries with potential shrinkage issues. I selected representative mid-plane slices for prediction and compared the results with traditional numerical simulation.
6.1 Case Study: Bearing Housing
The bearing housing is made of ZG310-570 steel, with overall dimensions of 1430 mm × 1160 mm × 810 mm and a weight of 2600 kg. The maximum wall thickness is 220 mm and the minimum is 12 mm. The process plan includes sand cores, chills, risers, and insulating sleeves. The phenol-formaldehyde resin sand is used for molding. The test setup followed the procedures described in Section 3. After preprocessing, the input slices were fed into the trained fully convolutional network, which produced a defect probability map in 2.8 seconds. In contrast, the traditional numerical simulation required 2.15 hours on the same hardware.
| Method | Computation Time | Accuracy (relative to simulation) |
|---|---|---|
| Fast prediction method | 2.8 seconds | 87.15% |
| Numerical simulation | 2.15 hours | Baseline |
The predicted defect map shows a strong agreement with the simulation results. The network correctly identified defects in the gating system and risers (regions A and E), which are caused by delayed solidification at the top of the pouring system. For the internal hot spots (region C), the model estimated some defects, but the spatial distribution was not perfectly matched, likely due to the limited receptive field of the convolution kernels, which failed to capture the full influence of the right-side blind riser. Overall, the result demonstrates that the fast prediction method can provide a reliable estimation of casting defect locations in a fraction of the original computation time.
6.2 Case Study: Oil Cylinder
The oil cylinder casting is made of ductile iron QT500-7. It has a more complex hollow structure with dimensions of 830 mm × 680 mm × 500 mm and a weight of 690 kg. The maximum wall thickness is 140 mm, while the minimum is 50 mm. The process uses self-hardening resin sand for both the mold and core, with a simple feeding system. The prediction time was only 1.8 seconds, whereas the traditional simulation took 1.64 hours. The comparison is shown in Table 4.
| Method | Computation Time | Accuracy (relative to simulation) |
|---|---|---|
| Fast prediction method | 1.8 seconds | 80.25% |
| Numerical simulation | 1.64 hours | Baseline |
An analysis of the predicted defect map reveals that the network correctly identified defects in the gate area (region A) and in the blind risers (regions B and E). For regions C and F, where the contact between the riser neck and the casting leads to possible premature solidification, the predicted defects matched the simulation in location but underestimated the extent. In regions D and G, the network falsely predicted defects because it identified complex geometries and hot spots, but in reality, those regions solidified early and remained sound. This error likely stems from the limited ability of the network to reason about long-range influences from the gating system, which could be improved by enlarging the receptive field or using 3D convolutions.
6.3 Discussion
The two case studies confirm that my proposed fast prediction method significantly reduces computation time while retaining a reasonable accuracy. The speedup is approximately 2,700× for the bearing housing and 3,200× for the oil cylinder. Such an improvement enables real-time iterative design, where engineers can quickly test multiple process variations and select the most promising one before committing to physical trials. The method also scales well with model complexity; by adding more data and deeper architectures, the accuracy is expected to further improve.
However, the method has some limitations. The use of 2D slices sacrifices true volumetric context. I plan to extend the architecture to 3D convolutions, which will allow the network to exploit full 3D spatial relationships despite the increased computational burden. Additionally, the current model treats temperature as a constant channel; a more refined approach could incorporate temperature gradients or cooling rates. Furthermore, the training dataset is currently limited to a few casting geometries and materials. Expanding the dataset with more industrial examples will enhance generalization.
7. Conclusion
In this work, I presented a novel approach for the fast prediction of casting defect, specifically shrinkage porosity and cavity, using fully convolutional networks. By recasting the defect prediction problem as a semantic segmentation task on 3D volumes, I leveraged the powerful learning capabilities of deep neural networks to directly map casting process parameters to defect distributions. I introduced a specialized data preprocessing pipeline that converts raw simulation files into multimodal 2D slices, incorporating material, height, and temperature information. The network architecture was designed with a symmetric encoder-decoder structure, and training was optimized through data augmentation, class imbalance handling, and careful parameter initialization.
The proposed method was validated on two industrial components: a bearing housing and an oil cylinder. The prediction results aligned with traditional numerical simulation in most regions, achieving accuracies of 87.15% and 80.25%, respectively. More importantly, the computation time was reduced from hours to a few seconds, representing a speedup of over two orders of magnitude. This dramatic improvement makes it feasible to utilize high-fidelity defect predictions in routine process optimization, thus accelerating the development cycle and reducing production costs.
Future work will focus on extending the method to full 3D convolution networks, incorporating additional process parameters such as mold temperature, pouring speed, and alloy composition. I also plan to develop a larger, publicly available dataset for casting defect prediction to facilitate collaborative research. With these enhancements, the fast prediction framework has the potential to become a standard tool in the foundry industry, contributing to the intelligent and sustainable manufacturing of high-quality castings.
Ultimately, the integration of machine learning into casting simulation represents a paradigm shift. Instead of spending hours solving partial differential equations, engineers can now obtain instant forecasts of casting defect, enabling faster design iterations and more efficient use of resources. This research is a stepping stone toward fully automated casting process design, where the computer not only predicts but also suggests optimal process parameters to minimize defect occurrence. The journey from traditional simulation to AI-driven prediction is still in its infancy, but the results presented here demonstrate a clear path forward. I am confident that with continued developments in both algorithms and data infrastructures, the casting industry will witness a new era of intelligent manufacturing.
