INNER CODE UNIT · Python

compute_unary

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

def compute_unary(labels, M, GT_PROB=0.5):
    """Deprecated, use `unary_from_labels` instead."""
    warning("pydensecrf.compute_unary is deprecated, use unary_from_labels instead.")
    return unary_from_labels(labels, M, GT_PROB)


def unary_from_softmax(sm, scale=None, clip=1e-5):
    """Converts softmax class-probabilities to unary potentials (NLL per node).

    Parameters
    ----------
    sm: numpy.array
        Output of a softmax where the first dimension is the classes,
        all others will be flattend. This means `sm.shape[0] == n_classes`.
    scale: float
        The certainty of the softmax output (default is None).
        If not None, the softmax outputs are scaled to range from uniform
        probability for 0 outputs to `scale` probability for 1 outputs.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…