teamtomo / membrain-seg

membrane segmentation in 3D for cryo-ET
Other
47 stars 12 forks source link

Surface dice loss #45

Closed LorenzLamm closed 5 months ago

LorenzLamm commented 5 months ago

Added the option to use Surface-Dice as a loss function during training.

Surface-Dice is based on "clDice - a Novel Topology-Preserving Loss Function for Tubular Structure Segmentation" (https://openaccess.thecvf.com/content/CVPR2021/papers/Shit_clDice_-_A_Novel_Topology-Preserving_Loss_Function_for_Tubular_Structure_CVPR_2021_paper.pdf)

Also fixed some issues for patch extraction (corrected naming), removed wandb tracking (caused dependency issues), fixed bug mentioned in https://github.com/teamtomo/membrain-seg/issues/44, and added printing of training parameter summary.

codecov-commenter commented 5 months ago

Codecov Report

Attention: 125 lines in your changes are missing coverage. Please review.

Comparison is base (1f9747a) 5.41% compared to head (9f39fc7) 7.73%.

Files Patch % Lines
...membrain_seg/segmentation/training/surface_dice.py 23.37% 59 Missing :warning:
...eg/segmentation/training/training_param_summary.py 0.00% 32 Missing :warning:
src/membrain_seg/segmentation/networks/unet.py 5.26% 18 Missing :warning:
...ain_seg/segmentation/dataloading/memseg_dataset.py 0.00% 7 Missing :warning:
.../membrain_seg/segmentation/training/optim_utils.py 90.00% 3 Missing :warning:
src/membrain_seg/annotations/merge_corrections.py 0.00% 2 Missing :warning:
src/membrain_seg/segmentation/cli/train_cli.py 0.00% 2 Missing :warning:
src/membrain_seg/segmentation/train.py 0.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #45 +/- ## ======================================== + Coverage 5.41% 7.73% +2.31% ======================================== Files 38 40 +2 Lines 1256 1410 +154 ======================================== + Hits 68 109 +41 - Misses 1188 1301 +113 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

LorenzLamm commented 5 months ago

This looks good to me! I have some minor comments below. Based on the conversation on zulip with @alisterburt , it sounds like we are in agreement that this loss function should live in membrain-seg. I think you can merge after you address the minor comments. Thanks, @LorenzLamm !

Cool, thanks a lot for your feedback @kevinyamauchi ! Implemented your suggestions and merging now.