DE SpotNet: Direct Electron neural networks for diffraction spot detection and center refinement in 4D-STEM
Abstract
Trained weights for DE SpotNet, Direct Electron's neural-network diffraction-spot (Bragg disk) detector, and its two center-refinement networks, DE CenterNet and DE FriedelNet, for 4D-STEM and scanning precession electron diffraction. Used by SpyDE, pyxem and quantem. License: CC BY-NC 4.0. Commercial use (for example, analyzing your own data at a company) is permitted; the weights may not be redistributed in, or incorporated into, software or services that are sold. Pipeline. (1) DE SpotNet rescales each pattern so disks are ~9 px across (diameter from the autocorrelation), normalizes it, and predicts a peak heat map with a sub-pixel offset head. (2) DE CenterNet re-places each detected disk on the raw frame at native resolution: it segments the disk in a window and takes the coverage centroid, with a sigma head giving a positional uncertainty. (3) Optionally, DE FriedelNet also reads the window at each disk's Friedel mirror point, seeing both dynamical fills of g and -g. Each network is provided twice: as an .onnx graph (BatchNorm folded, dynamic batch/height/width, opset 17, with its configuration in the model metadata) for inference with ONNX Runtime and no torch dependency, and as a .pt checkpoint (load with torch.load(path, weights_only=True)) for training and fine-tuning. Detectors de_spotnet (default; base 8, 3 levels) — scale-robust all-rounder trained across disk sizes, with a sharpened offset head. de_spotnet_dynamical (base 8, 3 levels, mask head) — fine-tuned on multislice (dynamical) disks with counted and integrating detector noise, then self-trained on real 4D-STEM frames with persistence- and Friedel-verified labels. A disk-coverage head centers each disk on its predicted aperture. Halves the center error on dynamical disks and cuts false positives on sparse counted data; on real SPED Ag the in-grain strain speckle drops from 0.063 to 0.036 %. de_spotnet_production (base 16, 2 levels) — SRO-augmented, edge-decoupled detector; slightly higher crystal recall on canonical-size disks, weaker off its trained scale. de_spotnet_base16 (base 16, 2 levels) — earlier edge-trained detector, kept as a fallback. Center refiners de_centernet — the refine step (spot radius ≥ 5 px). On real GaN it lowers the Friedel error of the detector's centers from 1.13 to 0.84 px. de_friedelnet — the Friedel-partner step on top of DE CenterNet, two input channels (the disk and its 180°-rotated mirror window); trained on 6–16 px radius disks and leaves others unchanged.