das.loss#
- class das.loss.TMSE(batch_size, trunc=None)[source]#
Initializes
Lossclass.- Parameters
reduction – Type of
tf.keras.losses.Reductionto apply to loss. Default value isAUTO.AUTOindicates that the reduction option will be determined by the usage context. For almost all cases this defaults toSUM_OVER_BATCH_SIZE. When used under atf.distribute.Strategy, except viaModel.compile()andModel.fit(), usingAUTOorSUM_OVER_BATCH_SIZEwill 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
Lossclass.- Parameters
reduction – Type of
tf.keras.losses.Reductionto apply to loss. Default value isAUTO.AUTOindicates that the reduction option will be determined by the usage context. For almost all cases this defaults toSUM_OVER_BATCH_SIZE. When used under atf.distribute.Strategy, except viaModel.compile()andModel.fit(), usingAUTOorSUM_OVER_BATCH_SIZEwill 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
Lossinstance.- 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].