← Back to About

Project

Metal Defect Detector

Computer Vision · Deep Learning · Flask

A deep-learning system that inspects a metal surface image and classifies it into one of nine common defect types — bridging my materials background with applied AI.

View on GitHub ↗ Run it locally
Domain
Computer Vision
Stack
TensorFlow · Flask
Classes
9 defect types
Approaches
5 architectures

What it detects

Nine surface-defect types

Trained on common steel-surface defects, the models classify a surface image into the category it most resembles.

Crazing
Crack
Inclusion
Scratches
Indentation
Oil Spot
Rolling
Rusting
Welding Line

How it works

Five deep-learning approaches

The project implements and compares several architectures for the same task — each attacking defect recognition from a different angle.

01

ArcFace Loss

An additive angular-margin loss that pulls each defect class into a tighter, better-separated cluster in feature space — sharper decision boundaries between look-alike defects.

02

Multitask Learning

One network trained to classify, segment, and localize defects at once, so shared features are richer than any single task would learn alone.

03

Contrastive Learning

A SimCLR-style self-supervised stage that learns defect representations from unlabeled images before fine-tuning — useful when labeled data is scarce.

04

U-Net

An encoder–decoder that segments the defect region pixel-by-pixel while classifying it, giving a spatial map of where the flaw sits on the surface.

05

Deep Texture Network

An architecture specialized for the fine-grained texture cues that distinguish metal defects, where the pattern matters more than the shape.

Ensemble

The trained models can be combined into an ensemble at inference — pooling their predictions for a more robust final call.

Built with

Tech stack

TensorFlow / Keras Flask OpenCV NumPy Python Bootstrap UI

Try it

Run it locally

The detector serves a Flask web app; trained models download automatically on first launch.

# clone and set up
git clone https://github.com/Akshaay1/metal-defect-detector
cd metal-defect-detector
pip install -r requirements.txt

# launch the web app (models auto-download on first run)
python app.py

# then open
http://localhost:5000

This is a TensorFlow-powered app, so the live detector runs on a Python backend rather than static hosting. Grab the code above to run the full interactive tool, or explore the source on GitHub.