Skip to contents

Formula: transformer decoder; bipartite matching loss

Usage

Detrbb(image, queries, n_objects = NULL, targets = NULL)

Arguments

image

A Q x 4 matrix of predicted boxes (cx, cy, w, h).

queries

A G x 4 matrix of ground-truth boxes.

n_objects

Number of ground-truth objects, or NULL.

targets

Unused; kept for signature compatibility.

Value

List with estimate, assignment, cost, matched, unmatched, l1_cost, giou_cost, Q, G, method.

Details

Every query predicts one box, and the loss is defined only after a one-to-one assignment between predictions and ground truth found by the Hungarian algorithm on the pairwise cost. There is no non-maximum suppression and no anchor set: the matching is what removes the duplicates. Unmatched queries train to the no-object class.

References

Carion et al. (2020), End-to-End Object Detection with Transformers, ECCV 2020:213-229.

Examples

D <- data.frame(x = c(1, 2, 3, 4), y = c(2, 4, 5, 9))
Detrbb(D, D)
#> $estimate
#> [1] 0
#> 
#> $assignment
#> [1] 0 1
#> 
#> $cost
#> [1] 0
#> 
#> $matched
#> [1] 0 1
#> 
#> $unmatched
#> integer(0)
#> 
#> $l1_cost
#> [1] 0
#> 
#> $giou_cost
#> [1] 0
#> 
#> $Q
#> [1] 2
#> 
#> $G
#> [1] 2
#> 
#> $method
#> [1] "DETR set prediction with Hungarian matching"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"