MIC-DKFZ / medicaldetectiontoolkit

The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is it a small bug in batch_dice??????

CodingHHW opened this issue · comments

commented

in the medicaldetectiontoolkit/utils/model_utils.py, lines 883, batch_dice loss function,
I think should add
if y[:, 1:, ...].max() == 0:
y = 1 - y
pred = 1 - pred

for the patch maybe it has no roi

Hi CodingHHW,
thanks for your concern.
Since the dice loss is implemented over the whole batch, it is unlikely a class will not at all be present, however it is possible.
For that case, I have added an additive smooth which handles this special case and is negligible in other cases (this commit).