Skip to content

Latest commit

 

History

History
90 lines (64 loc) · 3.26 KB

CtcLossLayer.md

File metadata and controls

90 lines (64 loc) · 3.26 KB

CCtcLossLayer Class

This class implements a layer that calculates the loss function used for connectionist temporal classification (CTC).

Settings

Blank label for spaces

void SetBlankLabel( int blankLabel );

Sets the value of the "blank" label that will be used as the space between other labels.

Skipping blanks

void SetAllowBlankLabelSkips( bool enabled );

Sets the flag that allows skipping the blank labels when aligning.

Loss weight

void SetLossWeight( float lossWeight );

Sets the multiplier for this function gradient during training. The default value is 1. You may wish to change the default if you are using several loss functions in your network.

Gradient clipping

void SetMaxGradientValue( float maxValue );

Sets the upper limit for the absolute value of the function gradient. Whenever the gradient exceeds this limit its absolute value will be reduced to GetMaxGradientValue().

Trainable parameters

This layer has no trainable parameters.

Inputs

The layer may have two to five inputs:

  1. The first input accepts a blob with the network response, of the dimensions:
    • BatchLength is the maximum sequence length in the response
    • BatchWidth is the number of sequences in the set
    • ListSize is equal to 1
    • Height * Width * Depth * Channels is equal to the number of classes
  2. The second input accepts a blob with int data containing the correct labels, of the dimensions:
    • BatchLength is the maximum labels sequence length
    • BatchWidth is the number of sequences (should be equal to BatchWidth of the first input)
    • the other dimensions are equal to 1
  3. [Optional] The third input accepts a blob with int data containing the label sequences' lengths. If this input is not connected, the label sequences are considered to be the second input's BatchLength long. This input dimensions are:
    • BatchWidth equal to the first input BatchWidth
    • the other dimensions are equal to 1
  4. [Optional] The fourth input accepts a blob with int data that contains the network response sequences' lengths. If this input is not connected, the network response sequences are considered to be the first input's BatchLength long. This input dimensions are:
    • BatchWidth equal to the first input BatchWidth
    • the other dimensions are equal to 1
  5. [Optional] The fifth input accepts a blob with the sequences' weights, of the dimensions:
    • BatchWidth equal to the first input BatchWidth
    • the other dimensions are equal to 1

Outputs

This layer has no output.

Getting the value of the loss function

float GetLastLoss() const;

Use this method to get the value of the loss function calculated on the network's last run.