niftynet.layer.crf module

permutohedral_prepare(position_vectors)[source]
permutohedral_compute(data_vectors, barycentric, blurNeighbours1, blurNeighbours2, indices, name, reverse)[source]
py_func(func, inp, Tout, stateful=True, name=None, grad=None)[source]
gradientStub(data_vectors, barycentric, blurNeighbours1, blurNeighbours2, indices, name)[source]
permutohedral_gen(permutohedral, data_vectors, name)[source]
ftheta(U, H1, permutohedrals, mu, kernel_weights, aspect_ratio, name)[source]
class CRFAsRNNLayer(alpha=5.0, beta=5.0, gamma=5.0, T=5, aspect_ratio=(1.0, 1.0, 1.0), name='crf_as_rnn')[source]

Bases: niftynet.layer.base_layer.TrainableLayer

This class defines a layer implementing CRFAsRNN described in [1] using a bilateral and a spatial kernel as in [2]. Essentially, this layer smooths its input based on a distance in a feature space comprising spatial and feature dimensions. [1] Zheng, Shuai, et al. “Conditional random names as recurrent neural networks.” CVPR 2015. [2] https://arxiv.org/pdf/1210.5644.pdf

__init__(alpha=5.0, beta=5.0, gamma=5.0, T=5, aspect_ratio=(1.0, 1.0, 1.0), name='crf_as_rnn')[source]

Parameters: alpha: bandwidth for spatial coordinates in bilateral kernel.

Higher values cause more spatial blurring
beta: bandwidth for feature coordinates in bilateral kernel
Higher values cause more feature blurring
gamma: bandwidth for spatial coordinates in spatial kernel
Higher values cause more spatial blurring

T: number of stacked layers in the RNN aspect_ratio: spacing of adjacent voxels (allows isotropic spatial smoothing when voxels are

not isotropic
layer_op(I, U)[source]
Parameters:
  • I – feature maps defining the non-spatial dimensions within which smoothing is performed For example, to smooth U within regions of similar intensity this would be the image intensity
  • U – activation maps to smooth