Package ai.djl.training.loss
Class SingleShotDetectionLoss
java.lang.Object
ai.djl.training.evaluator.Evaluator
ai.djl.training.loss.Loss
ai.djl.training.loss.AbstractCompositeLoss
ai.djl.training.loss.SingleShotDetectionLoss
SingleShotDetectionLoss is an implementation of Loss. It is used to compute the
loss while training a Single Shot Detection (SSD) model for object detection. It involves
computing the targets given the generated anchors, labels and predictions, and then computing the
sum of class predictions and bounding box predictions.-
Field Summary
Fields inherited from class ai.djl.training.loss.AbstractCompositeLoss
componentsFields inherited from class ai.djl.training.evaluator.Evaluator
totalInstances -
Constructor Summary
ConstructorsConstructorDescriptionBase class for metric with abstract update methods. -
Method Summary
Modifier and TypeMethodDescriptioninputForComponent(int componentIndex, NDList labels, NDList predictions) Calculate loss between label and prediction.Methods inherited from class ai.djl.training.loss.AbstractCompositeLoss
addAccumulator, evaluate, getAccumulator, getComponents, resetAccumulator, updateAccumulatorsMethods inherited from class ai.djl.training.loss.Loss
elasticNetWeightedDecay, elasticNetWeightedDecay, elasticNetWeightedDecay, elasticNetWeightedDecay, hingeLoss, hingeLoss, hingeLoss, l1Loss, l1Loss, l1Loss, l1WeightedDecay, l1WeightedDecay, l1WeightedDecay, l2Loss, l2Loss, l2Loss, l2WeightedDecay, l2WeightedDecay, l2WeightedDecay, maskedSoftmaxCrossEntropyLoss, maskedSoftmaxCrossEntropyLoss, maskedSoftmaxCrossEntropyLoss, quantileL1Loss, quantileL1Loss, sigmoidBinaryCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, softmaxCrossEntropyLoss, softmaxCrossEntropyLoss, softmaxCrossEntropyLoss, updateAccumulatorMethods inherited from class ai.djl.training.evaluator.Evaluator
checkLabelShapes, checkLabelShapes, getName
-
Constructor Details
-
SingleShotDetectionLoss
public SingleShotDetectionLoss()Base class for metric with abstract update methods.
-
-
Method Details
-
inputForComponent
protected ai.djl.util.Pair<NDList,NDList> inputForComponent(int componentIndex, NDList labels, NDList predictions) Calculate loss between label and prediction.- Specified by:
inputForComponentin classAbstractCompositeLoss- Parameters:
labels- target labels. Must contain (offsetLabels, masks, classlabels). This is returned by MultiBoxTarget functionpredictions- predicted labels (class prediction, offset prediction)componentIndex- the index of the component loss- Returns:
- loss value
-