niftynet.layer.crf module

class niftynet.layer.crf.CRFAsRNNLayer(alpha=5.0, beta=5.0, gamma=5.0, T=5, aspect_ratio=[1.0, 1.0, 1.0], name='crf_as_rnn')

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

layer_op(I, U)
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

niftynet.layer.crf.ftheta(U, H1, permutohedrals, mu, kernel_weights, aspect_ratio, name)
niftynet.layer.crf.gradientStub(data_vectors, barycentric, blurNeighbours1, blurNeighbours2, indices, name)
niftynet.layer.crf.permutohedral_compute(data_vectors, barycentric, blurNeighbours1, blurNeighbours2, indices, name, reverse)
niftynet.layer.crf.permutohedral_gen(permutohedral, data_vectors, name)
niftynet.layer.crf.permutohedral_prepare(position_vectors)
niftynet.layer.crf.py_func(func, inp, Tout, stateful=True, name=None, grad=None)