Found, missed and invented objects

Description

overlay_agreement() answers the same three-way question about pixels, and on an instance result that is the wrong unit: a merged pair and a split object are both nearly perfect pixelwise and both wrong, which is exactly what an average precision will not tell anybody. This matches whole objects at one IoU threshold, the way the metric matches them, so the picture cannot disagree with the number it illustrates.

Usage

overlay_instance_agreement(
  image,
  prediction,
  truth,
  threshold = 0.5,
  alpha = drawing_style()\$overlay_alpha,
  colours = drawing_style()\$agreement_colours
)

Arguments

image One image, as overlay_instances() takes it.
prediction An instance label map from a model.
truth An instance label map from the annotation.
threshold The IoU above which a predicted object counts as a true one, strictly greater. 0.5 is the loosest of the challenge’s ten thresholds, so it is the kindest reading, and below 0.5 is refused for the reason the metric refuses it: there one prediction can satisfy two true objects and the match stops being one to one.
alpha How much of the tint shows.
colours Named hit, missed and false_alarm, as overlay_agreement() takes them.

Value

A height x width x 3 array of integers, 0-255.

See Also

overlay_instances() for the objects themselves.

Examples

library("rplatypus")

image <- array(0.5, dim = c(5, 11, 3))
truth <- matrix(0L, nrow = 5, ncol = 11)
truth[2:4, 2:4] <- 1L
truth[2:4, 6:8] <- 2L
predicted <- matrix(0L, nrow = 5, ncol = 11)
predicted[2:4, 2:4] <- 1L    # one found
predicted[2:4, 9:11] <- 2L   # one invented, and object 2 missed
shown <- overlay_instance_agreement(image, predicted, truth)
# Three different colours: hit, missed, invented.
nrow(unique(rbind(shown[3, 2, ], shown[3, 6, ], shown[3, 10, ])))
[1] 3