SureInspect: Selective Visual Inspection and Operator Triage System
SureInspect is an intelligent PCB inspection system designed to make quality checks faster, safer, and more reliable. It uses OpenCV 5 DNN and split-conformal statistical methods to identify good boards, detect possible defects, and send uncertain cases to human inspectors. The goal is to clear reliable boards in under 42 milliseconds while ensuring that questionable results receive proper attention.
Inspiration
In electronics manufacturing, even a small defect in a printed circuit board (PCB) can lead to serious problems, especially in industries such as automotive, aerospace, and medical equipment. At the same time, a system that incorrectly flags good boards can slow down production, increase costs, and create unnecessary work for inspectors.
Traditional deep learning systems often rely on confidence scores that may not always be reliable when lighting, camera focus, or manufacturing conditions change. This makes it difficult to trust every automated decision.
We built SureInspect to address this challenge. Instead of forcing every board into a simple pass-or-fail decision, the system evaluates the available evidence and decides whether a board can be cleared automatically, should be marked as defective, needs human review, or requires a new image.
Our aim is to combine the speed of automated inspection with the reliability of human judgment and transparent evidence.
What It Does
SureInspect evaluates each PCB and assigns one of four outcomes:
PASS: Boards that meet the system's acceptance criteria can be cleared automatically, with a target processing time of under 42 milliseconds.
FAIL: Boards with confirmed structural defects are flagged using evidence from both deep learning and structural analysis.
HUMAN: When the results are uncertain or different inspection methods disagree, the board is sent to a human inspector. The system provides visual evidence, including bounding boxes, reference-image overlays, and highlighted differences, to help the operator make a decision.
RETAKE: If the captured image has problems such as poor focus or unsuitable lighting, the system requests a new image rather than making a potentially unreliable inspection decision.
For traceability, each inspection also generates a cryptographic evidence record containing information such as anomaly heatmaps, image-alignment measurements, and structural difference metrics.
How We Built It
SureInspect follows a modular, layered design that combines computer vision, deep learning, statistical calibration, and human review. Each part has a specific responsibility, helping the system make decisions based on multiple sources of evidence rather than relying on a single model score.
Our focus is to make PCB inspection not only fast, but also transparent and practical for real manufacturing environments. By combining automated decisions with selective human intervention, SureInspect aims to reduce missed defects, avoid unnecessary production delays, and give operators clearer evidence for every inspection decision. How We Built SureInspect
- OpenCV 5 Deep Learning Engine
SureInspect uses OpenCV 5 and a pretrained WideResNet-50 model to identify unusual patterns in PCB images. Images can be as large as 25 megapixels, so we resize them to a maximum of 1024 pixels using cv2.INTER_AREA before processing.
The model runs through OpenCV's ONNX inference engine. It extracts features from different image regions and compares them with a memory bank of reference features from normal boards. These comparisons produce an anomaly score and a heatmap showing the areas that may contain defects.
- Statistical Calibration for Reliable Decisions
One of our main goals was to avoid relying on arbitrary confidence thresholds. To address this, we used split-conformal calibration with 99 clean calibration boards to establish decision boundaries.
The system uses two thresholds: a pass threshold of 2.0405 and a failure threshold of 2.2863. Boards with scores below the pass threshold can qualify for automatic clearance, while scores above the failure threshold are treated as potential defects. Boards falling between these thresholds receive additional verification.
The calibration is designed to support a target of at least 80% clearance of clean boards through the fast-pass route under the required statistical assumptions. This guarantee depends on the calibration and deployment data meeting the assumptions of the conformal method; it does not mean that every individual decision is guaranteed to be correct.
- OpenCV Tools for Additional Verification
When the model cannot make a confident decision, SureInspect uses additional computer vision techniques to examine the board more closely.
Reference alignment: ORB feature matching, RANSAC homography estimation, and ECC-based alignment help match the inspected board with a golden reference image.
Lighting correction: CLAHE is applied when changes in image brightness are detected, helping reduce the effect of uneven illumination.
Structural comparison: The system aligns the reference image with the inspected board and calculates residual measurements to highlight suspicious differences.
Defect measurement: Otsu thresholding and rotated bounding boxes help measure the size, shape, and elongation of suspected defects.
Together, these tools provide more information for difficult cases and help human inspectors understand why a board has been flagged.
- AWS Cloud Deployment
SureInspect is deployed on an AWS EC2 instance in the Sydney region (ap-southeast-2). The application is designed to provide remote access to the inspection dashboard and its inference capabilities.
Caddy acts as the reverse proxy, forwarding requests to the internal backend while applying request-size limits, rate-limiting controls, and client IP forwarding. The backend uses Python 3.11 and FastAPI, with an admission-control mechanism that allows one inference job to run at a time while up to four additional jobs wait in the queue.
To reduce resource pressure, the application also uses bounded caching and limits CPU thread usage. The frontend is built with React 18, Vite, and Tailwind CSS. It includes a live inspection queue, a side-by-side comparison with the golden reference image, and interactive anomaly heatmaps.
Benchmark Results
We evaluated SureInspect on 493 real images from the Amazon VisA PCB1 benchmark dataset. The following results compare our system with two baseline configurations.
Metric
Cautious baseline
Default baseline
SureInspect
Defect escape rate
5.71% (4/70)
27.14% (19/70)
5.71% (4/70)
Good boards incorrectly discarded
27% (27/100)
9% (9/100)
0% (0/100)
Good boards automatically cleared
73% (73/100)
91% (91/100)
82% (82/100)
Good boards sent for human review
0% (0/100)
0% (0/100)
18% (18/100)
Fast-pass latency
—
—
41.3 ms
The results show the trade-off SureInspect is designed to address. It achieved the same measured defect escape rate as the cautious baseline while reducing incorrect automatic rejection of good boards from 27% to zero in the reported sample. It also sent 18% of good boards for human review rather than forcing every uncertain case into an automatic decision.
These figures describe the evaluated samples and should not be interpreted as guarantees of performance on every production line.
Challenges We Faced and How We Addressed Them
Detecting very small defects
Tiny defects, such as a missing surface-mount capacitor or a thin scratch, can occupy only a small part of an image patch. As a result, averaging features across the patch can hide the defect's local structural differences.
To address this problem, we developed a region-of-interest measurement tool called ROI_ZOOM_MEASURE. It uses OpenCV contour extraction and rotated bounding boxes to examine suspicious regions more closely. When the measured shape or elongation suggests a possible defect, the system can send the board for human review instead of automatically clearing it.
Managing limited cloud resources
Running deep learning inference alongside high-resolution image alignment can consume significant CPU and memory resources, particularly on smaller cloud instances.
We introduced an asynchronous admission-control mechanism that limits the system to one active inference job and four queued jobs. We also added a bounded least-recently-used cache with a 200 MiB limit and restricted OpenMP CPU thread usage to reduce resource contention.
Making failures transparent
We believe an inspection system should clearly communicate its limitations rather than hide unsuccessful cases. Our project includes a model audit report documenting the reported defect escapes across the benchmark evaluation.
This makes it easier to review the system's weaknesses, understand its decisions, and identify areas that need further improvement.
Accomplishments We're Proud Of
Evaluation using real images: Our reported benchmark results were obtained from real VisA PCB1 images processed through the OpenCV DNN pipeline.
Reduced unnecessary rejection: SureInspect recorded zero incorrectly discarded good boards in the reported sample of 100, compared with 27 for the cautious baseline.
Cloud deployment: The application combines Docker, Caddy, FastAPI, and a React dashboard on AWS EC2.
Automated testing: The project reports 180 automated unit, integration, and security tests passing in its CI workflows.
What We Learned
Statistical calibration can make decisions more systematic. Rather than selecting thresholds through guesswork alone, conformal methods provide a principled framework for setting decision boundaries, provided their statistical assumptions are satisfied.
Combining AI with classical computer vision improves transparency. Deep learning helps identify unusual patterns, while alignment, structural comparison, and contour measurement provide additional evidence that operators can inspect. This combination makes the system better suited to workflows where uncertain decisions should receive human attention.
What's Next for SureInspect
We plan to extend the system in three main areas:
Learning from operator feedback: Use the inspection feedback endpoint, POST /api/inspections/{id}/feedback, to explore how confirmed operator decisions can improve the reference memory bank through a controlled and validated update process.
Multi-camera inspection: Support synchronized top-down and angled camera views to capture more information about components and solder joints.
Long-term evidence storage: Integrate Amazon S3 for private storage of audit records and high-resolution images, with lifecycle policies for long-term archival.
Our long-term vision is to make PCB inspection faster and more dependable without sacrificing human oversight, traceability, or transparency.
Built With
- automated-opticial-inspection
- aws-ec2
- caddy
- computer-vision
- deep-learning
- docker
- fastapi
- onnx
- opencv
- opencv5
- patchcore
- pcb-inspecction
- python
- quality-assuarance
- react
- rest-api
- tailwind-css
- typescript
- vite
Log in or sign up for Devpost to join the conversation.