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 build and deploy production-grade LLM systems, agentic AI workflows and industrial data pipelines. With 4+ years at Hindustan Petroleum working with SCADA and ERP systems, I understand both the factory floor and the AI stack needed to make sense of it. My recent work combines structured data engineering with natural language AI agents which is deployed live, containerised with Docker and secured with zero-trust networking.