
YOLO grid loss (Geron Ch 14, morie.fn gryol)
Source:R/geron_train_native.R
morie_geron_yolo_grid_loss.Rdlam_coord (xy + sqrt-wh) + obj + lam_noobj noobj + class, every term but objectness masked to the cells that contain an object.
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