das.loss#
- class das.loss.TMSE(batch_size, trunc=None)[source]#
Initializes
Loss
class.- Parameters
reduction –
Type of
tf.keras.losses.Reduction
to apply to loss. Default value isAUTO
.AUTO
indicates that the reduction option will be determined by the usage context. For almost all cases this defaults toSUM_OVER_BATCH_SIZE
. When used withtf.distribute.Strategy
, outside of built-in training loops such astf.keras
compile
andfit
, usingAUTO
orSUM_OVER_BATCH_SIZE
will raise an error. Please see this custom training [tutorial](- https://www.tensorflow.org/tutorials/distribute/custom_training) for
more details.
name – Optional name for the instance.
- call(y_true, y_pred)[source]#
Temporal MSE Loss
Temporal MSE Loss Function Proposed in Y. A. Farha et al. MS-TCN: Multi-Stage Temporal Convolutional Network for ActionSegmentation in CVPR2019 arXiv: https://arxiv.org/pdf/1903.01945.pdf
- Parameters
y_true (_type_) – _description_
y_pred (_type_) – _description_
trunc (_type_, optional) – _description_. Defaults to None.
- Returns
_description_
- Return type
_type_
- class das.loss.WeightedLoss(losses, loss_weights)[source]#
Initializes
Loss
class.- Parameters
reduction –
Type of
tf.keras.losses.Reduction
to apply to loss. Default value isAUTO
.AUTO
indicates that the reduction option will be determined by the usage context. For almost all cases this defaults toSUM_OVER_BATCH_SIZE
. When used withtf.distribute.Strategy
, outside of built-in training loops such astf.keras
compile
andfit
, usingAUTO
orSUM_OVER_BATCH_SIZE
will raise an error. Please see this custom training [tutorial](- https://www.tensorflow.org/tutorials/distribute/custom_training) for
more details.
name – Optional name for the instance.
- call(y_true, y_pred)[source]#
Invokes the
Loss
instance.- Parameters
y_true – Ground truth values. shape =
[batch_size, d0, .. dN]
, except sparse loss functions such as sparse categorical crossentropy where shape =[batch_size, d0, .. dN-1]
y_pred – The predicted values. shape =
[batch_size, d0, .. dN]
- Returns
Loss values with the shape
[batch_size, d0, .. dN-1]
.