Skip to content

Automated PCB defect detection system using Ultralytics YOLOv8. Features a robust XML-to-YOLO preprocessing pipeline to detect 6 defect types (e.g., Missing Hole, Short) with microscopic precision. Trained at 1024px resolution on the DeepPCB dataset and optimized for Google Colab (T4 GPU) with automated model persistence to Google Drive.

Notifications You must be signed in to change notification settings

oeilsimple/PCB-Defect-Detection-System

Repository files navigation

🛡️ CircuitGuard: PCB Defect Detection System

Python PyTorch YOLOv8 Flask Status


📖 Overview

CircuitGuard is an AI-powered defect detection system designed to identify faults in Printed Circuit Boards (PCBs) with high accuracy.
It leverages YOLOv8 deep learning models to automate inspection, reduce manual effort, and ensure quality assurance in electronics manufacturing.

The project evolved through two major phases:

  • 🚀 Streamlit Prototype – A rapid proof-of-concept interface for quick experimentation and validation.
  • 🌐 Flask Web Application – A production-ready, full-stack solution with database integration, analytics dashboards, and report generation.

🚀 Streamlit Version (Rapid Prototype)

Streamlit Demo

🌐 Flask Web App (Final Production Build)

Flask Demo

🎓 Academic Context

This project was developed as a capstone deliverable during the Infosys Springboard Internship (8 weeks).
It represents the practical application of:

  • Deep Learning (YOLOv8, Transfer Learning)
  • Computer Vision (Bounding box detection, confidence scoring)
  • Full-Stack Development (Flask, SQLAlchemy, Jinja2)
  • Data Engineering (Dataset preparation, XML-to-YOLO conversion)

📅 Project Milestones & Status

Milestone Module Task Description Status
Milestone 1 Dataset Preparation XML annotations converted to YOLO format, folder restructuring, and class mapping. Done
Milestone 2 Model Training (YOLOv8) Transfer learning applied with high-resolution (1024px) training for precise detection. Done
Milestone 3 Inference & Validation Bounding box generation, confidence scoring, and model persistence. Done
Milestone 4 Backend API Development Flask-based REST API enabling real-time inference. Done
Milestone 5 Frontend Web UI & Deployment Streamlit prototype + Flask/Jinja2 dashboard with SQL history tracking. Done

🛠️ Tech Stack

Python PyTorch Ultralytics Flask SQLite Jinja2


📂 Project Structure & File Architecture

CircuitGuard follows a Model-View-Controller (MVC) architecture with Flask Blueprints for modularity.
Each component is designed for scalability, maintainability, and clarity.

PCB_DEFECT_DETECTOR/
├── models/
│   └── model_loader.py       # Loads YOLOv8 model once at startup for efficient inference.
├── routes/
│   ├── dashboard.py          # Handles homepage logic and navigation.
│   ├── inspection.py         # Manages image uploads, runs inference, and displays results.
│   ├── metrices.py           # Fetches SQL data to visualize defect statistics.
│   └── reports.py            # Generates downloadable PDF/CSV inspection reports.
├── services/
│   ├── analytics.py          # SQLAlchemy integration for scan history and defect analytics.
│   ├── inference.py          # Core AI worker: preprocessing, YOLOv8 prediction, bounding box rendering.
│   └── reports.py            # Formats inspection data into user-friendly reports.
├── static/
│   ├── css/style.css         # Custom styling for UI.
│   ├── js/main.js            # Frontend logic for previews and async API calls.
│   ├── images/background.jpg # UI assets.
│   ├── reports_storage/      # Temporary storage for generated reports.
│   ├── results/              # Processed images with bounding boxes.
│   └── uploads/              # Raw user-uploaded images.
├── templates/
│   ├── base.html             # Master layout (navbar, footer).
│   ├── dashboard.html        # Landing page.
│   ├── inspection.html       # Upload interface for defect detection.
│   ├── metrices.html         # Analytics dashboard with charts.
│   └── reports.html          # Report listing and download page.
├── pcb_yolo_model_v1.pt      # Trained YOLOv8 weights.
├── app.py                    # Entry point: initializes Flask app, registers Blueprints, configures DB.
├── config.py                 # Centralized settings (paths, DB URLs, secrets).
├── requirements.txt          # Dependencies list.
└── streamlit.py              # Legacy prototype for rapid testing.

About

Automated PCB defect detection system using Ultralytics YOLOv8. Features a robust XML-to-YOLO preprocessing pipeline to detect 6 defect types (e.g., Missing Hole, Short) with microscopic precision. Trained at 1024px resolution on the DeepPCB dataset and optimized for Google Colab (T4 GPU) with automated model persistence to Google Drive.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published