SparseCategoricalCrossentropyIgnore
SparseCategoricalCrossentropyIgnore class
dlf.losses.sparse_categorial_crossentropy_ignore.SparseCategoricalCrossentropyIgnore(
num_classes, name="sparse_categorical_crossentropy_ignore", from_logits=False
)
Implementation for sparse crossentropy loss with ignore label functionality.
The same implmentation like tf.keras.losses.SparseCategoricalCrossentropy but with the addtion that this implementation ignores all label ids <= num_classes.
Aliases
- SparseCategoricalCrossentropyIgnore
- sparse_categorical_crossentropy_ignore
Arguments
- num_classes: int. Number of classes, everthing above or equal will be ignored
- name: str, optonal, Name of the loss function. Defaults to 'sparse_categorical_crossentropy_ignore'.
- from_logits: bool. If true, y_pred is expected to be a logits tensor. Defaults to False.
Returns
A tf.keras.losses.Loss
YAML Configuration
loss:
SparseCategoricalCrossentropyIgnore:
num_classes: 7
from_logits: False