The presence of casting defects, particularly shrinkage cavities and porosity, significantly affects the mechanical integrity and service life of cast components. Traditional numerical simulation methods are capable of predicting the distribution of these casting defects with acceptable accuracy, yet they demand substantial computational resources and time. In today’s fast-paced manufacturing environment, the long calculation times hinder rapid process optimization and slow down the entire product development cycle. To overcome this bottleneck, I have introduced a novel approach that leverages deep learning, specifically fully convolutional networks (FCNs), to achieve rapid prediction of casting shrinkage defects. In this paper, I present a complete pipeline that transforms the casting process plan into a three-dimensional image representation and treats the defect prediction task as a semantic segmentation problem. Through specialized data preprocessing, multimodal data fusion, and an FCN-based architecture, the proposed method can compute shrinkage defect distributions in seconds, as opposed to hours required by conventional solvers. The effectiveness and efficiency of this approach are demonstrated through two industrial case studies, and the results indicate high agreement with traditional numerical predictions.

The origin of casting defects is complex, involving coupled effects of alloy composition, pouring temperature, mold geometry, gating system design, riser placement, and solidification dynamics. Traditional simulation methods solve partial differential equations governing fluid flow and heat transfer at every time step, which is computationally exhaustive. The central idea of my research is to bypass these transient physics and learn a direct mapping from the static geometry and process parameters to the final shrinkage defect distribution using a deep neural network. This approach is inspired by the success of fully convolutional networks in computer vision tasks such as semantic segmentation, where every pixel in an image is classified into semantic categories. I realized that a casting process plan could be interpreted as a three-dimensional spatial array, where each voxel encodes the material type of the component (casting, mold, riser, chiller, etc.). Similarly, the predicted shrinkage defects can be encoded as a binary label for each voxel. Consequently, the problem of predicting casting defects becomes identical to a 3D semantic segmentation problem. By training an FCN on a large dataset of casting simulations, the network learns to identify hidden patterns and relationships that typically govern solidification defects, enabling fast inference on unseen geometries.
Literature Review
Numerical simulation of casting processes has evolved over several decades. Since the early work in the 1960s, finite difference and finite element methods have been employed to model casting solidification. These methods can accurately predict temperature fields, flow fields, and stress distributions, from which shrinkage defect indicators such as the Niyama criterion are derived. However, the computational burden remains a major drawback. For a typical medium-sized casting, a full solidification simulation may take several hours even on modern workstations. In many foundries, the cost of simulation software and the need for specialized personnel further limits their adoption. A survey indicates that less than 5% of casting enterprises in China actively use numerical simulation for daily production optimization.
Machine learning, especially deep learning, has recently emerged as a powerful tool across many engineering domains. Convolutional neural networks (CNNs) have demonstrated state-of-the-art performance in image classification, object detection, and semantic segmentation. Fully convolutional networks, initially proposed by Jonathan Long et al., replaced fully connected layers with convolutional layers and introduced deconvolutional layers to produce dense per-pixel predictions. This architecture allows arbitrary input sizes and efficient end-to-end learning. In the casting industry, some studies have used CNNs for automatic defect detection from X-ray images, but very few have addressed the direct prediction of shrinkage defects from casting geometry. My work fills this gap by formulating the problem as a 3D semantic segmentation task and developing a dedicated FCN model.
Proposed Methodology
The overall workflow of my fast prediction method consists of three main stages: data preparation, model training, and prediction. The data preparation stage converts raw casting process files and corresponding simulation results into a format suitable for deep learning. The model training stage uses a fully convolutional network to learn the mapping from 3D volumes (containing material labels and auxiliary process parameters) to binary defect masks. The prediction stage then loads the trained model and performs inference on new casting designs within seconds.
To describe the casting setup, I introduce a three-dimensional matrix M where each element represents the material category at that location. Different materials are encoded as distinct integer values, for example, 100 for casting, 200 for mold, 300 for chiller, 400 for gate, 500 for riser sleeve, 600 for riser, 700 for air, and 800 for sprue. Similarly, the defect result is a matrix D where each entry represents the local defect percentage (0-100). By aligning these two matrices, I obtain paired training data. However, the raw matrices are extremely large often containing millions of voxels, which makes direct 3D convolution computationally infeasible with limited hardware. Therefore, I applied a slicing technique, dividing the 3D volume into a set of 2D slices along the length, width, and height directions. Each slice becomes a training sample, effectively increasing the dataset size and reducing computational load.
During the slicing process, the material labels are one-hot encoded into a five-dimensional binary vector, as described in the following equation:
$$\mathbf{m} = \{\alpha, \beta, \gamma, \delta, \epsilon, h, t\}$$
where $\alpha$ represents the metal-occupied region (casting, sprue, riser, gate), $\beta$ the mold and core, $\gamma$ chillers, $\delta$ riser sleeves, and $\epsilon$ air. The variables $h$ and $t$ correspond to the height and pouring temperature, which are introduced as additional modalities. The first five dimensions form a one-hot encoding, while the last two are normalized scalars. This vector is used as the input feature for each voxel in the 2D slices.
Data Preprocessing
3D Matrix Conversion
The raw data from casting simulation software typically includes front-end files that contain geometry and material assignments, plus back-end result files storing defect distributions. I developed a parser to extract the dimensions (length, width, height) and the material identifier array. The array is reshaped into a three-dimensional matrix following the priority order of length, width, then height. In this matrix, each voxel stores an integer code that identifies the material. The same conversion is applied to the defect result file, where each voxel stores a percentage value from 0 to 100 indicating the severity of shrinkage defects. In order to simplify the labeling, I binarized the defect matrices with a threshold of 50%. Thus, voxels with a defect percentage greater than or equal to 50% are labeled as 1 (defective), while all others are labeled as 0 (non-defective). This binarization helps balance the positive and negative samples and reduces the complexity of the output layer.
2D Slicing
Given the large memory footprint of 3D arrays, I chose to slice them into 2D planes. For each casting case, I extract slices along the height direction (horizontal cuts) and possibly along the other axes. Each 2D slice is a matrix of feature vectors of dimension 7, where the last two channels store the normalized height (from 0 to 100) and normalized pouring temperature (from 0 to 100). The height value is consistent for all voxels in a horizontal slice, while the temperature is a global scalar for the whole casting. This representation converts the original 3D problem into a multi-channel 2D semantic segmentation problem, which can be efficiently processed by a 2D FCN.
Multi-Modal Data Input
Casting shrinkage defects are influenced by numerous factors. In addition to the geometry and material distribution, the vertical position of a region (height) and the pouring temperature play critical roles. For example, risers placed higher tend to feed better due to gravity, and higher pouring temperatures generally reduce premature solidification but can also increase shrinkage porosity. To capture these effects, I augmented the basic material channels with two extra channels: height and temperature. The height channel is derived from the normalized coordinate of each slice, making it possible for the network to learn the gravitational feeding effect. The temperature channel is a constant map across all slices, yet it provides the network with essential process information. The multimodal input is depicted as:
$$\mathbf{X} \in \mathbb{R}^{W \times H \times 7}$$
where $W$ and $H$ are the width and height of a sliced plane, and the seven channels correspond to the five one-hot material channels, the height map, and the temperature map. This design enables the FCN to jointly reason about geometry, material layout, vertical position, and thermal boundary conditions.
Network Architecture
The core of my prediction model is a fully convolutional neural network, adapted from the standard FCN architecture. The network consists of a contracting path (encoder) and an expanding path (decoder). The contracting path contains five convolutional layers, each followed by a max-pooling layer that reduces the spatial resolution by half. The convolutional layers use 3×3 kernels with 3 output channels (after the first layer, the channel count is maintained for simplicity). Table 1 lists the detailed configuration of each layer.
| Layer ID | Layer type | Kernel size | Number of kernels | Stride | Output feature map size |
|---|---|---|---|---|---|
| 0 | Input | – | – | – | 224×224×7 |
| 1 | Convolution | 3×3 | 3 | 1 | 224×224×3 |
| 2 | Max pooling | 2×2 | – | 2 | 112×112×3 |
| 3 | Convolution | 3×3 | 3 | 1 | 112×112×3 |
| 4 | Max pooling | 2×2 | – | 2 | 56×56×3 |
| 5 | Convolution | 3×3 | 3 | 1 | 56×56×3 |
| 6 | Max pooling | 2×2 | – | 2 | 28×28×3 |
| 7 | Convolution | 3×3 | 3 | 1 | 28×28×3 |
| 8 | Max pooling | 2×2 | – | 2 | 14×14×3 |
| 9 | Convolution | 3×3 | 3 | 1 | 14×14×3 |
| 10 | Max pooling | 2×2 | – | 2 | 7×7×3 |
| 11 | Deconvolution | 3×3 | 3 | 1 | 7×7×3 |
| 12 | Unpooling | 2×2 | – | 2 | 14×14×3 |
| 13 | Deconvolution | 3×3 | 3 | 1 | 14×14×3 |
| 14 | Unpooling | 2×2 | – | 2 | 28×28×3 |
| 15 | Deconvolution | 3×3 | 3 | 1 | 28×28×3 |
| 16 | Unpooling | 2×2 | – | 2 | 56×56×3 |
| 17 | Deconvolution | 3×3 | 3 | 1 | 56×56×3 |
| 18 | Unpooling | 2×2 | – | 2 | 112×112×3 |
| 19 | Deconvolution | 3×3 | 3 | 1 | 112×112×3 |
| 20 | Unpooling | 2×2 | – | 2 | 224×224×3 |
| 21 | Convolution | 1×1 | 1 | 1 | 224×224×1 |
| 22 | Output | – | – | – | 224×224×1 |
The decoder convolutions and unpooling layers gradually recover the spatial resolution until it matches the original input dimensions. The final 1×1 convolution produces a single-channel map that is passed through a sigmoid activation to yield the probability of defect for each voxel. During training, the loss is computed using binary cross-entropy:
$$\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, $p_i$ is the predicted probability, and $N$ is the number of samples.
Training Methodology
Data Augmentation
To improve the generalization of the model and to artificially enlarge the training dataset, I applied several data augmentation techniques. Unlike typical image classification where rotations are common, I excluded rotations because the orientation of a casting relative to gravity significantly affects shrinkage defects. Instead, I used translation, scaling, and aspect-ratio stretching. Each of these operations is applied randomly within reasonable ranges. The augmented slices help the network become invariant to slight variations in geometry, position, and scale.
Parameter Initialization and Optimization
Proper weight initialization is crucial for training deep networks. I initialized the weights using a Gaussian distribution with zero mean and standard deviation scaled by the square root of the number of inputs, following the common heuristic:
$$W \sim \mathcal{N}(0, \frac{0.001}{\sqrt{n}})$$
where $n$ is the number of input connections. To further stabilize training, I employed convolutional auto-encoder pretraining for the early convolutional layers. The auto-encoder reconstructs the input from the encoded representation, which encourages meaningful feature extraction even before the supervised phase.
During the supervised training, I used mini-batch stochastic gradient descent with a batch size of 16. The learning rate was initially set to 0.005 and dynamically adjusted using the Adagrad method:
$$w_{t+1} = w_t – \frac{\eta}{\sqrt{\sum_{i=0}^{t} g_i^2 + \epsilon}} g_t$$
where $g_t$ is the gradient at step $t$, $\eta$ is the initial learning rate, and $\epsilon$ is a small constant for numerical stability. To escape local minima, I incorporated Nesterov accelerated gradient with momentum parameter $\beta=0.9$:
$$m_{t+1} = \beta m_t + g(w_t – \eta \beta m_t)$$
$$w_{t+1} = w_t – \eta m_{t+1}$$
Because the defect labels are imbalanced (non-defective voxels dominate), I applied hard negative mining. This technique reuses samples that the model misclassifies during multiple training epochs, effectively forcing the network to focus on the harder regions and reducing the bias toward the majority class.
The training was conducted on a workstation with an NVIDIA GeForce GTX 1080 GPU and 16 GB memory. The network was trained for 50,000 iterations until convergence. Table 2 summarizes the training environment.
| Item | Specification |
|---|---|
| GPU | NVIDIA GeForce GTX 1080 |
| Memory | 16382 MB |
| Batch size | 16 |
| Initial learning rate | 0.005 |
| Momentum | 0.9 |
| Training steps | 50,000 |
Case Studies
Bearing Housing
To evaluate the proposed method, I first applied it to a bearing housing casting. The bearing housing is a symmetric medium-sized steel casting (ZG310-570) with dimensions 1430 mm × 1160 mm × 810 mm and a weight of 2600 kg. The casting features a maximum wall thickness of 220 mm and minimum of 12 mm. The process plan includes a phenolic resin sand mold, chillers, risers, and riser sleeves. I selected a key vertical cross-section for comparison. The trained model predicted the shrinkage defects in approximately 2.8 seconds, while the traditional numerical simulation took 2.15 hours on the same hardware. The agreement between the predicted defect areas and the simulation results was evaluated on a pixel-by-pixel basis, yielding an accuracy of 87.15% for the fast method.
Visual inspection showed that the fast prediction correctly identified defects in the gate regions and open risers, where the molten metal solidifies last. The model also captured defects beneath the dark risers, although some discrepancy in the exact shape was noted. In the central region of the casting, the model did not perfectly reproduce the extent of internal shrinkage porosity. This is likely due to the limited receptive field of the convolutional kernels, which cannot fully account for the long-range influence of the riser feeding distance. Nevertheless, the overall pattern is promising and the fast prediction method could serve as a quick screening tool during process design.
Hydraulic Cylinder
The second case is a hydraulic cylinder casting made of ductile iron (QT500-7). The part dimensions are 830 mm × 680 mm × 500 mm with a weight of 690 kg. The process plan includes a gating system and several risers. I used the same trained model to predict defects on the main section. The computation time was 1.8 seconds, compared to 1.64 hours for numerical simulation. The accuracy with respect to simulation was 80.25%.
The predicted defect locations matched well in the gate area and the riser necks. Some false positives were observed in regions with complex geometry where the model mistakenly identified hot spots, possibly because the network lacked enough context to understand the local cooling condition. Despite these errors, the fast method successfully highlighted the major risk zones and demonstrated its utility in real-world applications.
Discussion
The experimental results confirm that the fully convolutional network can learn a transferable mapping from casting process design to shrinkage defect distribution. The speedup is remarkable: from hours to seconds. However, the accuracy is not yet at a level to completely replace numerical simulations, especially for complex regions where remote feeding effects are critical. The prediction errors are mainly attributed to the limited depth and the small number of channels in the network. Increasing the width (number of filters), the depth, and the receptive field should improve the model’s ability to capture long-range interactions. Additionally, the training dataset used in this study is relatively small, which limits the generalization capability. A larger and more diverse dataset, covering different casting geometries, alloys, and process conditions, would likely enhance the model’s robustness.
Another direction for future work is to incorporate more process parameters such as mold type, chiller material, and pouring speed into the multimodal input. The current model already benefits from height and temperature, but other factors that influence casting defects can be added as additional channels. Ultimately, one may envision a digital twin system where deep learning models provide real-time guidance for foundry process optimization.
Conclusion
In this paper, I presented a fast prediction method for casting shrinkage defects based on fully convolutional neural networks. The problem was formulated as a semantic segmentation task on three-dimensional casting geometry, transformed into a series of multi-modal 2D slices. The proposed data preprocessing pipeline enables efficient training on large casting datasets, while the multimodal input incorporates crucial physical information including material distribution, height, and pouring temperature. The trained FCN model can predict shrinkage defect distributions in just a few seconds, achieving 80-87% accuracy compared with traditional numerical simulations. The method demonstrates a significant improvement in computational efficiency, making it highly suitable for iterative process design and optimization in foundries. Future work will focus on enhancing the model capacity, enlarging the training database, and extending the approach to other types of casting defects.
