discopat.nn_training.detr.criterion
DETR criterion class.
Functions
|
Compute the precision@k for the specified values of k. |
Classes
|
Compute the loss for DETR. |
- class discopat.nn_training.detr.criterion.SetCriterion(num_classes, matcher, weight_dict, eos_coef, losses)[source]
Bases:
ModuleCompute the loss for DETR.
- The process happens in two steps:
we compute hungarian assignment between ground truth boxes and the outputs of the model
we supervise each pair of matched ground-truth / prediction (supervise class and box)
- forward(outputs, targets)[source]
Perform the loss computation.
- Parameters:
outputs (dict of tensors, see the output specification of the model for the format)
targets (list of dicts, such that len(targets) == batch_size.) – The expected keys in each dict depends on the losses applied, see each loss’ doc
- loss_boxes(outputs, targets, indices, num_boxes)[source]
Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss.
targets dicts must contain the key “boxes” containing a tensor of dim [nb_target_boxes, 4] The target boxes are expected in format (center_x, center_y, w, h), normalized by the image size.