Casting inspection demands great precision but is exhausting work. Inspectors must examine thousands of casting surfaces or radiographs every day and decide which pass and which fail. Artificial intelligence (AI), especially deep-learning computer vision, can now help recognize defects automatically, quickly, and consistently. This article explains the limits of manual inspection, how AI detects defects, the types of models used, the advantages, AI’s role as a partner to inspectors, implementation challenges, and how to start an AI project in a foundry.
The Limits of Manual Defect Detection
- Fatigue. Inspector concentration drops after a few hours, so small defects are missed.
- Subjectivity. Two inspectors can judge the same defect differently, especially borderline cases.
- Speed. An automotive die casting line can produce a casting every 1–2 minutes, while manual radiographic review takes longer.
- Lost data. Results are often recorded only as “pass” or “reject”, without defect type and location, so they cannot be used to improve the process.
- Shortage of certified inspectors, especially for radiography and ultrasonics.
How AI Detects Defects in Inspection Images
Image sources
| Source | Defects detected |
|---|---|
| Visual cameras with special lighting | Surface cracks, fins, sand inclusions, cold shuts, surface porosity |
| Digital radiography (X-ray) | Gas porosity, shrinkage, internal inclusions |
| CT scanning | 3D defects, porosity, and dimensions |
| 3D scanners | Shape and dimensional deviations |
| Thermography | Subsurface defects and cracks |
| Ultrasonic signals | Internal voids and cracks, especially in steel |
Inspection methods are explained in NDT methods for metal castings.
Types of AI tasks
- Classification: deciding whether an image contains a defect, or which type.
- Object detection: marking each defect’s location with a box, for example with YOLO-family models.
- Segmentation: marking defect regions pixel by pixel, for example with U-Net, so defect size can be measured against standard limits.
- Anomaly detection: the model is trained only on good castings and flags anything different. Useful when defect examples are scarce.
Workflow
- Collect images from the production line under consistent conditions.
- Label images with experienced inspectors: defect type, location, and pass or reject decision.
- Train the model on most of the images, then test on images it has never seen.
- Set decision thresholds, often stricter so dangerous defects do not slip through.
- Run in parallel with inspectors for a period to compare results.
- Monitor and retrain when products, molds, or camera conditions change.
Advantages of AI Over Purely Manual Inspection
| Aspect | Manual inspection | AI-assisted inspection |
|---|---|---|
| Consistency | Depends on person and time | Same every time |
| Speed | Limited | Very fast, suits automated lines |
| Data | Often just pass or reject | Defect type, location, and size stored |
| Fatigue | Yes | No |
| Never-seen-before defects | Experienced inspectors can spot them | Often missed if absent from training data |
| Upfront cost | Low | High |
The stored defect data are very valuable: linked with process data from Industry 4.0, a foundry can see, for example, that porosity rises every time pouring temperature drops below a certain limit.
AI as a Partner, Not a Replacement for Inspectors
In best practice, AI screens out the clearly good and clearly defective castings and passes doubtful cases to a human inspector. This approach:
- Reduces inspector workload so they can focus on hard decisions.
- Keeps final responsibility with certified people, which standards and customers often require.
- Generates new labeled data that keep improving the model.
Challenges of Implementing AI Defect Detection in Industry
- Few, imbalanced defect examples. Good castings vastly outnumber defective ones, and some defect types are very rare.
- Inconsistent labels. If inspectors disagree, the model learns from confusing data.
- Varying image conditions. Lighting, part position, and dirty lenses affect results.
- Product changes. New parts or mold changes can require retraining.
- Explainability. Customers and auditors want to know why a casting was rejected or passed.
- Integration with X-ray equipment, conveyors, and plant data systems.
- Combined expertise in metallurgy, inspection, and data science.
How to Start an AI Project in a Foundry
- Pick one part and one inspection type with high volume, such as radiography of an aluminum housing or visual surface inspection.
- Standardize image capture: position, lighting, and resolution.
- Collect and label images with senior inspectors, using clearly written defect definitions.
- Start with a simple model and measure both missed defects and false rejects.
- Run in parallel with manual inspection before using it for decisions.
- Link results to process data to fix root causes, for example with casting simulation.
The Future of AI-Based Defect Detection in Metal Casting
- 100% in-line inspection, not sampling, for critical parts.
- Predicting defects before they happen by combining process data with inspection results.
- Foundation models for industrial images that need less training data.
- Robots with AI vision that inspect and finish castings in one step. See robotics and automation.
- Standards and guidelines for accepting AI systems in quality inspection.
The defects targeted by inspection are described in types of casting defects and the porosity and hot tearing case study.
Frequently Asked Questions
How does AI detect casting defects?
An AI model, usually deep learning, is trained on many casting images labeled as defective or good. Once trained, it recognizes defect patterns in new images from cameras, radiography, or CT scans.
Which defects can AI detect?
Porosity, shrinkage, inclusions, cracks, cold shuts, fins, and dimensional deviations, depending on the image source used.
How many images are needed?
It depends on the defect types and model. Early projects often start with a few hundred to a few thousand labeled images. Anomaly detection can start with images of good castings only.
Does AI replace inspectors?
Not entirely. AI works best as a screen and partner, while difficult decisions and final responsibility stay with certified inspectors.
What is the biggest challenge for AI defect detection?
Scarce defect data and inconsistent labels. Without good data, the model will not be reliable.
Related Articles
- Non-Destructive Testing (NDT) Methods for Detecting Defects in Metal Castings
- Industry 4.0 in Metal Casting Plants: Automation and Real-Time Monitoring
- 20 Types of Casting Defects: Causes, Identification, and Remedies
- Robotics and Automation in Metal Casting

Dagus R. Djuanda is a metallurgical engineer with more than 20 years of experience in materials engineering, specializing in magnetic materials. He holds a master’s degree in magnetic materials engineering, is a doctoral candidate in industrial engineering, and works as an engineer at the Ministry of Industry of the Republic of Indonesia. Founder of Metalurgika.




