Explainable AI for End-of-Line Inspection

Mar 7, 2026 · 2 min read
projects

An advanced Computer Vision system designed to solve the ‘Black Box’ problem in automated manufacturing lines.

Overview

In safety-critical production environments, it is not enough for an AI to flag a defect; quality engineers need to know why a part was rejected. This project implements state-of-the-art Explainable AI (XAI) techniques to provide heatmaps and feature-importance visualizations for an automated screw-inspection assembly.

📊 XAI Visualization Methods

1. Layer-wise Relevance Propagation (LRP)

LRP identifies which pixels contributed most to a specific class prediction.

LRP Heatmap Analysis
Figure 1: LRP heatmap showing high relevance (red) on screw threads for the ‘Fully Tight’ detection.

LRP Case Study
Figure 2: LRP explanation showing how the absence of features triggers a ‘Missing Screw’ classification.

2. Grad-CAM Activation

Grad-CAM visualizes the “attention” of the final convolutional layers.

Grad-CAM Results
Figure 3: Heatmap showing the model’s focus on the central assembly area.

Grad-CAM Detection
Figure 4: Activation map ensuring the model isn’t being distracted by background industrial textures.

3. LIME Explanations

LIME highlights super-pixels that most heavily influenced the YOLOv8 prediction.

LIME Tight
Figure 5: Super-pixels identifying the screw head seating as the primary influence.

LIME Loose
Figure 6: LIME identifying the specific gap features that led to a ‘Loose’ classification.

Challenges & Solutions

Challenge: Model Interpretation

Problem: YOLOv8’s complex architecture makes it difficult to extract traditional gradients for XAI. Solution: Implemented a hook-based system to capture activations from the final bottleneck layers.

Tech Stack Details

  • Deep Learning: YOLOv8 (Ultralytics) for real-time detection.
  • Explainability: Captum (LRP), LIME, and custom Grad-CAM implementations.
  • Processing: OpenCV for image transformation and heatmap overlay.

Project Status: Completed

Gitesh Kumar
Authors
Applied AI & Data Engineer | Industrial Systems
I specialize in bridging the gap between legacy industrial infrastructure and modern AI. With 4+ years of experience at Hindustan Petroleum, I lead the digital modernization of safety-critical systems, transforming messy SCADA/ERP data into high-performance ML architectures. My expertise lies in Safety-by-Design by building robust RAG frameworks and explainable vision systems for autonomous industrial processes.