patchdist_fit — SPC anomaly_patch op

• 数据种类:video → table

• 调用: import fullseye as fs; fs.ledger.patchdist_fit(stack, patch=8, stride=4, scales=(1.0, 2.0, 4.0), groups=('gradient', 'gabor', 'lbp'), n_orient=4, shrinkage='auto', n_dims=None, seed=0, ridge=1e-06, pool='position')(要直接调用实现,import anomaly_patch; anomaly_patch.patchdist_fit(stack, patch=8, stride=4, scales=(1.0, 2.0, 4.0), groups=('gradient', 'gabor', 'lbp'), n_orient=4, shrinkage='auto', n_dims=None, seed=0, ridge=1e-06, pool='position');从台账取用则 opsspc.get("patchdist_fit"))

用法

从良品图像学习每个网格位置上图块特征的正态分布(声明收缩估计,协方差奇异则拒绝)(table)。

> 以下的详细说明为原文 —— 摘要与标题已翻译。

stack is (n, H, W) or (n, H, W, 3) of good images, n >= 2, registered well enough that a grid cell sees the same content. The feature is patch_features (same parameters). At every cell the mean and the covariance (maximum likelihood, divided by n) of the D-dimensional feature are estimated; n <= D makes the covariance singular, so the shrinkage toward tr(S)/D * I is declared: "auto" is the Ledoit–Wolf analytic intensity per position, a number in (0, 1] fixes it, "none" (or 0) is accepted only when n - 1 >= D and the covariance is positive definite and otherwise refused. n_dims keeps a seeded random subset of the D dimensions (the memory trick of the original method), ridge (relative to the median variance, applied unless shrinkage="none") is a numerical floor against exactly constant channels. pool="position" (default) estimates one distribution per grid cell, right when the content is registered; pool="global" estimates ONE distribution from the patches of all cells and images (n * gh * gw samples, overlapping patches are not independent), right for a stationary texture whose content at a cell differs from image to image and which has far more samples than dimensions.

Returns the model: per-position mean and precision (inverse of the shrunk covariance), shrinkage_map and its mean shrinkage_mean, n_train, dim, dims (kept channels), the feature parameters and image_shape. Pass it to patchdist_score.

Raises ValueError for fewer than two images, a singular covariance with shrinkage="none", a constant feature that stays singular, or invalid parameters.

参考(示例数据、文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

• 算法的正典(作者、年份)与用途见上面的族使用指南。

可运行的示例(实际调用该算子并已验证的样例)

• poc_patch_anomaly — py -3.11 examples/poc_patch_anomaly.py

类型可衔接的下一个算子(可接受 table 作为输入)

msa_anova_table · msa_gauge_rr · msa_bias_linearity · msa_attribute_agreement · gum_standard_uncertainty · gum_propagate · gum_expanded · gum_monte_carlo

同类别(anomaly_patch)

patch_features · patchdist_score · patchbank_fit · patchbank_score


*Provenance: anomaly_patch.py — SPC 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.