neurodata / brainlit

Method container for computational neuroscience on brains.
http://brainlit.neurodata.io/
Other
27 stars 17 forks source link

Pytorch CNN Segmentation #354

Open shreyasingh1 opened 2 years ago

shreyasingh1 commented 2 years ago

Pytorch 3D CNN model architecture for training on 3D voxels. Easily editable example notebook (found in experiments -> pytorch_model) illustrates the model's application on the 50 image Mouselight benchmarking data. Helper files are found in brainlit.utils.cnn_segmentation

shreyasingh1 commented 2 years ago

*Still need to write tests, black files, and confirm that docs build

codecov[bot] commented 2 years ago

Codecov Report

Merging #354 (ae4830d) into develop (c4dfa8b) will decrease coverage by 2.01%. The diff coverage is 39.43%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #354 +/- ## =========================================== - Coverage 71.52% 69.52% -2.01% =========================================== Files 38 41 +3 Lines 4759 5076 +317 =========================================== + Hits 3404 3529 +125 - Misses 1355 1547 +192 ``` | [Impacted Files](https://codecov.io/gh/neurodata/brainlit/pull/354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=neurodata) | Coverage Δ | | |---|---|---| | [brainlit/utils/make\_masks.py](https://codecov.io/gh/neurodata/brainlit/pull/354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=neurodata#diff-YnJhaW5saXQvdXRpbHMvbWFrZV9tYXNrcy5weQ==) | `15.06% <15.06%> (ø)` | | | [brainlit/utils/cnn\_segmentation/performance\_cnn.py](https://codecov.io/gh/neurodata/brainlit/pull/354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=neurodata#diff-YnJhaW5saXQvdXRpbHMvY25uX3NlZ21lbnRhdGlvbi9wZXJmb3JtYW5jZV9jbm4ucHk=) | `29.60% <29.60%> (ø)` | | | [brainlit/utils/cnn\_segmentation/preprocess\_cnn.py](https://codecov.io/gh/neurodata/brainlit/pull/354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=neurodata#diff-YnJhaW5saXQvdXRpbHMvY25uX3NlZ21lbnRhdGlvbi9wcmVwcm9jZXNzX2Nubi5weQ==) | `75.00% <75.00%> (ø)` | |
shreyasingh1 commented 2 years ago

@tathey1 The PR now builds with CircleCI and Netlify. Code cov goes slightly down, only because I didn't write tests for functions that required "data_dir" as input. In the Netlify build, you can see the new refs in Utils->CNN Segmentation, and "make_masks" which is in Utils generally.

Brief description of PR: in brainlit -> utils -> cnn_segmentation, I added two helper files called preprocess_cnn.py and performance_cnn.py that format data into torch objects and provide code to train, test, and optimize a 3D CNN. Example notebook of how to use these is in experiments -> pytorch_model. Also added a file in brainlit -> utils called make_masks.py that formalizes how to make 3D image masks from a series of SWC files. Didn't write tests for this file because Bresenham3D is tested elsewhere in brainlit (but can add here too if necessary).

Only standing question is that the "Return" arguments are formatted strangely in some of the functions in Netlify. Function docstrings seem to be formatted correctly and I tried a few different alternatives with no luck. Input parameters are formatted right, it's only the Return arguments that aren't for some. Any guidance on how to fix?

github-actions[bot] commented 1 year ago

Stale pull request message

github-actions[bot] commented 1 year ago

Stale pull request message