Skip to content

Latest commit

ย 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AI Industrial Inspection

๐Ÿญ AI Industrial Inspection

Intelligent Surface Defect Detection

Live Demo GitHub PyTorch

EfficientNet-B0 10 Classes Grad-CAM Streamlit

Computer Vision ยท Deep Learning ยท Transfer Learning ยท Explainable AI


๐ŸŽฏ Project Overview

AI Industrial Inspection is an end-to-end deep learning application built to classify steel surface inspection images into 10 industrial defect categories.

The project uses a trained EfficientNet-B0 model with transfer learning and balanced training. The deployed Streamlit application takes a single uploaded image and returns the predicted defect, confidence score, Top-3 predictions, and a Grad-CAM visual explanation.

Project focus: combining practical image classification, interpretable model output, and a usable web interface into one complete computer-vision workflow.


๐Ÿš€ Live Application

Upload a steel surface image and explore the complete classification + explainability workflow.


Live Status

โœจ Key Capabilities

๐ŸŽฏ Multi-Class Classification

10 industrial defect categories

The model predicts across the complete supported defect taxonomy.

๐Ÿ“ˆ Confidence Scoring

Prediction + confidence

The application reports the model confidence associated with the predicted class.

๐Ÿฅ‡ Top-3 Predictions

Ranked alternatives

The three highest-probability predictions are displayed for additional context.

๐Ÿ”ฅ Grad-CAM Explainability

Visual model attention

The system generates an attention map and overlay for the predicted class.

๐Ÿ–ผ๏ธ Single-Image Inference

End-to-end workflow

Upload one steel surface image and receive the complete inspection result.

๐ŸŒ Streamlit Deployment

Interactive web application

The complete inference interface is deployed through Streamlit Community Cloud.


๐Ÿ“Š Test Performance

87.86%

TEST ACCURACY
Held-out evaluation

79.61%

TEST MACRO F1
10-class performance

83.20%

VALIDATION F1
Best validation score

10

DEFECT CLASSES
Industrial categories

Evaluation note: These values are the project's existing evaluation metrics. They describe performance on the evaluated dataset and should not be interpreted as guaranteed real-world or production performance.


๐Ÿงฉ Supported Defect Classes

01
crease
02
crescent_gap
03
inclusion
04
oil_spot
05
punching_hole
06
rolled_pit
07
silk_spot
08
waist_folding
09
water_spot
10
welding_line

โš™๏ธ How the System Works

01

๐Ÿ–ผ๏ธ
IMAGE INPUT
Steel surface
โ†’ 02

โš™๏ธ
PREPROCESSING
Grayscale + resize
โ†’ 03

๐Ÿง 
EFFICIENTNET-B0
Feature extraction
โ†’ 04

๐ŸŽฏ
PREDICTION
Class + confidence
โ†’ 05

๐Ÿ”ฅ
GRAD-CAM
Visual explanation

๐Ÿ—๏ธ System Architecture

AI Industrial Inspection System Architecture

The inference pipeline connects image preprocessing, EfficientNet-B0 classification, ranked prediction output, and Grad-CAM explainability into one inspection workflow.

                 STEEL SURFACE IMAGE
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚  PREPROCESSING  โ”‚
                โ”‚ Grayscale+Resizeโ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚  EFFICIENTNET-B0โ”‚
                โ”‚   CLASSIFIER    โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚   PREDICTION    โ”‚
                โ”‚ Class+Confidenceโ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ–ผ             โ–ผ
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚  TOP-3  โ”‚   โ”‚ GRAD-CAM โ”‚
             โ”‚ SCORES  โ”‚   โ”‚ EXPLAIN. โ”‚
             โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
                  โ”‚              โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ–ผ
                EXPLAINABLE RESULT

๐Ÿ” Explainable AI

From Prediction to Visual Explanation

A predicted label tells us what the classifier selected. Grad-CAM adds a visual explanation by highlighting image regions associated with the model's prediction.

Grad-CAM Explainability

๐Ÿ–ผ๏ธ Original

Inspection input

๐Ÿ”ฅ Attention Map

Grad-CAM output

๐ŸŒก๏ธ Overlay

Attention on image

๐ŸŽฏ Prediction

Class + confidence

Interpretation: Grad-CAM is a visual model-explanation technique. It should not be treated as ground-truth defect localization.


๐Ÿ–ฅ๏ธ Application Preview

The deployed application brings the complete inspection workflow into a focused dark industrial interface.

01 ยท Application Dashboard

Application Dashboard

The landing interface presents the project, model performance, supported classes, and image upload workflow.


02 ยท Inspection Result

Inspection Result

The inspection result displays the predicted defect, confidence, model information, inference type, and Top-3 predictions.


03 ยท AI Explainability

Grad-CAM Explainability

The explainability interface presents the original image, Grad-CAM attention map, and AI attention overlay.


04 ยท Supported Defects

Supported Defect Classes

The application exposes all 10 supported industrial defect categories.


๐Ÿง  Model & Methodology

โšก EfficientNet-B0

Core vision architecture

The project uses EfficientNet-B0 as the classification backbone for steel surface defect recognition.

Learning strategy

Transfer learning adapts the pretrained architecture to the project's 10-class industrial inspection task.

โš–๏ธ Balanced Training

Trained inspection model

The deployed checkpoint is:

best_efficientnet_b0_balanced.pth

The Streamlit application loads this trained checkpoint during inference.


๐Ÿ› ๏ธ Technology Stack

๐Ÿ’ป Core Engineering

Layer Technology
๐Ÿ Programming Python
๐Ÿง  Deep Learning PyTorch
๐Ÿ—๏ธ Architecture EfficientNet-B0
๐Ÿ–ผ๏ธ Image Processing Torchvision ยท Pillow
๐Ÿ“Š Evaluation Scikit-learn

๐Ÿš€ Application & AI

Layer Technology
๐Ÿ” Explainability Grad-CAM
๐Ÿ“ˆ Visualization Matplotlib
๐ŸŒ Application Streamlit
โ˜๏ธ Deployment Streamlit Community Cloud
๐ŸŽฏ Inference Single-image classification

Python ยท PyTorch ยท EfficientNet-B0 ยท Torchvision ยท Grad-CAM ยท Streamlit


๐Ÿ”ฎ Future Directions

๐Ÿ“ฆ Batch Inspection


Extend the current single-image workflow to multiple inspection images.

๐Ÿ“ Defect Localization


Explore more precise spatial localization of detected surface defects.

๐Ÿ“Š Inspection Analytics


Build richer class-level inspection summaries and dashboards.

๐Ÿ—‚๏ธ Inspection History


Maintain structured records of previous inspection results.

๐Ÿ”” Review Workflows


Add human-review workflows around model predictions.

๐Ÿญ Production Integration


Explore integration with real industrial inspection pipelines.

These are future development directions and are not represented as currently implemented features.


๐Ÿ“ Project Structure

AI_Industrial_Inspection/
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ””โ”€โ”€ app.py
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ best_efficientnet_b0_balanced.pth
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ””โ”€โ”€ AI_Industrial_Inspection.ipynb
โ”‚
โ”œโ”€โ”€ screenshots/
โ”‚   โ”œโ”€โ”€ 01_homepage.png
โ”‚   โ”œโ”€โ”€ 02_inspection_result.png
โ”‚   โ”œโ”€โ”€ 03_gradcam_explainability.png
โ”‚   โ”œโ”€โ”€ 04_supported_defects.png
โ”‚   โ”œโ”€โ”€ 05_system_architecture.png
โ”‚   โ”œโ”€โ”€ 06_industrial_ai_hero.png
โ”‚   โ”œโ”€โ”€ 07_explainable_ai.png
โ”‚   โ””โ”€โ”€ 08_model_technology.png
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ gradcam.py
โ”‚   โ”œโ”€โ”€ inference.py
โ”‚   โ”œโ”€โ”€ model.py
โ”‚   โ””โ”€โ”€ preprocessing.py
โ”‚
โ”œโ”€โ”€ .streamlit/
โ”‚   โ””โ”€โ”€ config.toml
โ”‚
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

๐Ÿ’ป Run Locally

1. Clone the repository

git clone https://github.com/alinkumar/AI_Industrial_Inspection.git
cd AI_Industrial_Inspection

2. Create a virtual environment

Windows PowerShell

python -m venv .venv
.\.venv\Scripts\Activate.ps1

3. Install dependencies

pip install -r requirements.txt

4. Launch the application

streamlit run app/app.py

๐ŸŒ Live Demo

๐Ÿš€ AI Industrial Inspection

Explore the deployed application and test the complete inspection workflow.


Open Live Application



Single Image Inference ยท Top-3 Predictions ยท Grad-CAM Explainability

๐Ÿ““ Development Notebook

The complete development notebook is included in:

notebooks/AI_Industrial_Inspection.ipynb

It documents the model development and evaluation workflow used for the project.


โš ๏ธ Limitations & Responsible Use

This project is an AI-assisted computer vision portfolio/research implementation, not a certified industrial inspection system.

  • Model performance depends on the quality and distribution of inspection images.
  • Reported evaluation metrics should not be interpreted as guaranteed production performance.
  • Grad-CAM provides model attention visualization, not ground-truth defect localization.
  • Real industrial deployment would require domain-specific validation, monitoring, calibration, and operational safety procedures.

The application is designed to demonstrate an end-to-end computer-vision workflow and should not be treated as an autonomous replacement for qualified industrial inspection processes.


๐Ÿ”ฎ Future Directions

๐Ÿ“ฆ
Batch Inspection
๐Ÿ“
Defect Localization
๐Ÿ“Š
Class Dashboards
๐Ÿ—‚๏ธ
Inspection History
๐Ÿ””
Review Workflows
๐Ÿญ
Production Integration

These are future directions and are not represented as currently implemented features.


๐Ÿ“œ License

This project is released under the MIT License.

See LICENSE for the complete license text.


๐Ÿ‘จโ€๐Ÿ’ป Author

Alin Kumar

Data Science ยท Machine Learning ยท Computer Vision

GitHub ย  LinkedIn ย  Live Demo

๐Ÿญ From Surface Image to Explainable AI Decision

EfficientNet-B0 ยท 10-Class Classification ยท Confidence Ranking ยท Grad-CAM ยท Streamlit


Built as a practical Computer Vision & Deep Learning portfolio project.



โญ If you found this project useful, consider starring the repository.

About

AI-powered industrial steel surface defect detection using EfficientNet-B0 and Grad-CAM explainability.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages