delta.data.seg_weights

delta.data.seg_weights(mask, classweights=(1, 1), w0=12, sigma=2)[source]

Compute the weight map as described in the original U-Net paper to force the model to learn borders.

(Slow, best to run this offline before training).

Parameters:
mask2D array

Training output segmentation mask.

classweightstuple of 2 int/floats

Weights to apply to background, foreground. The default is (1,1)

w0int or float, optional

Base weight to apply to smallest distance (1 pixel). The default is 12.

sigmaint or float, optional

Exponential decay rate to apply to distance weights. The default is 2.

Returns:
weightmap2D array

Weights map image.