detrium.nn.losses.rtv4_criterion

RT-DETRv4: Painlessly Furthering Real-Time Object Detection with Vision Foundation Models Copyright (c) 2025 The RT-DETRv4 Authors. All Rights Reserved. --------------------------------------------------------------------------------- Modified from DEIM: DETR with Improved Matching for Fast Convergence Copyright (c) 2024 The DEIM Authors. All Rights Reserved.

class RTv4Criterion(nn.Module)

This class computes the loss for RT-DETRv4.

名称类型默认值
matcher——
weight_dict——
losses——
alpha—0.2
gamma—2.0
num_classes—80
reg_max—32
boxes_weight_format—None
share_matched_indices—False
mal_alpha—None
use_uni_set—True
distill_adaptive_params—None
dn_losses—None
loss_boxes(self, outputs, targets, indices, num_boxes, boxes_weight=None)

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.

名称类型默认值
outputs——
targets——
indices——
num_boxes——
boxes_weight—None
loss_local(self, outputs, targets, indices, num_boxes, T=5)

Compute Fine-Grained Localization (FGL) Loss and Decoupled Distillation Focal (DDF) Loss.

名称类型默认值
outputs——
targets——
indices——
num_boxes——
T—5
get_loss(self, loss, outputs, targets, indices, num_boxes, **kwargs)
名称类型默认值
loss——
outputs——
targets——
indices——
num_boxes——
kwargs——
forward(self, outputs, targets, **kwargs)

This performs 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

名称类型默认值
outputs——
targets——
kwargs——