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

Overview

Pcb 552 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 9 parts on 5 nets, routed with 18 tracks and 0 vias.

Its parts include 5 resistors, 3 capacitors and 1 connector.

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

9
QtyValueFootprintReferences
5R_0603_1608MetricR_0603_1608MetricR0_0, R0_1, R0_2, R1_0, R1_1
3C_Disc_D3.0mm_W1.6mm_P2.50mmC_Disc_D3.0mm_W1.6mm_P2.50mmC0_3, C2_0, C2_1
1PinHeader_1x03_P2.54mm_VerticalPinHeader_1x03_P2.54mm_VerticalJ1_2

Questions

How big is the Pcb 552 PCB?

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

What parts does the Pcb 552 use?

9 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 552 KiCad files?

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

Can I use the Pcb 552 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 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 layers103 × 30.5 mmTS Back Endcap, the printed circuit board in 3D

    TS Back Endcap

    EEVengers/ThunderScope

    ThunderScope GitHub Repo

    9 parts1.3kMIT
  • 2 layers31.8 × 47.6 mmNGC 38 connector, the printed circuit board in 3D

    NGC 38 connector

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    9 parts1.2k
  • 2 layers24 × 27.3 mmExpansion Card Retrofit, the printed circuit board in 3D

    Expansion Card Retrofit

    FrameworkComputer/ExpansionCards

    Reference designs and documentation to create Expansion Cards for the Framework Laptop

    9 parts1.1kCC-BY-4.0
  • 2 layers15.6 × 17.3 mmSKR Mini TFT Thermistor Board, the printed circuit board in 3D

    SKR Mini TFT Thermistor Board

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    9 parts1.1kGPL-3.0
  • 2 layers39.1 × 49.5 mmLearnoliver, the printed circuit board in 3D

    Learnoliver

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    9 parts915
  • 2 layers17.4 × 16.9 mmToolhead, the printed circuit board in 3D

    Toolhead

    tanaes/whopping_Voron_mods

    9 parts787GPL-3.0
  • 2 layers9.8 × 108 mmExpander, the printed circuit board in 3D

    Expander

    wntrblm/Castor_and_Pollux

    A Juno-inspired dual oscillator

    9 parts587
  • 2 layersKeyboard after, the printed circuit board in 3D

    Keyboard after

    adamws/kicad-kbplacer

    KiCad plugin for automatic keyboard's key placement and routing

    9 parts547GPL-3.0