Skip to content

GOKULPRASANTH-M/PCB-Defect-Detection-using-YOLOv8x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLOv8x-HICAUps: Attention-Based PCB Defect Detection

Overview

This project presents YOLOv8x-HICAUps, an enhanced object detection framework for accurate Printed Circuit Board (PCB) defect detection. The model is specifically designed to address the challenges of detecting small-scale defects in densely packed PCB layouts with complex backgrounds.

YOLOv8x-HICAUps integrates a HorNet backbone, Convolutional Block Attention Module (CBAM), and attention-based up-sampling to improve feature extraction, feature fusion, and small-object detection accuracy while maintaining computational efficiency.


Key Contributions

  • Proposed YOLOv8x-HICAUps framework for PCB defect detection
  • HorNet-based backbone for enhanced high-order spatial feature extraction
  • CBAM-based channel and spatial attention for suppressing background noise
  • Attention-based up-sampling for preserving fine-grained defect features
  • Optimized detection head focused exclusively on small defect targets
  • High detection accuracy with reduced computational overhead

Model Architecture

The YOLOv8x-HICAUps architecture consists of three main components:

Backbone

  • HorNet with C3HB modules
  • Recursive gated convolutions
  • Depth-wise separable convolutions for lightweight design

Neck

  • CBAM-enhanced feature fusion
  • Attention-based up-sampling to preserve semantic consistency
  • Improved multi-scale feature aggregation

Detection Head

  • Single small-object detection head
  • Eliminates medium and large object heads to prevent feature loss
  • Optimized for detecting defects smaller than 10×10 pixels

Dataset

The model is evaluated on the HRIPCB dataset, a publicly available PCB defect detection benchmark.

  • Total images: 693
  • Image resolution: ~2777 × 2188
  • Defect categories:
    • Missing hole
    • Open circuit
    • Spur
    • Short
    • Spurious copper
    • Mouse bite
  • Train–test split: 9:1

Training Configuration

  • Framework: PyTorch
  • Model: YOLOv8x with custom HICAUps modules
  • Epochs: 100
  • Optimizer: Adam
  • Loss components:
    • Bounding box regression loss
    • Classification loss
    • Distribution Focal Loss (DFL)

Evaluation Metrics

  • Precision
  • Recall
  • Mean Average Precision (mAP@0.5)
  • Mean Average Precision (mAP@0.5:0.95)

Results

The proposed YOLOv8x-HICAUps model achieves superior performance compared to baseline detectors.

  • Precision: 0.9786
  • Recall: 0.9784
  • mAP@0.5: 0.983
  • mAP@0.5:0.95: 0.537
  • Overall detection accuracy: 98.3%

The model demonstrates strong robustness and generalization across all defect categories, particularly for small and subtle defects such as spur and mouse bite.


Technology Stack

  • Programming Language: Python
  • Deep Learning Framework: PyTorch
  • Detection Framework: YOLOv8
  • Libraries: NumPy, OpenCV
  • Tools: Git, Linux

Applications

  • Automated Optical Inspection (AOI)
  • PCB manufacturing quality control
  • Industrial defect detection systems
  • Embedded and resource-constrained vision systems

About

YOLOv8x-HICAUps integrates a HorNet backbone, Convolutional Block Attention Module (CBAM), and attention-based up-sampling to improve feature extraction, feature fusion, and small-object detection accuracy while maintaining computational efficiency.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors