(scores)
return scores
Transforms CxHxW of scores to probabilities spatially.
Transforms CxHxW of scores to probabilities spatially.
Transforms CxHxW of scores to probabilities spatially .
def scores_to_probs(scores):
    """Transforms CxHxW of scores to probabilities spatially."""
    channels = scores.shape[0]
    for c in range(channels):
        temp = scores[c, :, :]
        max_score = temp.max()
        temp = np.exp(temp - max_score) / np.sum(np.exp(temp - max_score))
        scores[c, :, :] = temp
    return scores
def scores_to_probs ( scores ) : channels = scores . shape [ 0 ] for c in range ( channels ) : temp = scores [ c , : , : ] max_score = temp . max ( ) temp = np . exp ( temp - max_score ) / np . sum ( np . exp ( temp - max_score ) ) scores [ c , : , : ] = temp return scores