Skip to contents

lam_coord (xy + sqrt-wh) + obj + lam_noobj noobj + class, every term but objectness masked to the cells that contain an object.

Usage

morie_geron_yolo_grid_loss(
  predictions,
  targets,
  lam_coord = 5,
  lam_noobj = 0.5
)

Arguments

predictions, targets

(S, S, 5 + C) arrays: x, y, w, h, conf, then class scores.

lam_coord, lam_noobj

Non-negative loss weights.

Value

List with loss, loss_coord, loss_obj, loss_noobj, loss_class, n_objects, n_cells.

Examples

set.seed(5)
P <- array(runif(2 * 2 * 6), c(2, 2, 6))
Tg <- array(0, c(2, 2, 6))
Tg[1, 1, ] <- c(0.5, 0.5, 0.3, 0.3, 1, 1)
r <- morie_geron_yolo_grid_loss(P, Tg)
str(r, max.level = 1)
#> List of 9
#>  $ loss      : num 3.45
#>  $ loss_coord: num 2.16
#>  $ loss_obj  : num 0.375
#>  $ loss_noobj: num 0.903
#>  $ loss_class: num 0.0121
#>  $ n_objects : int 1
#>  $ n_cells   : int 4
#>  $ estimate  : num 3.45
#>  $ n         : int 4