uni-medical / SAM-Med3D

SAM-Med3D: An Efficient General-purpose Promptable Segmentation Model for 3D Volumetric Medical Image
Apache License 2.0
427 stars 56 forks source link

Add sigmoid activation to prev_masks #33

Closed GuangyanS closed 6 months ago

GuangyanS commented 6 months ago

This pull request introduces a sigmoid activation function to the prev_masks in the model. The primary goal of this change is to address a critical issue we encountered during training: without this activation, the model consistently yields a Dice coefficient of zero.

blueyo0 commented 6 months ago

Hi~ since we use sigmoid=True in self.seg_loss = DiceCELoss(sigmoid=True, squared_pred=True, reduction='mean'), I don't think the additional sigmoid is essential. Maybe more details should be checked for your zero Dice Coeff in experiments?

GuangyanS commented 6 months ago

Sorry for the wrong pull request I made. I checked the code again and find that sigmoid = True.

However, in this line of train.py I found that if you don't apply a sigmoid function before the filtering, the printed results will misalign with the correct ones.

Thanks again for your clarification.