Aluminum Alloy Die-Casting Defect Research Based on "AI + X-ray Inspection"

Time:2025-10-07 19:10:21 / Popularity: / Source:

Aluminum alloy die-castings have high specific strength, specific stiffness, corrosion resistance, are widely used in automotive, aerospace, electronics, and medical equipment industries. During actual die-casting process, a combination of factors, such as abnormal raw material composition, inappropriate mold design, and inappropriate process parameters, can cause defects such as pores, shrinkage cavities, shrinkage porosity, and slag inclusions within aluminum alloy die-castings. These internal defects can further expand under alternating stresses, and if not detected promptly, they can pose serious safety hazards. To detect internal defects in aluminum alloy die-castings during production, X-ray imaging technology is required.
Currently, nearly 80% of aluminum alloy die-casting manufacturers use manual defect assessment. However, evaluation criteria for manual defect assessment vary widely, making it difficult to standardize, prone to false positives and missed detections. During assessment process, quality inspectors must not only focus on size of defect but also on its location. Critical locations in aluminum alloy die-castings include stepped holes, through-holes, and threaded holes. To meet inspection requirements of aluminum alloy die-castings, internal defect segmentation algorithms for aluminum alloy die-castings must not only segment internal defects but also key locations within part. To meet these requirements, research on segmentation algorithms based on multi-task learning is needed for X-ray images of aluminum alloy die-castings.
In recent years, deep learning has been widely researched and applied in fields such as computer vision, natural language processing, and recommendation algorithms. Deep learning-based convolutional neural networks (CNNs) can automatically acquire required features through self-learning in complex scenarios with large amounts of data. MERY D designed CNN model Xnet-II to identify internal defects in aluminum alloy castings, proposed an ellipse generation model and a generative adversarial network to simulate casting defects and expand defect samples. Researchers proposed a spatial attention bilinear convolutional neural network to classify internal defect types in aluminum alloy die-castings. A Mask R-CNN-based X-ray defect detection algorithm for railway castings was proposed. Proposed model can effectively identify bubbles and shrinkage defects in images. A network for internal defect segmentation in castings with adaptive depth and receptive field selection is proposed. Introducing an adaptive depth selection module into a CNN helps identify similar defect types. Proposed model can segment and classify defects in X-ray images.
Semantic segmentation algorithms based on multi-task learning fuse multiple related segmentation tasks and design a unified segmentation model to extract complementary features from a single dataset for these related tasks, thereby improving segmentation accuracy of each task. Researchers proposed FusionNet multi-task segmentation model, designing a boundary-aware branch to supervise boundary features of target, improving segmentation accuracy of model in boundary regions. A dual-path encoding model was designed, incorporating an attention mechanism module when extracting boundaries to improve segmentation accuracy of model at boundaries. A multi-task segmentation model was proposed to extract main features of target. By designing corresponding loss functions to supervise both main features and edge features, model's segmentation performance in both tasks was improved.
There is no clear correlation between defect segmentation task and key location segmentation task in aluminum alloy die castings. However, existing research on multi-task segmentation algorithms has rarely reported on multi-task segmentation algorithms with low correlation. This study investigates a multi-task segmentation algorithm for defect segmentation and key location segmentation. First, a key location boundary-aware decoder is proposed to improve segmentation accuracy of key locations. To enhance feature extraction for low-correlation tasks, a local shared encoding model is further designed. Finally, an interactive attention module is constructed to adaptively fuse key location features and boundary features to improve segmentation accuracy of both tasks. This approach aims to provide a reference for defect detection and analysis of aluminum alloy die-castings.
Key locations and defects of an aluminum alloy die-casting are shown in Figure 1. Aluminum alloy die-casting multi-task segmentation model (Casting Parts X-Ray Image Multi-Task Defect Segmentation Network, CXMTDS-Net) consists of three modules: a Partly Parameters Sharing Two-Stream Encoder Module (PPSTSEM), a Defect Segmentation Decoder (DSD), and a Key Location Segmentation Decoder (KLSD), as shown in Figure 2. PPSTSEM module shares encoding parameters in shallow layers and designs task-specific encoding branches in deep layers to extract semantic features for two low-correlation tasks. DSD module uses decoding models A and B to hierarchically decode features from encoder to obtain defect regions. In KLSD, a decoder for key position segmentation is proposed, and a decoder for key position boundary segmentation is designed to improve accuracy of key position segmentation. Furthermore, an interactive perception module is designed to adaptively fuse key position features and boundary features, improving both boundary position segmentation and boundary segmentation performance.
Taking into account complex scenes and defect region boundaries of aluminum alloy die-castings, a deep learning-based aluminum alloy die-casting X-ray image defect segmentation network (CXDS-Net) is proposed, as shown in Figure 3. Defect segmentation model uses a UNet architecture as backbone network, and encoder uses a ResNet101 model to improve ability to extract effective features in complex scenes.
Aluminum Alloy Die-Casting Defect 
Figure 1. Examples of key locations and defects in aluminum alloy die-castings
Aluminum Alloy Die-Casting Defect 
Figure 2. Multi-task segmentation model architecture for aluminum alloy die-castings
Aluminum Alloy Die-Casting Defect 
Figure 3. Defect segmentation model for aluminum alloy die-casting X-ray images
Due to low correlation between die-casting defect segmentation task and casting key location segmentation task, directly integrating a key location segmentation decoder into defect segmentation decoder does not meet segmentation requirements. Therefore, a decoder (Key Parts Branch, KPB) was designed for die-casting key location segmentation task, as shown in Figure 2. Key locations are readily apparent in X-ray images, and by directly utilizing features extracted from original image encoding, decoder can capture sufficient texture features and deep semantic features at these key locations. In this study, feature maps output by each level of original image encoding are denoted by x0 to x4. Detailed structures of decoding modules A and B in key location segmentation decoder are shown in Figure 4. Although key locations in aluminum alloy die-castings are clearly visible in X-ray images, their shapes and positions vary, and some of their boundaries are discontinuous. Directly using a key location decoder for segmentation results in some low segmentation accuracy at boundaries. This paper proposes a boundary-aware decoder to segment key location boundaries, as shown in Figure 5. Three boundary-aware modules (Edge-Aware Branch, EAB) are designed based on different encoding levels. In EAB_1, x4 feature image, a shallow feature from encoding module, is used to simultaneously segment key locations and their boundaries. In EAB_2, three decoding modules are designed, utilizing x2, x3, x4 feature maps from encoding module for both semantic segmentation and boundary segmentation. In EAB_3, a decoder structure consistent with KPB is designed, fully leveraging features of encoders at different stages. Subsequent experiments will quantitatively evaluate EAB models based on different fusion stages.
Aluminum Alloy Die-Casting Defect 
Figure 4. Aluminum Alloy Die-Casting Key Location Segmentation Model Architecture
Aluminum Alloy Die-Casting Defect 
Figure 5. Boundary-Aware Key Location Segmentation Decoder Strategy
In highly correlated multi-task segmentation tasks, researchers widely use a shared encoder approach to simultaneously encode features related to each task. This parameter-sharing encoder under multi-task supervision can extract complementary features, improving segmentation accuracy of each task. For low-correlation multi-task segmentation encoding models, shallow encoding stage can extract structural features, boundary information, and texture information of die-casting defects from image. Deep encoding stage extracts deep semantic features from different regions. This approach, which does not effectively enhance complementary semantic information within same encoding module, can actually reduce segmentation accuracy of both tasks.
In shallow feature extraction stage, parameter sharing is used to simultaneously encode texture features of die-casting defects, texture information of key locations, and boundary features. In proposed PPSTSEM, convolutional layer parameters of newly designed deep encoding branch remain consistent with model parameters of corresponding convolutional layers in original encoding. Based on different levels of deep encoding, deep encoding branch in PPSTSEM can be divided into three types: using only 5_1 convolutional layer, using 4_1 and 5_1 convolutional layers, using 3_1, 4_1, and 5_1 convolutional layers (see Figure 6). Experiments will verify use of different levels of deep encoding stages.
To further improve segmentation accuracy of key position segmentation task, an interactive attention module (IAM) is proposed (see Figure 7). By using features from other tasks that are highly relevant to task, an attention mechanism module is introduced to obtain an attention map for task's features. Extracted attention map is then inverted to obtain a complementary attention map. Complementary attention map is pixel-wise multiplied with features from other tasks to obtain features complementary to task, which are then pixel-wise added to original features to obtain module's output features.
Aluminum Alloy Die-Casting Defect 
Figure 6: Local Parameter Sharing Dual-Path Encoding Method
Aluminum Alloy Die-Casting Defect 
Figure 7: Interactive Perception Module
A dataset of X-ray images of automotive aluminum alloy die-castings was constructed. During actual automotive parts inspection process, inspectors place parts to be inspected into an X-ray image inspection system. X-ray inspection system consists of four components: an X-ray source, a mechanical transmission system, a digital flat-panel detector, and a computer image processing system.
Constructed dataset contains 3,200 X-ray images with manual annotation results of defect areas. Annotations primarily include pixel-level defect areas, key locations within aluminum alloy die-castings, and pixel-level boundary information, as shown in Figure 8. Key locations within automotive aluminum alloy die-castings primarily include holes to be machined, end faces, and mating surfaces with other parts. Defects in critical locations of aluminum alloy die-castings can pose significant safety risks to subsequent processing steps and subsequent use of parts. During quality inspection, it is important to focus on distribution of defects in these critical locations.
Aluminum Alloy Die-Casting Defect 
Figure 8 Annotation example of an automotive aluminum alloy die-cast X-ray image dataset
Aluminum Alloy Die-Casting Defect 
Table 1 Results of baseline models using different key position boundary perception decoders
Aluminum Alloy Die-Casting Defect 
Table 2 Results of baseline models using different local parameter sharing dual-path encoders
This experiment uses CXDS-Net + EAB_1 model as baseline network. Experimental results show that all three proposed PPSTSEMs effectively improve segmentation accuracy of model on key position segmentation task, with PPSTSEM_2 achieving the best performance in both mIoUK and mIoUE metrics.
To further improve segmentation accuracy of key positions while maintaining defect segmentation accuracy, an interactive attention module is proposed. During key position decoding stage, key position decoded features and key position boundary decoded features are complementarily fused through an attention mechanism module to improve segmentation accuracy of each task. This experiment uses CXDSNet + EAB_1 model as baseline network to verify effectiveness of IAM model. Results are shown in Table 3. As can be seen, after introducing IAM in decoding stage, model achieves improvements in both mIoUK and mIoUE metrics through complementary fusion of key location features and their boundary features, thus validating effectiveness of proposed IAM for key location segmentation task. Effectiveness of model after integrating each module into baseline network was further verified, with experimental results shown in Table 4. These experimental results demonstrate that proposed multi-task defect segmentation model can simultaneously improve segmentation accuracy of both defect segmentation and key location segmentation, two tasks with low correlation, effectively meeting requirement for simultaneous segmentation of defect areas and key location regions in actual quality inspection.
Aluminum Alloy Die-Casting Defect 
Table 3 Results of Baseline Model with Interactive Attention Module
Aluminum Alloy Die-Casting Defect 
Table 4 Comparison of Ablation Tests of Multi-Task Segmentation Models
Figure 9 shows examples of segmentation results for key locations and their boundaries using CXDS-Net+KPB and proposed multi-task segmentation model CXMTDS-Net. Segmentation results show that CXMTDS-Net model significantly improves segmentation performance of key locations compared to CXDS-Net+KPB model. CXDS-Net+KPB performs well only in key locations with distinct boundaries, while segmentation accuracy in areas with blurred boundaries requires further improvement. CXMTDS-Net, on the other hand, achieves better segmentation accuracy in areas with unclear key location boundaries, as shown in Figure 10. This demonstrates that proposed model can accurately segment defect regions.
Aluminum Alloy Die-Casting Defect 
Figure 9: Example of key location segmentation results
Aluminum alloy die-castings 
Figure 10: Example of CXMTDS-Net segmentation results
A multi-task segmentation model, CXMTDS-Net, was proposed for both defect and key location segmentation tasks, effectively improving key location segmentation accuracy. To improve segmentation accuracy of salient objects, Fan D P et al. proposed a reverse attention module (RAM), as shown in Figure 11. This module exploits intrinsic connection between segmented region and its boundary, thereby improving model's segmentation accuracy for target region. Qin X B et al. proposed a residual refinement module (RRM) and designed an encoding and decoding structure to correct model prediction results, thereby improving segmentation accuracy of model in boundary area. Taking CXDS-Net +EAB_2+PPST SEM_2 as baseline network, RAM and RRM methods are fused with baseline network and quantitatively compared with proposed CXMTDS-Net model to verify effectiveness of proposed method in improving accuracy of key position segmentation, as shown in Figure 12.
Aluminum alloy die-castings 
Figure 11 Schematic diagram of RAM module structure
Aluminum alloy die-castings 
Figure 12 Schematic diagram of decoding module C and RMM structure
Aluminum alloy die-castings 
Table 5 Comparison of results of proposed CXMTDS-Net with other methods
Conclusion
(1) For detection of defects in aluminum alloy castings, a key position boundary-aware decoding module is proposed to supervise key position features and boundary area features respectively, significantly improving key position segmentation accuracy. Compared with baseline network, mIoUK increased by 0.7.
(2) A local parameter sharing dual-path encoder is designed. Parameters are shared in shallow feature extraction, and encoding branches for different tasks are constructed in deep encoding stage to achieve efficient feature extraction of low-correlation tasks, improving mIoUK and mIoUE indicators by 1.1 and 0.7 respectively.
(3) We explored interactive fusion mechanism between key positions and key position boundary features, developed an interactive attention module, introduced attention mechanism to adaptively fuse features of key positions and boundary areas, effectively improving segmentation accuracy of model for key positions, improving mIoUK and mIoUE indicators by 0.4 and 1.8 respectively.

Go To Top