panel_segmentation.panel_detection.PanelDetection.diceCoeff

PanelDetection.diceCoeff(y_true, y_pred, smooth=1)[source]

This function is used as the metric of similarity between the predicted mask and ground truth.

Parameters
  • y_true (numpy array of floats) – The true mask of the image

  • y_pred (numpy array of floats) – the predicted mask of the data

  • smooth (int) – A parameter to ensure we are not dividing by zero and also a smoothing parameter for back -ropagation. If the prediction is hard threshold to 0 and 1, it is difficult to back-propagate the dice loss gradient. We add this parameter to actually smooth out the loss function, making it differentiable.

Returns

dice – Retuns the metric of similarity between prediction and ground truth

Return type

float