dyollb / segmantic

Semantic segmentation and image-to-image translation based on AI
https://dyollb.github.io/segmantic/
MIT License
1 stars 3 forks source link

✨🔨 add distance transform #57

Open dyollb opened 1 year ago

dyollb commented 1 year ago

What do these changes do?

The boundary loss currently integrates (sum) over boundary deviation (XOR(A_gt, A_pred)), see b):

image

While the pre-computation is on the CPU (using scipy.ndimage.distance_transform_cdt), the loss is evaluated using simple operations using torch.Tensors.

Related issue/s

How to test

The distance transform is tested in tests/transforms/test_distance.py.

The boundary loss should be tested

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #57 (dc79f5f) into main (9e176d7) will increase coverage by 1.36%. The diff coverage is 67.88%.

@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
+ Coverage   53.90%   55.27%   +1.36%     
==========================================
  Files          20       22       +2     
  Lines        1228     1328     +100     
  Branches      218      237      +19     
==========================================
+ Hits          662      734      +72     
- Misses        530      545      +15     
- Partials       36       49      +13     
Flag Coverage Δ
unittests 55.27% <67.88%> (+1.36%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/segmantic/transforms/detect.py 74.21% <ø> (ø)
src/segmantic/transforms/ensemble.py 100.00% <ø> (ø)
src/segmantic/transforms/io.py 86.30% <ø> (ø)
src/segmantic/seg/monai_unet.py 20.77% <50.00%> (+0.12%) :arrow_up:
src/segmantic/seg/boundary_loss.py 52.08% <52.08%> (ø)
src/segmantic/transforms/distance.py 81.35% <81.35%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more