INNER CODE UNIT · Python

sm

lucasb-eyer/pydensecrf · pydensecrf/utils.py:76

        sm = scale * sm + (1 - scale) * uniform
    if clip is not None:
        sm = np.clip(sm, clip, 1.0)
    return -np.log(sm).reshape([num_cls, -1]).astype(np.float32)


def softmax_to_unary(sm, GT_PROB=1):
    """Deprecated, use `unary_from_softmax` instead."""
    warning("pydensecrf.softmax_to_unary is deprecated, use unary_from_softmax instead.")
    scale = None if GT_PROB == 1 else GT_PROB
    return unary_from_softmax(sm, scale, clip=None)


def create_pairwise_gaussian(sdims, shape):
    """
    Util function that create pairwise gaussian potentials. This works for all
    image dimensions. For the 2D case does the same as
    `DenseCRF2D.addPairwiseGaussian`.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…