Skip to content

Revision Experiments #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f08ad89
Add SBD to CryoVesNet evaluation
constantinpape Apr 17, 2025
7dd6962
Work on revision of AZ model WIP
constantinpape May 25, 2025
39d69d5
Implement AZ evaluation WIP
constantinpape May 25, 2025
d7f71a0
Update AZ training data
constantinpape May 28, 2025
f8d801f
Clean up AZ scripts and summarize current state
constantinpape May 29, 2025
5f66328
cropping stem data
SarahMuth Jun 5, 2025
c41628c
make prediction more flexible
SarahMuth Jun 6, 2025
b769a8e
make az_thin more flexible
SarahMuth Jun 6, 2025
d2aa6d8
empty crop without AZ annotation
SarahMuth Jun 6, 2025
59c3534
prepare for training AZ
SarahMuth Jun 9, 2025
02da6a2
Merge branch 'main' of https://github.com/computational-cell-analytic…
SarahMuth Jun 9, 2025
b1c8feb
make training more usable
SarahMuth Jun 11, 2025
6525651
fix a few things
SarahMuth Jun 13, 2025
b842bca
new data analysis, not tested
SarahMuth Jun 19, 2025
0785657
fix import
SarahMuth Jun 23, 2025
2fa3925
Merge branch 'main' of https://github.com/computational-cell-analytic…
SarahMuth Jun 23, 2025
d7b9a1a
exclude SV at boundary for automatic analysis
SarahMuth Jun 23, 2025
17b9368
remove background from analysis
SarahMuth Jun 26, 2025
ac4b9d7
store segID, use existing seg
SarahMuth Jun 26, 2025
a9b714f
minor addition
SarahMuth Jun 26, 2025
1ae7401
Merge branch 'main' into revision
SarahMuth Jun 30, 2025
d6eaa66
add boundary threshold for compartment seg
SarahMuth Jun 30, 2025
cab9f2b
Merge branch 'main' of https://github.com/computational-cell-analytic…
SarahMuth Jun 30, 2025
7b83139
change presynaptic filtering
SarahMuth Jul 1, 2025
d966ea3
minor things for analysis; 1st implementation of surface dice for eval
SarahMuth Jul 2, 2025
ad03103
add dataset info
SarahMuth Jul 2, 2025
f17c349
option to calc surface dice per component
SarahMuth Jul 3, 2025
48618d0
added compartment seg saved in h5
SarahMuth Jul 4, 2025
0c30cf0
updated SV seg h5
SarahMuth Jul 4, 2025
8763e49
make usage of surface dice more general
SarahMuth Jul 4, 2025
6e95660
make code more flexible
SarahMuth Jul 4, 2025
34886d7
fixed a few mistakes
SarahMuth Jul 4, 2025
f516ae4
minor adjustment
SarahMuth Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ models/*/
*.egg-info/
run_sbatch.sbatch
slurm/
slurm_revision/
scripts/cooper/evaluation_results/
scripts/cooper/training/copy_testset.py
scripts/rizzoli/upsample_data.py
scripts/cooper/training/find_rec_testset.py
synapse-net-models/
scripts/portal/upscale_tomo.py
analysis_results/
scripts/cooper/revision/evaluation_results/
scripts/cooper/revision/export_tif_to_h5.py
scripts/cooper/revision/copy_path.py
2 changes: 1 addition & 1 deletion environment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
channels:
- conda-forge
name:
synapse-net
synapse-net-cpu
dependencies:
- bioimageio.core
- kornia
Expand Down
1 change: 1 addition & 0 deletions models_az_thin/split-chemical_fixation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"train": ["20180305_06_MS.h5", "20171113_01_MS.h5", "20171113_05_MS.h5", "20171113_04_MS.h5", "20180305_05_MS.h5", "20171113_3.2_MS.h5", "20180305_09_MS.h5", "20180305_07_MS.h5", "20180305_04_MS.h5", "20171006_2_2_MS.h5", "20171006_05_MS.h5", "20180305_10_MS.h5", "20171006_03_MS.h5", "20171006_2_3_MS.h5"], "val": ["20171013_01_MS.h5", "20171013_1.2_MS.h5", "20171006_3_2_MS.h5", "20180305_08_MS.h5", "20180305_02_MS.h5"], "test": ["20180305_03_MS.h5", "20171113_06_MS.h5", "20171113_07_MS.h5", "20171113_02_MS.h5", "20180305_01_MS.h5"]}
1 change: 1 addition & 0 deletions models_az_thin/split-endbulb_of_held.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"train": ["M2_eb7_model.h5", "Wt22_eb1_10K_model2.h5", "WT40_eb5_model.h5", "KO8_eb4_model.h5", "M3_eb4_model.h5", "WT20_eb11_model2.h5", "WT13_syn6_model2.h5", "WT20_eb7_AZ1_model2.h5", "M2_eb10_model.h5", "WT11_syn1_model2.h5", "M8_eb8_model.h5", "WT22_eb10_model2.h5", "WT13_eb3_model2.h5", "WT20_syn7_model2.h5", "M7_eb6_model.h5", "WT20_eb7_AZ2_model2.h5", "WT13_syn5_model2.h5", "WT13_syn9_model2.h5", "M2_eb3_model.h5", "WT20_syn3_model2.h5", "WT20_syn1_model2.h5", "WT21_syn4_model2.h5", "WT20_eb4_model2.h5", "M2_eb9_model.h5", "M7_eb3_model.h5", "WT21_eb5_model2.h5", "WT22_eb6_AZ1_model2.h5", "WT13_syn10_model2.h5", "WT19_syn6_model2.h5", "M2_eb2_AZ2_model.h5", "WT41_eb4_model.h5", "WT13_syn4_model2.h5", "WT40_eb10_model.h5", "M1_eb8_model.h5", "WT19_syn9_model2.h5", "WT22_eb5_model2.h5", "WT39_eb7_model.h5", "KO9_eb13_model.h5", "WT39_eb5_model.h5", "WT11_eb5_model2.h5", "M7_eb15_model.h5", "M7_eb2_model.h5", "M7_eb9_model.h5", "WT22_syn7_model2.h5", "M1_eb7_model.h5", "WT11_syn6_model2.h5", "M7_eb5_model.h5", "WT22_syn5_model2.h5", "WT21_eb3_model2.h5", "WT19_syn3_model2.h5", "WT22_syn9_model2.h5", "M5_eb3_model.h5", "WT22_syn6_model2.h5", "WT39_eb9_model.h5", "WT13_eb5_model2.h5", "WT20_eb9_model2.h5", "WT20_eb2_AZ2_12K_model2.h5", "M7_eb12_model.h5", "M1_eb1_model.h5", "WT40_eb1_model.h5", "M2_eb6_model.h5", "M8_eb14_model.h5", "KO9_eb1_model.h5", "WT20_eb1_AZ2_12K_model2.h5", "M7_eb7_model.h5", "M8_eb9_model.h5", "WT40_eb11_model.h5", "M1_eb3_model.h5", "M8_eb12_model.h5", "M7_eb11_model.h5", "KO9_eb10_model.h5", "KO9_eb4_model.h5", "KO8_eb2_model.h5", "WT39_eb4_model.h5", "M1_eb5_model.h5", "M10_eb9_model.h5"], "val": ["WT41_eb6_model.h5", "Wt22_syn2_10K_model2.h5", "M1_eb6_model.h5", "KO9_eb11_model.h5", "WT20_eb5_model2.h5", "WT16_syn2_model2.h5", "KO9_eb9_model.h5", "WT21_eb7_model2.h5", "M7_eb4_model.h5", "M1_eb9_model.h5", "WT40_eb8_model.h5", "M2_eb5_model.h5", "WT13_eb4_model2.h5", "WT39_eb10_model.h5", "WT39_eb8_model.h5", "WT20_syn6_model2.h5", "WT13_syn11_model2.h5", "WT41_eb2_model.h5", "WT39_eb2_model.h5", "M2_eb14_model.h5", "M2_eb8_model.h5", "WT20_syn5_model2.h5", "M10_eb12_model.h5", "M5_eb1_model.h5", "KO9_eb12_model.h5"], "test": ["WT11_eb2_model2.h5", "WT21_syn5_model2.h5", "WT20_eb8_AZ2_model2.h5", "M10_eb8_model.h5", "WT21_eb9_model2.h5", "M2_eb1_model.h5", "WT22_syn10_model2.h5", "WT11_syn3_model2.h5", "WT11_eb1_model2.h5", "WT13_syn7_model2.h5", "WT21_eb4_model2.h5", "WT40_eb9_model.h5", "M6_eb2_model.h5", "WT22_syn1_10K_model2.h5", "WT19_syn1_model2.h5", "M7_eb10_model.h5", "KO9_eb6_model.h5", "WT11_eb7_model2.h5", "WT40_eb3_model.h5", "KO9_eb14_model.h5", "WT20_syn2_model2.h5", "WT22_eb9_model2.h5", "WT13_syn1_model2.h5", "WT39_eb3_model.h5", "WT21_syn3_model2.h5", "M8_eb6_model.h5"]}
1 change: 1 addition & 0 deletions models_az_thin/split-endbulb_of_held_cropped.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"train": ["Wt22_eb1_10K_model2_cropped.h5", "WT22_eb6_AZ1_model2_cropped.h5", "WT21_eb3_model2_cropped.h5", "M7_eb11_model_cropped.h5", "WT20_syn3_model2_cropped.h5", "WT13_syn7_model2_cropped.h5", "WT13_eb4_model2_cropped.h5", "WT39_eb2_model_cropped.h5", "WT20_syn1_model2_cropped.h5", "WT40_eb3_model_cropped.h5", "WT20_eb7_AZ1_model2_cropped.h5", "WT21_syn5_model2_cropped.h5", "WT13_syn4_model2_cropped.h5", "KO9_eb13_model_cropped.h5", "M10_eb9_model_cropped.h5", "WT20_syn5_model2_cropped.h5", "M10_eb8_model_cropped.h5", "M7_eb12_model_cropped.h5", "WT39_eb7_model_cropped.h5", "WT20_eb4_model2_cropped.h5", "M1_eb8_model_cropped.h5", "WT40_eb11_model_cropped.h5", "KO9_eb14_model_cropped.h5", "WT39_eb10_model_cropped.h5", "KO9_eb6_model_cropped.h5", "WT13_syn1_model2_cropped.h5", "WT13_syn9_model2_cropped.h5", "WT13_eb3_model2_cropped.h5", "WT41_eb4_model_cropped.h5", "WT40_eb5_model_cropped.h5", "WT11_eb5_model2_cropped.h5", "WT22_eb9_model2_cropped.h5", "M2_eb2_AZ2_model_cropped.h5", "WT41_eb6_model_cropped.h5", "WT13_eb5_model2_cropped.h5", "WT13_syn11_model2_cropped.h5", "WT22_syn5_model2_cropped.h5", "WT20_syn6_model2_cropped.h5", "WT22_syn9_model2_cropped.h5", "WT11_syn6_model2_cropped.h5", "M8_eb12_model_cropped.h5", "WT39_eb4_model_cropped.h5", "M8_eb8_model_cropped.h5", "WT21_eb9_model2_cropped.h5", "WT39_eb3_model_cropped.h5", "M2_eb1_model_cropped.h5", "M2_eb9_model_cropped.h5", "WT39_eb5_model_cropped.h5", "WT22_eb10_model2_cropped.h5", "M7_eb4_model_cropped.h5", "WT20_eb7_AZ2_model2_cropped.h5", "WT40_eb10_model_cropped.h5", "WT19_syn9_model2_cropped.h5", "WT22_syn6_model2_cropped.h5", "WT11_eb1_model2_cropped.h5", "M10_eb12_model_cropped.h5", "KO9_eb11_model_cropped.h5", "WT19_syn6_model2_cropped.h5", "M7_eb5_model_cropped.h5", "WT39_eb9_model_cropped.h5", "M2_eb14_model_cropped.h5", "Wt22_syn2_10K_model2_cropped.h5", "WT20_syn2_model2_cropped.h5", "M7_eb9_model_cropped.h5", "M5_eb3_model_cropped.h5", "WT22_syn1_10K_model2_cropped.h5", "M1_eb7_model_cropped.h5", "M1_eb6_model_cropped.h5", "M7_eb7_model_cropped.h5", "WT21_eb7_model2_cropped.h5", "M2_eb8_model_cropped.h5", "WT20_eb1_AZ2_12K_model2_cropped.h5", "WT20_eb9_model2_cropped.h5", "WT41_eb2_model_cropped.h5", "WT20_eb5_model2_cropped.h5", "KO9_eb12_model_cropped.h5", "M3_eb4_model_cropped.h5", "WT19_syn1_model2_cropped.h5", "M2_eb3_model_cropped.h5", "KO9_eb9_model_cropped.h5", "WT13_syn5_model2_cropped.h5", "M1_eb1_model_cropped.h5", "M2_eb5_model_cropped.h5", "WT20_eb11_model2_cropped.h5", "WT13_syn6_model2_cropped.h5", "KO9_eb10_model_cropped.h5", "M2_eb7_model_cropped.h5", "M1_eb5_model_cropped.h5", "WT13_syn10_model2_cropped.h5", "WT22_eb5_model2_cropped.h5", "KO8_eb2_model_cropped.h5", "M2_eb10_model_cropped.h5", "KO9_eb1_model_cropped.h5", "M7_eb10_model_cropped.h5", "WT21_syn3_model2_cropped.h5", "WT40_eb8_model_cropped.h5"], "val": ["WT20_eb2_AZ2_12K_model2_cropped.h5", "WT19_syn3_model2_cropped.h5", "M6_eb2_model_cropped.h5", "M8_eb9_model_cropped.h5", "KO8_eb4_model_cropped.h5", "WT21_eb4_model2_cropped.h5", "WT22_syn10_model2_cropped.h5", "WT20_syn7_model2_cropped.h5", "M7_eb3_model_cropped.h5", "M7_eb6_model_cropped.h5", "WT16_syn2_model2_cropped.h5", "WT39_eb8_model_cropped.h5", "KO9_eb4_model_cropped.h5", "M1_eb9_model_cropped.h5", "M2_eb6_model_cropped.h5", "WT11_syn1_model2_cropped.h5", "WT11_eb7_model2_cropped.h5", "M1_eb3_model_cropped.h5", "WT21_eb5_model2_cropped.h5", "WT11_syn3_model2_cropped.h5", "M8_eb6_model_cropped.h5", "WT21_syn4_model2_cropped.h5", "M7_eb15_model_cropped.h5", "WT22_syn7_model2_cropped.h5"]}
1 change: 1 addition & 0 deletions models_az_thin/split-stem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"train": ["36859_H3_SP_10_rec_2kb1dawbp_crop.h5", "36859_H3_SP_01_rec_2kb1dawbp_crop.h5", "36859_H2_SP_02_rec_2Kb1dawbp_crop.h5", "36859_H2_SP_03_rec_2Kb1dawbp_crop.h5"], "val": ["36859_H3_SP_05_rec_2kb1dawbp_crop.h5", "36859_H2_SP_01_rec_2Kb1dawbp_crop.h5"], "test": ["36859_H3_SP_07_rec_2kb1dawbp_crop.h5", "36859_J1_STEM750_66K_SP_03_rec_2kb1dawbp_crop.h5"]}
1 change: 1 addition & 0 deletions models_az_thin/split-stem_cropped.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"train": ["36859_J1_66K_TS_CA3_PS_23_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_15_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_66K_TS_CA3_PS_43_rec_2Kb1dawbp_crop_crop1.h5", "36859_H2_SP_01_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_10_rec_2kb1dawbp_crop_crop1.h5", "36859_H3_SP_05_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_07_rec_2kb1dawbp_crop_crop2.h5", "36859_H2_SP_01_rec_2Kb1dawbp_crop_crop2.h5", "36859_J1_STEM750_66K_SP_08_rec_2kb1dawbp_crop_crop3.h5", "36859_H3_SP_07_rec_2kb1dawbp_crop_crop2.h5", "36859_H3_SP_07_rec_2kb1dawbp_crop_cropped_noAZ.h5", "36859_J1_STEM750_66K_SP_03_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_06_rec_2kb1dawbp_crop_crop1.h5", "36859_H2_SP_03_rec_2Kb1dawbp_crop_crop1.h5", "36859_H3_SP_07_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_02_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_17_rec_2kb1dawbp_crop_crop1.h5", "36859_H2_SP_11_rec_2Kb1dawbp_crop_crop1.h5", "36859_H2_SP_04_rec_2Kb1dawbp_crop_crop1.h5", "36859_H2_SP_04_rec_2Kb1dawbp_crop_crop2.h5", "36859_H3_SP_10_rec_2kb1dawbp_crop_cropped_noAZ.h5", "36859_H2_SP_06_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_66K_TS_CA3_PS_26_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_14_rec_2kb1dawbp_crop_crop2.h5", "36859_H3_SP_01_rec_2kb1dawbp_crop_crop1.h5", "36859_H2_SP_01_rec_2Kb1dawbp_crop_crop3.h5", "36859_J1_STEM750_66K_SP_13_rec_2kb1dawbp_crop_crop2.h5", "36859_H2_SP_10_rec_crop_crop1.h5", "36859_H2_SP_02_rec_2Kb1dawbp_crop_cropped_noAZ.h5", "36859_J1_66K_TS_CA3_PS_32_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_01_rec_2kb1dawbp_crop_crop1.h5", "36859_H2_SP_03_rec_2Kb1dawbp_crop_cropped_noAZ.h5", "36859_H3_SP_10_rec_2kb1dawbp_crop_crop1.h5", "36859_H2_SP_02_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_08_rec_2kb1dawbp_crop_crop2.h5", "36859_J1_STEM750_66K_SP_03_rec_2kb1dawbp_crop_crop2.h5", "36859_H3_SP_05_rec_2kb1dawbp_crop_crop2.h5", "36859_H2_SP_07_rec_2Kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_13_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_14_rec_2kb1dawbp_crop_crop1.h5"], "val": ["36859_J1_STEM750_66K_SP_03_rec_2kb1dawbp_crop_crop3.h5", "36859_H2_SP_01_rec_2Kb1dawbp_crop_cropped_noAZ.h5", "36859_J1_STEM750_66K_SP_08_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_12_rec_2kb1dawbp_crop_crop1.h5", "36859_H3_SP_05_rec_2kb1dawbp_crop_cropped_noAZ.h5", "36859_H3_SP_09_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_11_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_07_rec_2kb1dawbp_crop_crop1.h5", "36859_J1_STEM750_66K_SP_12_rec_2kb1dawbp_crop_crop2.h5", "36859_J1_STEM750_66K_SP_10_rec_2kb1dawbp_crop_crop2.h5"]}
1 change: 1 addition & 0 deletions models_az_thin/split-tem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"train": ["20190805_09002_B4_SC_08_SP.h5", "WT_MF_DIV28_3.2_MS_09204_K1.h5", "20190524_09204_F4_SC_09_SP.h5", "20190524_09204_F4_SC_06_SP.h5", "WT_MF_DIV14_6.2_MS_E2_09175_CA3_2.h5", "WT_MF_DIV14_07_MS_C2_09175_CA3.h5", "WT_Unt_SC_09175_C4_04_DIV15_mtk_04.h5", "M13_CTRL_22723_O3_06_DIV29_06_MS.h5", "WT_Unt_SC_09175_E2_04_DIV14_mtk_03.h5", "WT_MF_DIV14_01_MS_E2_09175_CA3.h5", "M13_CTRL_22723_J1_03_DIV29_03_MS.h5", "20190807_23032_D4_SC_03_SP.h5", "M13_DKO_09201_U1_05_DIV31_05_MS.h5", "WT_Unt_SC_09175_E4_02_DIV14_mtk_02.h5", "20190805_09002_B4_SC_01_SP.h5", "WT_Unt_SC_09175_C4_08_DIV15_mtk_08.h5", "WT_MF_DIV14_01_MS_B2_09175_CA3.h5", "20190805_09002_B4_SC_10_SP.h5", "WT_Unt_SC_09175_D4_01_DIV14_mtk_01.h5", "WT_Unt_SC_09175_E2_03_DIV14_mtk_03.h5", "WT_Unt_SC_09175_C4_02_DIV15_mtk_02.h5", "20190805_09002_B4_SC_12_SP.h5", "20190805_09002_B4_SC_02_SP.h5", "M13_DKO_09201_U1_04_DIV31_04_MS.h5", "WT_MF_DIV14_02_MS_D2_09175_CA3.h5", "WT_Unt_SC_09175_E2_05_DIV14_mtk_05.h5", "20190807_23032_D4_SC_07_SP.h5", "M13_CTRL_09201_S2_03_DIV31_03_MS.h5", "WT_MF_DIV14_01.2_MS_D1_09175_CA3.h5", "20190807_23032_D4_SC_01_SP.h5", "WT_Unt_SC_09175_E4_03_DIV14_mtk_03.h5", "WT_MF_DIV28_3.3_MS_09204_K1.h5", "WT_Unt_SC_09175_D5_04_DIV14_mtk_04.h5", "20190524_09204_F4_SC_05_SP.h5", "M13_DKO_22723_A1_03_DIV29_03_MS.h5", "20190805_09002_B4_SC_7.2_SP.h5", "M13_DKO_22723_A4_08_DIV29_08_MS.h5", "WT_Unt_SC_09175_E4_05_DIV14_mtk_05.h5", "M13_CTRL_09201_S1_01_DIV31_01.h5", "WT_Unt_SC_09175_C4_03_DIV15_mtk_03.h5", "WT_MF_DIV28_03_MS_09204_M1.h5", "M13_DKO_09201_U1_5.2_DIV31_5.2_MS.h5", "WT_Unt_SC_09175_E2_01_DIV14_mtk_01.h5", "WT_MF_DIV28_2.3_MS_09002_B1.h5", "WT_MF_DIV28_01_MS_09204_F1.h5", "M13_CTRL_09201_S2_05_DIV31_05_MS.h5", "20190807_23032_D4_SC_04_SP.h5", "M13_DKO_09201_Q1_04_DIV31_04_MS.h5", "WT_MF_DIV28_04_MS_09204_M1.h5", "WT_Unt_SC_09175_D4_04_DIV14_mtk_04.h5", "WT_MF_DIV14_02_MS_B2_09175_CA3.h5", "20190807_23032_D4_SC_10_SP.h5", "M13_DKO_09201_U1_03_DIV31_03_MS.h5", "WT_MF_DIV14_01_MS_D1_09175_CA3.h5", "WT_MF_DIV28_05_MS_09204_F1.h5", "WT_Unt_SC_09175_D4_05_DIV14_mtk_05.h5", "WT_MF_DIV14_01_MS_D2_09175_CA3.h5", "WT_MF_DIV28_03_MS_09204_K1.h5", "M13_DKO_09201_O1_01_DIV31_01_MS.h5", "WT_MF_DIV14_04_MS_C2_09175_CA3.h5", "20190524_09204_F4_SC_04_SP.h5", "WT_MF_DIV14_02_MS_E1_09175_CA3.h5", "20190807_23032_D4_SC_09_SP.h5", "M13_CTRL_22723_O2_04_DIV29_04_MS.h5", "WT_MF_DIV28_03_MS_09204_F1.h5", "WT_MF_DIV28_01_MS_09002_B1.h5", "20190524_09204_F4_SC_03_SP.h5", "M13_DKO_22723_A1_4.2_DIV29_4.2_MS.h5", "M13_DKO_23037_K1_01_DIV29_01_MS.h5", "M13_DKO_23037_K1_1.2_DIV29_1.2_MS.h5", "20190524_09204_F4_SC_11_SP.h5", "WT_MF_DIV28_1.2_MS_09204_F1.h5", "M13_DKO_09201_O3_06_DIV31_06_MS.h5", "WT_Unt_SC_09175_C4_01_DIV15_mtk_01.h5", "WT_MF_DIV14_3.2_MS_D2_09175_CA3.h5", "WT_MF_DIV28_07_MS_09002_B2.h5", "WT_MF_DIV28_06_MS_09204_F1.h5", "M13_CTRL_09201_S2_04_DIV31_04_MS.h5", "WT_MF_DIV28_1.2_MS_09002_B1.h5", "WT_MF_DIV28_3.4_MS_09204_K1.h5", "20190524_09204_F4_SC_10_SP.h5", "20190805_09002_B4_SC_11_SP.h5", "20190524_09204_F4_SC_01_SP.h5", "WT_Unt_SC_09175_C4_05_DIV15_mtk_05.h5", "WT_MF_DIV28_04_MS_09002_B2.h5"], "val": ["WT_MF_DIV28_02_MS_09002_B1.h5", "M13_CTRL_09201_S2_06_DIV31_06_MS.h5", "20190805_09002_B4_SC_05_SP.h5", "WT_MF_DIV14_04_MS_B2_09175_CA3.h5", "M13_CTRL_22723_O3_07_DIV29_07_MS.h5", "WT_MF_DIV14_03.2_MS_D1_09175_CA3.h5", "WT_MF_DIV14_04_MS_E1_09175_CA3.h5", "20190524_09204_F4_SC_07_SP.h5", "WT_MF_DIV28_08_MS_09204_F2.h5", "WT_MF_DIV14_06_MS_C2_09175_CA3.h5", "WT_Unt_SC_09175_B5_03_DIV16_mtk_05.h5", "WT_MF_DIV28_2.2_MS_09002_B1.h5", "WT_Unt_SC_09175_D4_02_DIV14_mtk_02.h5", "WT_MF_DIV28_04_MS_09204_F1.h5", "20190805_09002_B4_SC_04_SP.h5", "M13_DKO_09201_Q1_01_DIV31_01_MS.h5", "WT_MF_DIV28_02_MS_09204_M1.h5", "M13_CTRL_22723_O2_05_DIV29_05_MS_.h5", "20190807_23032_D4_SC_08_SP.h5", "WT_Unt_SC_09175_D5_05_DIV14_mtk_05.h5", "WT_Unt_SC_09175_D5_02_DIV14_mtk_02.h5", "WT_MF_DIV14_05_MS_B2_09175_CA3.h5", "WT_Unt_SC_09175_D5_01_DIV14_mtk_01.h5", "20190524_09204_F4_SC_02_SP.h5", "WT_Unt_SC_09175_E4_04_DIV14_mtk_04.h5", "M13_DKO_09201_O3_6.2_DIV31_6.2_MS.h5", "M13_DKO_22723_A1_05_DIV29_05_MS.h5", "WT_MF_DIV14_04_MS_E2_09175_CA3_2.h5", "WT_MF_DIV14_03_MS_C2_09175_CA3.h5"], "test": ["WT_MF_DIV28_4.2_MS_09204_M1.h5", "M13_DKO_09201_Q1_03_DIV31_03_MS.h5", "WT_MF_DIV14_3.1_MS_D2_09175_CA3.h5", "WT_Unt_SC_09175_B5_03_DIV16_mtk_04.h5", "WT_MF_DIV28_10_MS_09002_B3.h5", "WT_MF_DIV14_06_MS_E2_09175_CA3_2.h5", "WT_MF_DIV14_03.3_MS_D1_09175_CA3.h5", "20190805_09002_B4_SC_09_SP.h5", "20190805_09002_B4_SC_7.1_SP.h5", "WT_MF_DIV14_03.1_MS_D1_09175_CA3.h5", "WT_Unt_SC_09175_E4_01_DIV14_mtk_01.h5", "WT_MF_DIV28_09_MS_09002_B3.h5", "WT_Unt_SC_09175_B5_01_DIV16_mtk_01.h5", "M13_DKO_22723_A1_06_DIV29_06_MS.h5", "WT_MF_DIV14_01_MS_orig_C2_09175_CA3.h5", "20190807_23032_D4_SC_05_SP.h5", "M13_DKO_22723_A4_10_DIV29_10_MS.h5", "WT_MF_DIV14_05_MS_C2_09175_CA3.h5", "WT_MF_DIV28_07_MS_09204_F2.h5", "WT_Unt_SC_09175_D5_03_DIV14_mtk_03.h5", "M13_CTRL_22723_O2_05_DIV29_5.2.h5", "WT_MF_DIV14_02_MS_C2_09175_CA3.h5", "WT_Unt_SC_09175_B5_03_DIV16_mtk_03.h5", "WT_MF_DIV14_03_MS_B2_09175_CA3.h5", "WT_Unt_SC_09175_B5_02_DIV16_mtk_02.h5", "WT_Unt_SC_09175_C4_06_DIV15_mtk_06.h5", "WT_MF_DIV14_05_MS_E2_09175_CA3_2.h5", "M13_CTRL_09201_S2_02_DIV31_02_MS.h5", "WT_MF_DIV28_08_MS_09002_B3.h5"]}
12 changes: 12 additions & 0 deletions run_sbatch_revision.sbatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash
#SBATCH -c 4 #4 #8
#SBATCH --mem 256G #120G #32G #64G #256G
#SBATCH -p grete:shared #grete:shared #grete-h100:shared
#SBATCH -t 4:00:00 #6:00:00 #48:00:00
#SBATCH -G A100:1 #V100:1 #2 #A100:1 #gtx1080:2 #v100:1 #H100:1
#SBATCH --output=/user/muth9/u12095/synapse-net/slurm_revision/slurm-%j.out
#SBATCH -A nim00007 #SBATCH --constraint 80gb

source ~/.bashrc
conda activate synapse-net
python scripts/cooper/revision/surface_dice.py -i /mnt/ceph-hdd/cold/nim00007/AZ_prediction_new/stem_for_eval/ -gt /mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/stem_for_eval/ -v 7
28 changes: 23 additions & 5 deletions scripts/baselines/cryo_ves_net/evaluate_cooper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numpy as np
import pandas as pd
from elf.evaluation.matching import matching
from elf.evaluation.dice import symmetric_best_dice_score
from tqdm import tqdm

INPUT_ROOT = "/mnt/lustre-emmy-hdd/projects/nim00007/data/synaptic-reconstruction/cooper/vesicles_processed_v2/testsets" # noqa
Expand All @@ -25,11 +26,11 @@
]


def evaluate_dataset(ds_name):
def evaluate_dataset(ds_name, force):
result_folder = "./results/cooper"
os.makedirs(result_folder, exist_ok=True)
result_path = os.path.join(result_folder, f"{ds_name}.csv")
if os.path.exists(result_path):
if os.path.exists(result_path) and not force:
results = pd.read_csv(result_path)
return results

Expand All @@ -44,6 +45,9 @@ def evaluate_dataset(ds_name):
mask_key = None

pred_files = sorted(glob(os.path.join(OUTPUT_ROOT, ds_name, "**/*.h5"), recursive=True))
if ds_name == "04":
pred_names = [os.path.basename(path) for path in pred_files]
input_files = [path for path in input_files if os.path.basename(path) in pred_names]
assert len(input_files) == len(pred_files), f"{len(input_files)}, {len(pred_files)}"

results = {
Expand All @@ -52,12 +56,13 @@ def evaluate_dataset(ds_name):
"precision": [],
"recall": [],
"f1-score": [],
"sbd-score": [],
}
for inf, predf in tqdm(zip(input_files, pred_files), total=len(input_files), desc=f"Evaluate {ds_name}"):
fname = os.path.basename(inf)
sub_res_path = os.path.join(result_folder, f"{ds_name}_{fname}.json")

if os.path.exists(sub_res_path):
if os.path.exists(sub_res_path) and not force:
print("Loading scores from", sub_res_path)
with open(sub_res_path, "r") as f:
scores = json.load(f)
Expand Down Expand Up @@ -89,6 +94,8 @@ def evaluate_dataset(ds_name):
gt[mask == 0] = 0

scores = matching(seg, gt)
sbd_score = symmetric_best_dice_score(seg, gt)
scores["sbd"] = sbd_score

with open(sub_res_path, "w") as f:
json.dump(scores, f)
Expand All @@ -98,16 +105,19 @@ def evaluate_dataset(ds_name):
results["precision"].append(scores["precision"])
results["recall"].append(scores["recall"])
results["f1-score"].append(scores["f1"])
results["sbd-score"].append(scores["sbd"])

results = pd.DataFrame(results)
results.to_csv(result_path, index=False)
return results


def main():
force = False

all_results = {}
for ds in DATASETS:
result = evaluate_dataset(ds)
result = evaluate_dataset(ds, force=force)
all_results[ds] = result

groups = {
Expand All @@ -123,16 +133,24 @@ def main():
}

for name, datasets in groups.items():
f1_scores = []
f1_scores, sbd_scores = [], []

for ds in datasets:
this_f1_scores = all_results[ds]["f1-score"].values.tolist()
this_sbd_scores = all_results[ds]["sbd-score"].values.tolist()
f1_scores.extend(this_f1_scores)
sbd_scores.extend(this_sbd_scores)

mean_f1 = np.mean(f1_scores)
std_f1 = np.std(f1_scores)
print("F1-Score")
print(name, ":", mean_f1, "+-", std_f1)

mean_sbd = np.mean(sbd_scores)
std_sbd = np.std(sbd_scores)
print("SBD-Score")
print(name, ":", mean_sbd, "+-", std_sbd)


if __name__ == "__main__":
main()
Loading