Softmax

MLModule

author

Hans Meine

package

FMEstable/ReleaseMeVis

dll

MLSoftmax

definition

MLSoftmax.def

keywords

one-hot, vector, RedLeaf

Purpose

Compute softmax along a channel dimension

Usage

It is possible to set a temperature other than 1 through which the logits should be divided. Larger temperatures lead to smoother value transitions, temperatures below 1.0 result in stronger binarization.

Details

The Softmax function converts a vector of K real numbers into a probability distribution of K possible outcomes (from https://en.wikipedia.org/wiki/Softmax_function). This module computes the softmax along a desired dimension of an mlimage. The total number of softmax computations is the accumulated number of elements in the other dimensions (shape.prod() / shape[dim]).

Standard Softmax may become numerically unstable because of large exponentiations. Subtract a value from the input volume, e.g. the largest value max(input) to keep exponentiaton <= 1.

Windows

Default Panel

../../../Projects/VoxelFeatures/MLSoftmax/Modules/mhelp/Images/Screenshots/Softmax._default.png

Input Fields

input0

name: input0, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Visible Fields

Temperature

name: temperature, type: Double, default: 1

scalar softmax temperature (higher temp = smoother transitions) - must be positive

Use Vector Scaling

name: useVectorScaling, type: Bool, default: FALSE

instead of scalar Temperature, use per-channel Temperatures

Temperatures

name: temperatures, type: String, default: 1 1

vector of temperatures for each channel (space-separated)

Class Dimension

name: classDimension, type: Enum, default: c

dimension over which to compute softmax

Values:

Title

Name

x

x

y

y

z

z

c

c

t

t

u

u