2023

AOI Defect Detection
Algorithm Development

Designing and implementing computer vision algorithms to detect shallow dip and deep dip defects in latex-coated cloth gloves at Ansell — a hybrid pipeline combining YOLO-based deep learning segmentation with classical image analysis for real-time production inspection.

  • Python
  • OpenCV
  • YOLO
  • Halcon
  • NumPy
  • Parallel Processing
  • AOI
  • Computer Vision

Project Overview

As part of the Automated Optical Inspection system at Ansell Lanka, I was responsible for developing computer vision algorithms to detect two critical manufacturing defects — shallow dip and deep dip — occurring during the latex dipping process of cloth gloves.

These defects directly impact coating quality, product durability, and compliance with safety standards. The solution combines a YOLO deep learning model for region-of-interest extraction with classical computer vision techniques for defect quantification — implemented first in Halcon, then converted to Python for production integration.

Problem Context

Both defects arise from process variations during the latex bath dipping step — but manifest differently and require different detection strategies.

Shallow Dip

Under-coating

Insufficient latex coating — thin or missing regions on the glove surface. Caused by insufficient dipping depth, low viscosity, or fast withdrawal speed.

  • Low-intensity regions on coated surface
  • Reduced area of latex coverage
  • Patchy or uneven coating distribution

Deep Dip

Over-coating

Excess latex coating beyond the acceptable boundary. Caused by excessive dip depth or slow withdrawal. Results in material waste and dimensional non-compliance.

  • Coating overflow beyond defined boundary
  • Excess coated area above threshold
  • Contour deviation from nominal dip line

Algorithm Pipeline

Hybrid approach: deep learning handles region extraction, classical CV handles defect quantification. Each stage is separately optimised for robustness and speed.

RAW IMAGE Camera frame from AOI system YOLO Detection / Segmentation ROI extraction Background removed PRE-PROCESSING Normalise & enhance Denoise & smooth Crop & align ROI SHALLOW DIP Intensity thresholding Under-coating area metrics Surface distribution analysis DEEP DIP Boundary contour analysis Overflow area measurement Dip boundary deviation DECISION Rule-based thresholds Pass / Fail label PASS FAIL Stage 1 Stage 2 Stage 3 Stage 4 Stage 5

Detection Approach Detail

Each defect type uses a separate analysis pipeline tuned to its distinct visual signature.

Shallow Dip Detection

Cropped Glove ROI Normalised intensity image Intensity Thresholding Isolate low-reflectance zones Region Metrics Area · distribution · coverage % Rule-based Classifier Compare metrics to thresholds PASS FAIL

Deep Dip Detection

Cropped Glove ROI Normalised intensity image Edge & Contour Detection Locate coating boundary line Overflow Measurement Excess area · boundary deviation Rule-based Classifier Compare metrics to thresholds PASS FAIL

Parallel Processing Architecture

Concurrent pipelines separate detection and analysis stages to meet real-time throughput requirements on the production line.

Image Input Camera frame queue Thread A — YOLO Object detection / segmentation Thread B — CV Analysis Pre-process + feature extraction SYNCHRONISE Merge results Shared queue DECISION Classification Pass / Fail output RESULT Label + Defect type Reduced latency — real-time inspection throughput

Technical Deep Dive

YOLO Integration

  • YOLO model detects and localises gloves in each frame
  • Segmentation isolates inspection region from background
  • Robustness to lighting variation and conveyor movement
  • Eliminates false detections from non-glove objects

Halcon → Python Migration

  • Prototype algorithms developed in Halcon (MVTec)
  • Logic translated to Python using OpenCV and NumPy
  • Validated pixel-level equivalence between implementations
  • Python version integrated into the broader AOI pipeline

Feature Engineering

  • Shallow: intensity thresholding and under-coated area metrics
  • Deep: contour analysis and overflow boundary deviation
  • Separate tunable threshold parameters per defect class
  • Region-based metrics normalised against glove dimensions

Parallel Processing

  • Concurrent threads for YOLO and CV analysis stages
  • Shared result queue for synchronisation before decision
  • Reduced per-frame latency to meet production throughput
  • Decoupled stages allow independent optimisation

Results & Impact

Reliable detection of both shallow and deep dip defect classes in production conditions

Improved inspection consistency over manual visual checks — eliminated operator subjectivity

Parallel processing reduced per-frame latency to meet real-time production line throughput

Hybrid CV + DL architecture contributed to a scalable, maintainable AOI pipeline