binary_dice_coefficient: Dice function for binary segmentation problems

View source: R/customMetrics.R

binary_dice_coefficientR Documentation

Dice function for binary segmentation problems

Description

Note: Assumption is that y_true is not a one-hot representation of the segmentation batch. For use with e.g., sigmoid activation.

Usage

binary_dice_coefficient(y_true, y_pred, smoothingFactor = 0)

Arguments

y_true

True labels (Tensor)

y_pred

Predictions (Tensor of the same shape as y_true)

smoothingFactor

parameter for smoothing the metric.

Value

Dice value (negative)

Author(s)

Tustison NJ

Examples


library( ANTsR )
library( ANTsRNet )
library( keras )

model <- createUnetModel2D( c( 64, 64, 1 ) )

dice_loss <- binary_dice_coefficient( smoothingFactor = 0.1 )

model %>% compile( loss = dice_loss,
  optimizer = optimizer_adam( lr = 0.0001 ) )

rm(model); gc()

ANTsX/ANTsRNet documentation built on April 23, 2024, 1:24 p.m.