The rapid advancement of artificial intelligence has ignited a wave of application research across various domains, including the field of non-destructive testing such as magnetic particle inspection (MPI). The analysis of magnetic indications on casting parts is considerably more complex than that on forgings or welds. Accurate defect determination is influenced by numerous factors including surface roughness of the workpiece, material magnetic properties, magnetic particles, and suspension medium. Achieving intelligent defect recognition in this context presents several significant challenges:
- How to preserve the integrity of the magnetic particle indications formed during inspection without disruption.
- How to ensure consistency in image quality during the automated collection of defect images.
- Whether the angles used by robotic systems for automatic photography introduce image distortion.
- How to utilize algorithmic systems to analyze defect images based on relevant quality standards, enabling the system to automatically perform qualitative and quantitative assessments of defects.
This research addresses these challenges by developing an intelligent recognition system for magnetic indications, specifically targeting complex steel casting parts, such as motor suspension brackets used in railway electric locomotives.

System Design for Intelligent Recognition of Casting Part Magnetic Indications
The proposed system is designed to automate the entire process of MPI evaluation for casting parts. It consists of two integral components: a sophisticated hardware platform for consistent image acquisition and a comprehensive software suite for intelligent image analysis and decision-making.
Hardware System Configuration
The hardware platform is engineered to navigate the geometric complexity of typical casting parts while preserving the fragile magnetic particle indications. Its primary components and their design considerations are summarized below:
| Component | Description & Purpose | Key Specifications/Design Notes |
|---|---|---|
| Industrial Camera | High-resolution imaging sensor for capturing defect details. | 20 Megapixel resolution; Ensures consistent image quality across all captures. |
| Manipulation Platform | Positions the casting part for full-surface coverage. | Combines 90° tilt and 180° rotation capabilities; Uses conical fixtures for minimal contact to avoid damaging indications. |
| Six-Axis Robotic Arm | Positions the camera and light source relative to the part. | Maintains camera perpendicularity (>20° angle) to the inspection surface to prevent resolution loss and distortion. |
| UV-A Light Source | Provides uniform illumination for fluorescent magnetic particles. | Central wavelength 365 nm; Array design for even coverage; Maintains >1500 µW/cm² at 30 cm distance. |
| Ambient Light Control | Ensures proper inspection conditions. | Integrated white light meter ensures ambient lux < 20 lx. |
| Calibration Tools | Automates system setup and verification. | Robotic arm auto-measures UV intensity and white light levels pre-operation. |
The system’s minimum detectable defect capability is defined by the surface texture of the casting part. For the motor suspension bracket studied, the system is calibrated to identify magnetic indications with a minimum length of 1.5 mm and a minimum width of 0.2 mm.
Software System Architecture
The software system is the “brain” of the operation, comprising system management software and core algorithm software for defect classification and grading.
System Management Software: This module handles operational workflow, data management, and user interface. A critical function is the “Calibration” or “Setup” module. For each specific casting part model (e.g., different locomotive motor brackets), the software allows pre-defining:
- Inspection Regions: The precise areas on each captured image that correspond to the actual part, excluding background or overlapping image sections.
- Critical vs. Non-Critical Areas: Based on the product acceptance specification (e.g., EN 1369), different areas of the casting part are mapped in the software. Critical areas have stricter acceptance criteria (e.g., LM1/AM1-SM1) compared to non-critical areas (e.g., LM3/AM3-SM3). The software stores the image coordinates for these zones.
This pre-mapping enables the algorithm to not only find a defect but also immediately know its location significance for subsequent grading according to the relevant standard.
Algorithm Software – Core Models: Two state-of-the-art deep learning models are employed for distinct tasks:
- YOLOv8 (You Only Look Once version 8): Used for defect classification and localization. It identifies the type of defect (e.g., crack, inclusion) and draws a bounding box around it in the image.
- DDRNet (Deep Dual-Resolution Network): Used for defect segmentation and precise pixel-level analysis, which is crucial for accurate sizing and grading.
Algorithmic Foundation and Implementation
YOLOv8 for Defect Classification and Localization
YOLOv8 is a single-stage object detection framework renowned for its speed and accuracy. Its architecture is optimized for real-time performance while maintaining high precision, making it suitable for industrial inspection tasks on casting parts.
Architectural Overview: The YOLOv8 model can be conceptually divided into three parts:
- Backbone (CSPDarknet53 based on C2f modules): This is the primary feature extractor. It processes the input RGB image of the casting part surface and converts it into a rich hierarchical feature representation. The C2f (Cross Stage Partial network with 2 convolutions) module enhances gradient flow information through more parallel branches, leading to richer features with reduced computational cost.
- Neck (Feature Pyramid Network): This component performs multi-scale feature fusion. It aggregates features from different layers of the backbone to help detect defects of various sizes that may appear on the casting part. It includes an SPPF (Spatial Pyramid Pooling – Fast) module which efficiently increases the receptive field.
- Head (Anchor-Free): This is the decision-making layer. Unlike earlier YOLO versions, YOLOv8 uses an anchor-free approach, directly predicting the center of an object rather than offset from predefined anchor boxes. It decouples the classification and regression (bounding box) tasks, improving performance. The output includes the defect class (e.g., crack, inclusion) and its precise bounding box coordinates $(x_{center}, y_{center}, width, height)$.
Loss Function: The model is trained by minimizing a composite loss function $L_{total}$ which is crucial for learning to accurately identify defects on the casting part:
$$
L_{total} = L_{cls} + \lambda_{box} L_{box}
$$
Where:
- $L_{cls}$ is the classification loss (e.g., Binary Cross-Entropy), ensuring the model correctly identifies the defect type.
- $L_{box}$ is the bounding box regression loss (e.g., CIoU loss), ensuring the predicted box tightly fits the actual magnetic indication.
- $\lambda_{box}$ is a weighting parameter balancing the two objectives.
DDRNet for Defect Segmentation and Grading Analysis
While YOLOv8 tells us “what and where,” DDRNet tells us “exactly what shape and size.” Semantic segmentation is necessary for precise measurement of defect dimensions, which is a direct input for standards-based grading of the casting part.
Dual-Resolution Architecture: The core innovation of DDRNet is its efficient two-branch structure that maintains both high-resolution and low-resolution feature streams in parallel, facilitating a better trade-off between speed and accuracy—a key concern for inspecting complex casting part geometries.
- High-Resolution Branch: Preserves fine spatial details crucial for accurately delineating the edges of small or thin magnetic indications.
- Low-Resolution Branch: Provides a larger receptive field and richer contextual semantic information, helping to understand the overall defect structure.
The two branches interact through bidirectional feature fusion. The feature maps at stage $i$ can be formulated as:
$$
\begin{cases}
X_{H}^{i} = \mathcal{R}( F_H(X_{H}^{(i-1)}) + \mathcal{T}_{L \rightarrow H}(F_L(X_{L}^{(i-1)})) ) \\
X_{L}^{i} = \mathcal{R}( F_L(X_{L}^{(i-1)}) + \mathcal{T}_{H \rightarrow L}(F_H(X_{H}^{(i-1)})) )
\end{cases}
$$
Where:
- $X_{H}^{i}$ and $X_{L}^{i}$ are the feature maps for the high- and low-resolution branches at stage $i$, respectively.
- $F_H$ and $F_L$ are transformation functions within each branch.
- $\mathcal{T}_{L \rightarrow H}$ is the transformation from low-to-high resolution (e.g., upsampling via bilinear interpolation).
- $\mathcal{T}_{H \rightarrow L}$ is the transformation from high-to-low resolution (e.g., downsampling via a strided convolution).
- $\mathcal{R}$ denotes the ReLU activation function.
Deep Aggregation Pyramid Pooling Module (DAPPM): This module further boosts performance by capturing multi-scale contextual information at very low resolution and efficiently aggregating it, which is vital for correctly interpreting varied defect morphologies on the casting part surface.
Grading Logic: After DDRNet generates a precise pixel mask for a defect, software logic calculates key metrics:
- Length (major axis length)
- Width/Area
- Number of defects within a specified evaluation area
These metrics are then compared against the thresholds defined in the relevant standard (e.g., EN 1369) for the specific zone (critical/non-critical) where the defect resides. This automated comparison yields the final acceptance grade (e.g., acceptable vs. rejectable) for the casting part.
| Step | Process | Primary Algorithm / Logic | Output |
|---|---|---|---|
| 1. Image Acquisition | Robotic system captures full-coverage, consistent UV images. | Hardware Control | Set of registered RGB images of the casting part. |
| 2. Defect Detection | Identifies regions containing potential defects. | YOLOv8 | Bounding boxes with defect class labels (Crack, Inclusion, etc.). |
| 3. Defect Segmentation | Determines precise pixel-level boundary of each defect. | DDRNet | Binary mask for each detected defect. |
| 4. Feature Extraction | Calculates quantifiable defect characteristics. | Post-processing Logic | Metrics: Length, Area, Count, Location. |
| 5. Standards-Based Grading | Compares metrics against acceptance criteria for the defect’s location. | Rule-based Software Engine | Final Grade (e.g., Accept, Reject) for the casting part. |
System Training and Performance
The intelligent recognition capability is not inherent but learned from data. The process involves two main phases: Training and Inference.
Training Phase: A robust dataset is fundamental. For this system targeting casting part inspection, a substantial collection of defect images was curated and manually annotated by NDT experts.
| Defect Class | Number of Annotated Images | Corresponding EN 1369 Category (Example) |
|---|---|---|
| Crack | 992 | Linear indications |
| Inclusion | 1,011 | Non-linear indications |
| Gas Porosity | 873 | Non-linear indications |
| Chaplet (Core Support) | 526 | Relevant non-relevant indication |
This annotated dataset was fed into the YOLOv8 and DDRNet models during supervised training. The models iteratively adjusted their internal parameters to minimize the loss functions, gradually learning to associate the visual patterns of magnetic indications with their correct labels and shapes.
Inference Phase: This is the operational mode. A new, unseen casting part is placed in the system. The hardware captures its images, which are then fed through the trained algorithmic pipeline. The system autonomously detects, classifies, segments, measures, and grades any defects present, producing a digital report without human intervention in the analysis stage.
Performance Outcome: Experimental verification on samples like the motor suspension bracket confirmed the system’s effectiveness. The integrated system successfully:
- Identified magnetic indications corresponding to cracks, inclusions, porosity, and chaplets.
- Accurately segmented these indications for measurement.
- Applied the predefined rules (based on EN 1369 zonal criteria) to automatically assign an acceptance grade to the casting part.
| Metric | YOLOv8 (Classification/Localization) | DDRNet (Segmentation for Grading) | Overall System Impact |
|---|---|---|---|
| Primary Task | Identify “what & where” | Determine “precise shape & size” | Fully automated defect assessment |
| Key Strength | High speed, good accuracy on common defect types. | Pixel-level precision enables accurate sizing per standards. | Eliminates subjective human judgment variability. |
| Output for Grading | Defect type & approximate location. | Exact length, area, and contour. | Direct input for rule-based acceptance logic. |
Conclusion and Perspective
In the context of rapid advancements in artificial intelligence and electronic technologies, the intelligent recognition of magnetic particle indications represents an inevitable trend for the future of non-destructive testing. It is poised to become a crucial automated tool, augmenting or even replacing human judgment in specific, well-defined inspection scenarios.
The intelligent recognition system for casting part magnetic indications described herein integrates an advanced digital imaging hardware platform with sophisticated deep learning software. By leveraging the complementary strengths of YOLOv8 for efficient defect detection/classification and DDRNet for precise defect segmentation, the system achieves reliable automated analysis. It translates the visual evidence of defects into quantitative data and applies standardized quality rules to perform automatic classification and grading. This capability significantly enhances the objectivity, consistency, and traceability of the inspection process for complex casting parts.
Beyond the core recognition task, the system software facilitates complete digital management of inspection results, including archival, statistical analysis, and report generation. This integrated approach—combining robust hardware, state-of-the-art algorithms, and digital workflow management—holds broad application prospects. It provides a concrete pathway and demonstrates the practical feasibility of advancing non-destructive testing technology towards greater automation, digitization, and intelligence, marking a meaningful step in the evolution of quality assurance for critical industrial components like casting parts.
