napari_cellseg3d.code_models.crf#

Implements the CRF post-processing step for WNet3D.

The CRF requires the following parameters:

  • images : Array of shape (N, C, H, W, D) containing the input images.

  • predictions: Array of shape (N, K, H, W, D) containing the predicted class probabilities for each pixel.

  • sa: alpha standard deviation, the scale of the spatial part of the appearance/bilateral kernel.

  • sb: beta standard deviation, the scale of the color part of the appearance/bilateral kernel.

  • sg: gamma standard deviation, the scale of the smoothness/gaussian kernel.

  • w1: weight of the appearance/bilateral kernel.

  • w2: weight of the smoothness/gaussian kernel.

Inspired by https://arxiv.org/abs/1606.00915 and https://arxiv.org/abs/1711.08506. Also uses research from: Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials Philipp Krähenbühl and Vladlen Koltun NIPS 2011

Implemented using the pydensecrf library available at lucasb-eyer/pydensecrf. However, this is not maintained, thus we maintain this pacakge at AdaptiveMotorControlLab/pydensecrf.

Functions

correct_shape_for_crf(image[, desired_dims])

Corrects the shape of the image to be compatible with the CRF post-processing step.

crf(image, prob, sa, sb, sg, w1, w2[, n_iter])

Implements the CRF post-processing step for the WNet3D.

crf_batch(images, probs, sa, sb, sg, w1, w2)

CRF post-processing step for the WNet3D, applied to a batch of images.

crf_with_config(image, prob[, config, log])

Implements the CRF post-processing step for the WNet3D.

Classes

CRFWorker(images_list, labels_list[, ...])

Worker for the CRF post-processing step for the WNet3D.