Instructions to use shashikantkaushik/Surface-defects-classification-of-the-hot-rolled-steel-strip with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use shashikantkaushik/Surface-defects-classification-of-the-hot-rolled-steel-strip with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://shashikantkaushik/Surface-defects-classification-of-the-hot-rolled-steel-strip") - Notebooks
- Google Colab
- Kaggle
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.
Note: This release covers 4 defect classes (
crazing,inclusion,patches,scratches). A 6-class version (addingpitted_surfaceandrolled-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
- Data Ingestion β Stratified 80/20 train-validation split
- Preprocessing & Augmentation β rotation, horizontal/vertical flip, zoom, and brightness variation applied to improve generalization
- Model Architecture β ResNet50 backbone (ImageNet pretrained), trained in two phases:
- Phase 1: frozen base warm-up (13 epochs)
- Phase 2: selective fine-tuning of the last 60 layers (6 epochs)
- Class Balancing β computed class weights to address any dataset imbalance
- 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
| Metric | Score |
|---|---|
| Accuracy | 97.50% |
| Matthews Correlation Coefficient (MCC) | 0.9674 |
| Cohen's Kappa | 0.9667 |
| Top-2 Accuracy | 99.17% |
| 95% Confidence Interval (bootstrap, 1000 resamples) | [95.42%, 99.17%] |
Per-Class Results
| Class | Accuracy | AUC | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|---|---|
| Crazing | 98.33% | 1.000 | 1.00 | 0.98 | 0.99 | 60 |
| Inclusion | 100.00% | 1.000 | 0.91 | 1.00 | 0.95 | 60 |
| Patches | 100.00% | 1.000 | 1.00 | 1.00 | 1.00 | 60 |
| Scratches | 91.67% | 1.000 | 1.00 | 0.92 | 0.96 | 60 |
Total misclassified: 6 out of 240 validation images
Confidence Analysis
| Mean Confidence | |
|---|---|
| Correct predictions | 0.9681 |
| Incorrect predictions | 0.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
Training Curves (Accuracy & Loss)
ROC Curve β Per Class
Precision-Recall Curve β Per Class
Prediction Confidence Distribution
Calibration Curve
Bootstrap Accuracy Distribution (95% CI)
Misclassified Examples
Usage
Installation
pip install tensorflow pillow numpy
Load the model and predict
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
| Platform | Link |
|---|---|
| Hugging Face | https://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
- Downloads last month
- -







