Situation
Manual visual inspection of aluminium castings is inconsistent and slow, and manufacturing teams need a fast first-pass check that can flag likely defects for review.
Data Science
A CNN image-classification workflow for identifying defective industrial castings from visual inspection data.
View source repository↗
Why it matters
My role
Manual visual inspection of aluminium castings is inconsistent and slow, and manufacturing teams need a fast first-pass check that can flag likely defects for review.
Build a binary image classifier that distinguishes defective casting fronts from acceptable parts, with a preprocessing and inference pipeline consistent enough to trust on new images.
The final model reached approximately 95% validation accuracy and 96% test accuracy, with precision and recall between 0.93 and 0.96 across both defective and acceptable classes.
Technical implementation
Each layer connects an implementation choice to the decision or workflow it supports.
06 layers| Layer | Implementation | Operational purpose |
|---|---|---|
| Image pipeline | Grayscale conversion, 128 by 128 resizing and pixel normalization | Apply identical preprocessing during training and inference |
| Data split | Separate training, validation and held-out test datasets | Tune the workflow without contaminating final evaluation evidence |
| Augmentation | Controlled random flips and rotations | Improve robustness to small visual variations in part orientation |
| CNN architecture | Conv2D, MaxPooling2D, dense layers, dropout and sigmoid binary output | Learn local defect patterns with a compact laptop-trainable model |
| Training control | Adam, binary cross-entropy and early stopping on validation loss | Optimize classification while limiting overfitting |
| Evaluation and reuse | Confusion matrix, classification report, single-image prediction and saved model artifacts | Verify class-level performance and support repeatable inference |