Skip to the content
PCBKitNew board
2 layers120 × 100 mmPcb 596, 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
13
Nets
6
Pads
122
Tracks, vias
50, 0
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
13 Mar 2026
Updated
29 May 2026

Overview

Pcb 596 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 13 parts on 6 nets, routed with 50 tracks and 0 vias.

Its parts include 8 ICs, 4 capacitors and 1 resistor.

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

13
QtyValueFootprintReferences
5SOIC-8_3.9x4.9mm_P1.27mmSOIC-8_3.9x4.9mm_P1.27mmU1_0, U2_1, U2_3, U3_0, U3_1
3C_0603_1608MetricC_0603_1608MetricC1_1, C2_0, C4_1
2TQFP-32_7x7mm_P0.8mmTQFP-32_7x7mm_P0.8mmU1_2, U4_0
1C_Disc_D3.0mm_W1.6mm_P2.50mmC_Disc_D3.0mm_W1.6mm_P2.50mmC0_1
1DIP-8_W7.62mmDIP-8_W7.62mmU2_2
1R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR0_0

Questions

How big is the Pcb 596 PCB?

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

What parts does the Pcb 596 use?

13 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 596 KiCad files?

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

Can I use the Pcb 596 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).

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 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
  • 2 layers120 × 100 mmPcb 210, the printed circuit board in 3D

    Pcb 210

    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 layers40 × 20 mmUsb uart, the printed circuit board in 3D

    Usb uart

    earthtojake/text-to-cad

    Design physical products with AI

    13 parts26kMIT
  • 2 layers35 × 29 mmMagSpoofTC, the printed circuit board in 3D

    MagSpoofTC

    samyk/magspoof

    A portable device that can spoof/emulate any magnetic stripe, credit card or hotel card "wirelessly", even on standard magstripe (non-NFC/RFID) readers.

    13 parts4.2k
  • 2 layers20.6 × 23.6 mmAO-03 signal amplifier, the printed circuit board in 3D

    AO-03 signal amplifier

    fossasia/pslab-scripts

    Pocket Science Lab - Scripts for Sensor Experiments

    13 parts1.6kApache-2.0
  • 2 layers47 × 35.6 mmMX7-C-35PL C11, the printed circuit board in 3D

    MX7-C-35PL C11

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    13 parts1.2k
  • 2 layers95 × 95 mmCube batteryboard, the printed circuit board in 3D

    Cube batteryboard

    willem-pennings/balancing-cube

    A cube that balances itself in a corner or edge using reaction wheels

    13 parts1.1kGPL-3.0
  • 2 layers15.2 × 20.3 mmPt100stick, the printed circuit board in 3D

    Pt100stick

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    13 parts1.1kGPL-3.0
  • 2 layers53.9 × 23.2 mmBuffer, the printed circuit board in 3D

    Buffer

    hoglet67/RGBtoHDMI

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

    13 parts1kGPL-3.0