high-precision Real-Time PCB Defect Detection System
A high-performance computer vision pipeline for high-speed Printed Circuit Board (PCB) quality control.
Powered by a custom-trained YOLOv11s model, a FastAPI WebSocket backend, and a React 19 industrial dashboard.
Delivering real-time defect detection at 80+ FPS on NVIDIA Blackwell hardware.
| Feature | Description |
|---|---|
| π₯ Live Sensor Feed | Real-time webcam streaming with zero-latency YOLO bounding box overlays |
| π Static Analysis Mode | Upload any PCB image β get back a fully annotated result from the model |
| β‘ TensorRT Acceleration | GPU-compiled .engine file for maximum Blackwell SM 12.0 throughput |
| π Real-Time Anomaly Log | Live defect feed with timestamps, auto-scrolling, and persistent session history |
| π PDF Report Generation | One-click official inspection reports with timestamped anomaly timelog |
| π¨ Industrial Themes | Four dark-mode color profiles: Carbon Β· Cobalt Β· Emerald Β· Crimson |
| π Full-Duplex WebSockets | Zero-copy frame streaming between the AI engine and the React dashboard |
| π±οΈ One-Click Deployment | Single .bat launch β backend + frontend + browser open, fully automated |
| π¦ One-Click Install/Uninstall | Save ~8 GB of disk space when not in use; restore the full stack in minutes |
| Metric | Value |
|---|---|
| Model Architecture | YOLOv11s (Small) |
| Training Dataset | DeepPCB v5 Β· 3,000+ Annotated Images Β· CC BY 4.0 |
| mAP50 | 97.8% |
| Inference Backend | NVIDIA TensorRT (.engine) |
| Inference Latency | ~10β13 ms / frame |
| Live Throughput | 80+ FPS |
| Target GPU | NVIDIA RTX 5060 (Blackwell SM 12.0) |
The system is split into three fully asynchronous layers communicating over WebSockets:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FACE β Vite + React 19 (localhost:5173) β
β Industrial dark-mode dashboard β
β Live feed Β· Anomaly log Β· Theme switcher Β· PDF export β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β ws://127.0.0.1:8000/ws
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β HEART β FastAPI (127.0.0.1:8000) β
β /ws β Frontend WebSocket (broadcaster) β
β /ws_internal β Internal AI pipe (receiver) β
β POST /analyze β Static image analysis endpoint β
β GET /health β Liveness + model status check β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β ws://127.0.0.1:8000/ws_internal
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β BRAIN β AI Inference Engine (multiprocessing.Process) β
β DirectShow webcam capture β YOLO11s TensorRT β
β Annotated JPEG (Base64) β JSON {image, defects[]} β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Trained to detect 6 PCB defect categories from the DeepPCB dataset:
| Class | Description |
|---|---|
copper |
Excess or missing copper on the PCB surface |
mousebite |
Partial break along the edge of the board |
open |
Broken trace causing an open circuit |
pin-hole |
Pinhole void drilled through the copper layer |
short |
Unintended conductive connection between traces |
spur |
Spurious copper protrusion from a trace |
| Requirement | Minimum Version |
|---|---|
| OS | Windows 10 / 11 |
| Python | 3.13+ |
| Node.js | v18+ |
| GPU | NVIDIA RTX (Blackwell recommended) |
| CUDA Toolkit | 12.8+ |
git clone https://github.com/Ares19v/Inspection-Engine.git
cd "Inspection Engine"Double-click INSTALL.bat (or run from a terminal):
.\INSTALL.batThis automatically:
- Creates a Python
venv - Installs PyTorch Nightly with CUDA 12.8 (Blackwell SM 12.0 support)
- Installs all backend dependencies from
backend/requirements.txt - Installs all frontend packages via
npm install
Disk usage: ~7β10 GB Β· Time: ~5β15 min depending on internet speed
Double-click Run_Inspection_Engine.bat:
.\Run_Inspection_Engine.batThe full stack starts automatically and your browser opens to http://localhost:5173.
When you don't need the project running, free up ~8 GB instantly:
.\UNINSTALL.batThis removes venv/ and frontend/node_modules/ β your code, model weights, and configs are completely safe.
Run INSTALL.bat again to restore the full environment in minutes.
| Endpoint | Direction | Payload |
|---|---|---|
ws://127.0.0.1:8000/ws |
Server β Client | { image: string (base64 JPEG), defects: string[] } |
ws://127.0.0.1:8000/ws_internal |
AI Engine β Server | Same as above (internal pipe) |
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Liveness check + model file status |
POST |
/analyze |
Static PCB image analysis |
{
"status": "ok",
"model_dir": "...\\runs\\detect\\inspection_engine_final3\\weights",
"engine_ready": true,
"pt_ready": true
}multipart/form-data with field file (JPEG or PNG image of a PCB)
{
"image": "<base64-encoded annotated JPEG>",
"defects": ["open", "short"]
}# Activate the virtual environment
.\venv\Scripts\activate
# Run batch inference on 25 random validation images
python test_model.pySample output:
============================================================
IMAGE NAME | DEFECT | CONFIDENCE
------------------------------------------------------------
00041003_test.jpg | open | 94.21%
00041015_test.jpg | CLEAN | N/A
00041028_test.jpg | short | 89.47%
00041044_test.jpg | mousebite | 96.83%
============================================================
TEST COMPLETE: Processed 25 images.
The full training pipeline is included in model_training/:
.\venv\Scripts\activate
cd model_training
python train.pyThis downloads the DeepPCB v5 dataset from Roboflow and fine-tunes yolo11s.pt for 50 epochs with early stopping. Results are saved to runs/detect/.
The .engine file is machine-specific (compiled for your exact GPU) and is not included in this repository. After training, export it from the .pt weights:
from ultralytics import YOLO
model = YOLO("runs/detect/inspection_engine_final3/weights/best.pt")
model.export(format="engine", device=0)The backend automatically falls back to the
.ptfile if no.engineis present β no extra configuration needed.
Inspection Engine/
β
βββ π backend/
β βββ requirements.txt # Pinned Python dependencies
β βββ π app/
β βββ main.py # FastAPI server, WebSocket routing, AI spawn
β βββ config.py # Centralized config (ports, paths, thresholds)
β βββ π api/ # Route handlers (extensible)
β βββ π services/ # Business logic layer (extensible)
β
βββ π frontend/
β βββ π src/
β βββ App.jsx # Full React 19 industrial dashboard
β
βββ π model_training/
β βββ train.py # YOLO fine-tuning script (Roboflow + GPU)
β βββ download_data.py # Dataset download helper
β
βββ π runs/detect/
β βββ inspection_engine_final3/
β βββ weights/
β βββ best.pt # β
Trained PyTorch weights (in repo)
β βββ best.engine # β‘ TensorRT engine (gitignored, generate locally)
β
βββ test_model.py # Batch validation CLI
β
βββ INSTALL.bat # β¬οΈ One-click full installation
βββ UNINSTALL.bat # ποΈ One-click dependency cleanup
βββ Run_Inspection_Engine.bat # π One-click launcher (full stack)
β
βββ LICENSE
βββ README.md
- Real-time live webcam inference
- Static image upload + analysis
- TensorRT acceleration (Blackwell SM 12.0)
- WebSocket full-duplex streaming
- PDF inspection report generation
- Multi-theme industrial dashboard
- One-click install / uninstall
- Multi-camera channel switching
- Historical analytics with trend graphs
- Docker containerization
- REST API for programmatic batch submission
- ONNX export for cross-platform deployment
The trained model is available on Hugging Face: devanshty/Inspection-Engine
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(repo_id='devanshty/Inspection-Engine', filename='best.pt')Β© 2026 Devansh Tyagi (Ares19v). All Rights Reserved.