Skip to content

About

XRayDefectIQ is an AI-powered industrial inspection platform for automated X-ray defect detection and quality analysis. The system uses YOLO-based computer vision models to identify defects in radiographic images, visualize bounding-box detections, generate defect-focused ROI crops, and extract statistical texture features for deeper inspection.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

██╗  ██╗██████╗  █████╗ ██╗   ██╗██████╗ ███████╗███████╗███████╗ ██████╗████████╗██╗ ██████╗
╚██╗██╔╝██╔══██╗██╔══██╗╚██╗ ██╔╝██╔══██╗██╔════╝██╔════╝██╔════╝██╔════╝╚══██╔══╝██║██╔═══██╗
 ╚███╔╝ ██████╔╝███████║ ╚████╔╝ ██║  ██║█████╗  █████╗  █████╗  ██║        ██║   ██║██║   ██║
 ██╔██╗ ██╔══██╗██╔══██║  ╚██╔╝  ██║  ██║██╔══╝  ██╔══╝  ██╔══╝  ██║        ██║   ██║██║▄▄ ██║
██╔╝ ██╗██║  ██║██║  ██║   ██║   ██████╔╝███████╗██║     ███████╗╚██████╗   ██║   ██║╚██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚═════╝ ╚══════╝╚═╝     ╚══════╝ ╚═════╝   ╚═╝   ╚═╝ ╚══▀▀═╝

AI-Powered Industrial Radiographic Defect Detection

CI Python Streamlit YOLOv8 OpenCV MySQL License: MIT


Manual radiographic inspection is slow, inconsistent, and impossible to scale. XRayDefectIQ changes that.

Overall Process


Table of Contents


What It Does

XRayDefectIQ is an end-to-end industrial inspection platform that ingests X-ray images, runs them through a trained YOLO detection engine, isolates and characterizes every defect found, and commits structured records to a MySQL database — all through a single interactive UI. No CV expertise required at runtime.

It's built for real NDT workflows: weld inspection, casting analysis, aerospace radiography, and automated manufacturing QA pipelines where accuracy, traceability, and speed are non-negotiable.


System Architecture

System Diagram

Text representation
┌─────────────────────────────────────────────────────────────┐
│                      X-ray Image Input                       │
└───────────────────────────┬─────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│               Image Enhancement Pipeline                     │
│   Grayscale · CLAHE · Contrast · Sharpen · Denoise · Edge   │
└───────────────────────────┬─────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                   YOLO Detection Engine                      │
│          Bounding Boxes · Confidence Scores · Multi-defect  │
└───────────────────────────┬─────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│              Defect ROI + Feature Extraction                 │
│   Texture · Entropy · Skewness · Kurtosis · Pixel Stats     │
└───────────────────────────┬─────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                 Inspection Decision Layer                    │
│              Accept / Reject · Inspector Remarks            │
└───────────────────────────┬─────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│               MySQL Defect Record Storage                    │
│      Full traceability · Defect ID · Component · Date       │
└─────────────────────────────────────────────────────────────┘
Architecture Application Flow Class Structure
Architecture Diagram Flow Diagram Class Diagram

Features

🔍 Automated Defect Detection

  • Upload any X-ray image; YOLO handles the rest
  • Annotated output with bounding boxes and per-defect confidence scores
  • Multi-defect support — catches everything in a single pass
  • ROI extraction per detected defect for downstream analysis

🖼️ Image Processing Suite

Eight enhancement modes to maximize defect visibility before inference:

Mode Purpose
Grayscale Conversion Normalize radiographic input
Histogram Equalization Global contrast correction
CLAHE Localized adaptive contrast enhancement
Contrast Adjustment Manual intensity tuning
Sharpening Edge accentuation for subtle defects
Noise Reduction Remove sensor and scatter artifacts
Blur Filtering Smooth out unwanted high-frequency noise
Edge Detection Highlight structural boundaries

📐 Feature Extraction

For every detected defect region, the platform computes:

  • Statistical metrics — Mean, Variance, Skewness, Kurtosis
  • Texture descriptors — Entropy, intensity distribution
  • Spatial geometry — Bounding box dimensions, centroid, area

🧠 Model Training Console

Full model lifecycle management without leaving the app:

  • Upload custom labeled datasets directly from the UI
  • Trigger YOLO training jobs and watch live progress
  • Save trained checkpoints and hot-swap between models
  • Supports iterative retraining as defect libraries expand

🗄️ Inspection Database

Every inspection writes a structured, queryable record:

Field Description
Defect ID Unique identifier per detection event
Component Name Part under inspection
Asset / Satellite System or assembly context
Component Code Internal part numbering
Defect Type Classification label from the model
Accept / Reject Final disposition
Inspector Remarks Free-text annotation
Timestamp Full datetime of inspection

Model Performance

Detection metrics from the trained YOLO model evaluated on the held-out test set.

Training Results Results Overview
Training Results Results

Confusion Matrix

Raw Normalized
Confusion Matrix Confusion Matrix Normalized

Confidence & Recall Curves

F1–Confidence Precision–Confidence
F1 Confidence Curve Precision Confidence Curve
Recall–Confidence Precision–Recall
Recall Confidence Curve Precision Recall Curve

Project Structure

XRayDefectIQ/
│
├── app.py                  # Main Streamlit interface — all UI and orchestration logic
├── training_handler.py     # YOLO training pipeline and model management
├── mysql_handler.py        # Database connection, queries, and record insertion
├── DATABASE_SETUP.sql      # Schema creation — run once to initialize
│
├── models/                 # Trained model weights (.pt files)
├── Training images/        # Labeled dataset for custom training runs
└── assets/screenshots/     # Architecture diagrams and performance metrics

Getting Started

Prerequisites

  • Python 3.9+
  • MySQL 8.x (running locally or remotely)

Installation

# 1. Clone the repo
git clone https://github.com/Sanskar121543/XRayDefectIQ.git
cd XRayDefectIQ

# 2. Install dependencies
pip install -r requirements.txt

Configuration

Open mysql_handler.py and update your MySQL credentials before running anything:

host     = "localhost"
user     = "your_user"
password = "your_password"
database = "xraydefectiq"

Database Setup

mysql -u root -p < DATABASE_SETUP.sql

Launch

streamlit run app.py

Tech Stack

Layer Technology
Interface Streamlit
Detection Ultralytics YOLO (YOLOv8)
Image Processing OpenCV, NumPy
Data Handling Pandas
Storage MySQL
Language Python 3.9+

Use Cases

  • Weld Inspection — Detect porosity, cracks, and incomplete fusion in weld joints
  • Casting Analysis — Identify voids, inclusions, and shrinkage defects in metal castings
  • Aerospace Radiography — Audit structural components against stringent tolerance specs
  • Manufacturing QA — Integrate into production lines for automated pass/fail decisions
  • NDT Research — Build and benchmark custom defect detection datasets

Roadmap

  • Cloud deployment (AWS / GCP / Azure)
  • Real-time camera and live feed inspection
  • PDF inspection report generation
  • Role-based access control (RBAC)
  • Explainable AI — Grad-CAM heatmap overlays
  • Multi-model ensemble inference

Why This Exists

Manual radiographic inspection has three problems: it's slow, it's subjective, and it doesn't scale. A single inspector reviewing hundreds of images per shift introduces fatigue-driven variance. There's no audit trail. There's no feedback loop into process improvement.

XRayDefectIQ is built to fix all three. Fast inference over any X-ray image. Consistent, model-driven detection that doesn't drift with fatigue. And a database-backed record for every inspection, so quality teams can actually learn from the data they're collecting.


License

MIT — use it, fork it, build on it.


Built by Sanskar Shimpi

About

XRayDefectIQ is an AI-powered industrial inspection platform for automated X-ray defect detection and quality analysis. The system uses YOLO-based computer vision models to identify defects in radiographic images, visualize bounding-box detections, generate defect-focused ROI crops, and extract statistical texture features for deeper inspection.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages