CoolFace
Modelpublic

shashikantkaushik/Surface-defects-classification-of-the-hot-rolled-steel-strip

sourceHugging Faceapache-2.0updated 27d agoView on Hugging Face
0likes
Model Card

Surface Defects Classification of the Hot-Rolled Steel Strip

A ResNet50-based deep learning model for automated visual inspection of hot-rolled steel surfaces, built using the Aargus DIY visual inspection tool. The model classifies steel surface defects with 97.50% accuracy.

Python TensorFlow License

Note: This release covers 4 defect classes (crazing, inclusion, patches, scratches). A 6-class version (adding pitted_surface and rolled-in_scale) is in progress — see Roadmap.

Overview

This model performs automated visual inspection of hot-rolled steel surfaces to detect and classify manufacturing defects, replacing slow and inconsistent manual inspection with a fast, consistent AI-based system. It was built using the Aargus DIY visual inspection tool — covering data ingestion, augmentation, transfer learning, and statistical validation.

Defect Classes: crazing, inclusion, patches, scratches


Methodology

  1. 1.Data Ingestion — Stratified 80/20 train-validation split
  2. 2.Preprocessing & Augmentation — rotation, horizontal/vertical flip, zoom, and brightness variation applied to improve generalization
  3. 3.Model Architecture — ResNet50 backbone (ImageNet pretrained), trained in two phases:
  4. 4.Phase 1: frozen base warm-up (13 epochs)
  5. 5.Phase 2: selective fine-tuning of the last 60 layers (6 epochs)
  6. 6.Class Balancing — computed class weights to address any dataset imbalance
  7. 7.Validation — classification metrics (Precision, Recall, F1), confusion matrix analysis, ROC-AUC curves, precision-recall curves, and bootstrap confidence intervals for statistical robustness

Performance

Overall Metrics

MetricScore
Accuracy97.50%
Matthews Correlation Coefficient (MCC)0.9674
Cohen's Kappa0.9667
Top-2 Accuracy99.17%
95% Confidence Interval (bootstrap, 1000 resamples)[95.42%, 99.17%]

Per-Class Results

ClassAccuracyAUCPrecisionRecallF1-ScoreSupport
Crazing98.33%1.0001.000.980.9960
Inclusion100.00%1.0000.911.000.9560
Patches100.00%1.0001.001.001.0060
Scratches91.67%1.0001.000.920.9660

Total misclassified: 6 out of 240 validation images

Confidence Analysis

Mean Confidence
Correct predictions0.9681
Incorrect predictions0.6244

The large gap between correct and incorrect prediction confidence indicates the model is well-calibrated — it tends to be less confident when it makes a mistake, rather than being confidently wrong.


Visual Results

Confusion Matrix

[image]

Training Curves (Accuracy & Loss)

[image]

ROC Curve — Per Class

[image]

Precision-Recall Curve — Per Class

[image]

Prediction Confidence Distribution

[image]

Calibration Curve

[image]

Bootstrap Accuracy Distribution (95% CI)

[image]

Misclassified Examples

[image]


Usage

Installation

bash
pip install tensorflow pillow numpy

Load the model and predict

python
import tensorflow as tf
from tensorflow.keras.applications.resnet50 import preprocess_input
import numpy as np
from PIL import Image

# Load model
model = tf.keras.models.load_model("final_model.h5")
class_names = ["crazing", "inclusion", "patches", "scratches"]

# Load and preprocess an image
img = Image.open("your_steel_surface_image.jpg").resize((224, 224))
arr = preprocess_input(np.array(img))
arr = np.expand_dims(arr, axis=0)

# Predict
preds = model.predict(arr)[0]
predicted_class = class_names[np.argmax(preds)]
confidence = np.max(preds)

print(f"Predicted defect: {predicted_class} ({confidence*100:.2f}% confidence)")

Use Case

Industrial quality control automation for steel manufacturing — reduces manual inspection time and improves defect detection consistency across production lines.


Roadmap

  • —[ ] Retrain on full 6-class dataset (add pitted_surface, rolled-in_scale)
  • —[ ] Publish updated metrics and confusion matrix for 6-class model
  • —[ ] Deploy as REST API endpoint

Links

PlatformLink
Hugging Facehttps://huggingface.co/shashikantkaushik/Surface-defects-classification-of-the-hot-rolled-steel-strip
AIKosh (India AI)

Built With

  • —TensorFlow / Keras
  • —ResNet50 (ImageNet pretrained)
  • —scikit-learn (evaluation metrics)
  • —Google Colab (training environment)

License

This project is licensed under the Apache 2.0 License.


Author

Aargus — DIY Visual Inspection AI Platform