Skip to the content
2 layers120 × 100 mmPcb 292, the printed circuit board in 3D

This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

Size
120 × 100 mm
Copper layers
2
Thickness
1.6 mm
Parts
7
Nets
6
Pads
26
Tracks, vias
32, 0
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
13 Mar 2026
Updated
29 May 2026

Overview

Pcb 292 is an open-source printed circuit board by simone-ingvild, from the simone-ingvild/AnomalyDetection repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 120 × 100 mm with 7 parts on 6 nets, routed with 32 tracks and 0 vias.

Its parts include 3 resistors, 2 capacitors and 2 ICs.

README

README.md

PCB Anomaly Detection (Spatial PaDiM with Photometric Inputs)

Authors: Rikke Aa. Boysen, Simone I. Lebech, Andreas S. From
Supervisor: Jakob Wilm
Course: Semester Project (Advanced Robotics) Programme: M.Sc. in Advanced Robot Technology
Institution: University of Southern Denmark (SDU)
Semester: 2nd Semester, M.Sc. in Advanced Robot Technology, Spring 2026

This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks. The framework supports synthetic photometric datasets with 24 fixed illumination directions by default and provides tools for dataset generation, model training, experimentation, and evaluation.

Key Features

  • Inputs consist of grayscale photometric image stacks (24 illumination directions by default, resulting in 24 input channels). Binary illumination masks are not included in the input representation.
  • Anomaly detection is based on a Spatial PaDiM approach. A modified ResNet-18 feature extractor processes multi-channel inputs, feature embeddings are collected at each spatial location, and a Gaussian distribution with Ledoit-Wolf covariance regularization is fitted per spatial position.
  • Evaluation is performed using spatial Mahalanobis distances with top-k aggregation to produce PCB-level anomaly scores and corresponding ROC/AUC metrics.

Repository Status

This README reflects the current implementation. Model training is performed through src/train.py or src/run_experiment.py, dataset generation through src/experiment.py, and evaluation through src/evaluate.py.


Installation

  1. Clone the repository.
  2. Install the required dependencies:
bash
pip install -r requirements.txt

Note: The project was developed using recent Python and PyTorch versions. Ensure that the installed PyTorch build is compatible with your CUDA version or CPU environment.


Dataset Structure

The dataset should be organized as follows:

text
dataset/
├── normal/
│   ├── pcb001/
│   │   ├── image01.png
│   │   ├── ...
│   │   └── image24.png
│   └── ...
└── anomaly/
    ├── pcb101/
    │   ├── image01.png
    │   ├── ...
    │   └── image24.png
    └── ...

Each PCB sample is stored in a separate folder containing 24 grayscale images, one for each illumination direction. By default, image files are expected to follow the naming convention image01.png through image24.png (see src/dataset.py and src/experiment.py).


Synthetic Dataset Generation

The synthetic data generator creates photometric image stacks using the illumination directions specified in src/blenderproc/lights_export.csv.

bash
python src/experiment.py --num_normal 50 --num_anomaly 50

This command generates the dataset/normal/ and dataset/anomaly/ directories along with the corresponding PCB samples.


Model Training

Single Configuration

To train a model using the default configuration:

bash
python src/train.py

The script invokes src.anomaly_model.train() using a predefined configuration suitable for quick experimentation.

Experiment Sweeps

For systematic parameter studies, use:

bash
python src/run_experiment.py

This script executes multiple PaDiM configurations by varying parameters such as feature_dim, topk_ratio, and use_patches. Results are written to the experiment_logs/ directory.


Model Evaluation

Trained models can be evaluated using:

bash
python src/evaluate.py --model_path "src/Training output/padim_model.pth" --save_heatmaps

Evaluation outputs, including CSV files, performance plots, and anomaly heatmaps, are saved to the training output directory specified by TRAINING_OUTPUT_DIR (src/Training output by default).


Repository Overview

src/dataset.py

Implements the PCBAnomalyDataset class responsible for loading photometric image stacks. Optional preprocessing steps include CLAHE enhancement and patch extraction.

src/experiment.py

Contains the synthetic PCB generation pipeline, including surface generation and photometric rendering through render_photometric_images().

src/anomaly_model.py

Implements the modified ResNet-18 feature extractor, Spatial PaDiM training (manual_padim_train), and inference (manual_padim_predict). Trained models are stored as padim_model.pth within the experiment output directory.

src/run_experiment.py

Provides automated execution of multiple experimental configurations and records results in the experiment_logs/ directory.

src/evaluate.py

Loads trained checkpoints and computes evaluation metrics such as ROC and Precision–Recall curves while generating qualitative visualizations.


Limitations

  • Inputs consist of multi-channel grayscale photometric image stacks (24 channels by default). Binary illumination masks are not incorporated into the input representation.
  • The framework implements Spatial PaDiM using Gaussian feature distributions and Mahalanobis distance-based anomaly scoring. Reconstruction-based methods such as autoencoders are not included.
  • Some evaluation routines assume that backbone parameters are available in the saved checkpoint. When using custom checkpoints, verify compatibility between src/anomaly_model.py and src/evaluate.py.

Dependencies

The required packages are listed in requirements.txt.

Core dependencies include:

  • PyTorch (torch)
  • TorchVision (torchvision)
  • NumPy (numpy)
  • Pandas (pandas)
  • Matplotlib (matplotlib)
  • Scikit-learn (scikit-learn)

Parts

7
QtyValueFootprintReferences
2DIP-8_W7.62mmDIP-8_W7.62mmU0_0, U1_1
2R_0603_1608MetricR_0603_1608MetricR0_1, R2_0
1C_0603_1608MetricC_0603_1608MetricC1_0
1C_Disc_D3.0mm_W1.6mm_P2.50mmC_Disc_D3.0mm_W1.6mm_P2.50mmC2_1
1R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR2_2

More from simone-ingvild/AnomalyDetection

12
  • 2 layers120 × 100 mmPcb 472, the printed circuit board in 3D

    Pcb 472

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    14 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 500, the printed circuit board in 3D

    Pcb 500

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    14 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 596, the printed circuit board in 3D

    Pcb 596

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    13 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 107, the printed circuit board in 3D

    Pcb 107

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    12 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 176, the printed circuit board in 3D

    Pcb 176

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    12 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 019, the printed circuit board in 3D

    Pcb 019

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    11 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 236, the printed circuit board in 3D

    Pcb 236

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    11 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 044, the printed circuit board in 3D

    Pcb 044

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    10 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 348, the printed circuit board in 3D

    Pcb 348

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    10 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 516, the printed circuit board in 3D

    Pcb 516

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    10 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 006, the printed circuit board in 3D

    Pcb 006

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    9 partsGPL-3.0
  • 2 layers120 × 100 mmPcb 128, the printed circuit board in 3D

    Pcb 128

    simone-ingvild/AnomalyDetection

    This repository implements Spatial PaDiM (Patch Distribution Modeling) for anomaly detection on printed circuit boards (PCBs) using photometric (multi-illumination) image stacks.

    9 partsGPL-3.0

Similar boards

  • 2 layersEncoder, the printed circuit board in 3D

    Encoder

    byrantech/laptop

    anyon_e, a highly integrated, high end, open source laptop. Attempt the impossible.

    7 parts4.3kMIT
  • 2 layers40 × 20 mmSensor smd, the printed circuit board in 3D

    Sensor smd

    scottbez1/splitflap

    DIY split-flap display

    7 parts4.2k
  • 2 layers19.8 × 30 mmZ limit, the printed circuit board in 3D

    Z limit

    opulo-inc/lumenpnp

    The LumenPnP is an open source pick and place machine.

    7 parts3.7k
  • 2 layers35.6 × 58.2 mmDisplay Carrier, the printed circuit board in 3D

    Display Carrier

    AxxAxx/AxxSolder

    STM32 Based soldering station for JBC cartridges, 9-24 VDC and USB-PD power

    7 parts1.7kGPL-3.0
  • 2 layers20.3 × 16.3 mmMap MPX, the printed circuit board in 3D

    Map MPX

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    7 parts1.2k
  • 2 layers26 × 44 mmCompact carrier board, the printed circuit board in 3D

    Compact carrier board

    jamro/tiny-engineer

    A small desktop robot that brings an AI coding assistant to life, physically acting out when it reads files, thinks, writes code, and finishes work.

    7 parts1.1k
  • 2 layers26.4 × 53.8 mmAtari pickup, the printed circuit board in 3D

    Atari pickup

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    7 parts1kGPL-3.0
  • 2 layersRj45 breakout, the printed circuit board in 3D

    Rj45 breakout

    rene-dev/stmbl

    AC Servo Driver for STM32F4

    7 parts990GPL-3.0

Questions

How big is the Pcb 292 PCB?

It measures 120 × 100 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Pcb 292 use?

7 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Pcb 292 KiCad files?

From the simone-ingvild/AnomalyDetection repository on GitHub, at the commit this page was made from: the board is KiCad/PCB/pcb_292.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Pcb 292 design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).