octopi 1.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. octopi/__init__.py +7 -0
  2. octopi/datasets/__init__.py +0 -0
  3. octopi/datasets/augment.py +83 -0
  4. octopi/datasets/cached_datset.py +113 -0
  5. octopi/datasets/dataset.py +19 -0
  6. octopi/datasets/generators.py +458 -0
  7. octopi/datasets/io.py +200 -0
  8. octopi/datasets/mixup.py +49 -0
  9. octopi/datasets/multi_config_generator.py +252 -0
  10. octopi/entry_points/__init__.py +0 -0
  11. octopi/entry_points/common.py +119 -0
  12. octopi/entry_points/create_slurm_submission.py +251 -0
  13. octopi/entry_points/groups.py +152 -0
  14. octopi/entry_points/run_create_targets.py +234 -0
  15. octopi/entry_points/run_evaluate.py +99 -0
  16. octopi/entry_points/run_extract_mb_picks.py +191 -0
  17. octopi/entry_points/run_extract_midpoint.py +143 -0
  18. octopi/entry_points/run_localize.py +176 -0
  19. octopi/entry_points/run_optuna.py +161 -0
  20. octopi/entry_points/run_segment.py +154 -0
  21. octopi/entry_points/run_train.py +189 -0
  22. octopi/extract/__init__.py +0 -0
  23. octopi/extract/localize.py +217 -0
  24. octopi/extract/membranebound_extract.py +263 -0
  25. octopi/extract/midpoint_extract.py +193 -0
  26. octopi/main.py +33 -0
  27. octopi/models/AttentionUnet.py +56 -0
  28. octopi/models/MedNeXt.py +111 -0
  29. octopi/models/ModelTemplate.py +36 -0
  30. octopi/models/SegResNet.py +92 -0
  31. octopi/models/Unet.py +59 -0
  32. octopi/models/UnetPlusPlus.py +47 -0
  33. octopi/models/__init__.py +0 -0
  34. octopi/models/common.py +72 -0
  35. octopi/processing/__init__.py +0 -0
  36. octopi/processing/create_targets_from_picks.py +224 -0
  37. octopi/processing/downloader.py +138 -0
  38. octopi/processing/downsample.py +125 -0
  39. octopi/processing/evaluate.py +302 -0
  40. octopi/processing/importers.py +116 -0
  41. octopi/processing/segmentation_from_picks.py +167 -0
  42. octopi/pytorch/__init__.py +0 -0
  43. octopi/pytorch/hyper_search.py +244 -0
  44. octopi/pytorch/model_search_submitter.py +291 -0
  45. octopi/pytorch/segmentation.py +363 -0
  46. octopi/pytorch/segmentation_multigpu.py +162 -0
  47. octopi/pytorch/trainer.py +465 -0
  48. octopi/pytorch_lightning/__init__.py +0 -0
  49. octopi/pytorch_lightning/optuna_pl_ddp.py +273 -0
  50. octopi/pytorch_lightning/train_pl.py +244 -0
  51. octopi/utils/__init__.py +0 -0
  52. octopi/utils/config.py +57 -0
  53. octopi/utils/io.py +215 -0
  54. octopi/utils/losses.py +86 -0
  55. octopi/utils/parsers.py +162 -0
  56. octopi/utils/progress.py +78 -0
  57. octopi/utils/stopping_criteria.py +143 -0
  58. octopi/utils/submit_slurm.py +95 -0
  59. octopi/utils/visualization_tools.py +290 -0
  60. octopi/workflows.py +262 -0
  61. octopi-1.4.0.dist-info/METADATA +119 -0
  62. octopi-1.4.0.dist-info/RECORD +65 -0
  63. octopi-1.4.0.dist-info/WHEEL +4 -0
  64. octopi-1.4.0.dist-info/entry_points.txt +3 -0
  65. octopi-1.4.0.dist-info/licenses/LICENSE +41 -0
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: octopi
3
+ Version: 1.4.0
4
+ Summary: Model architecture exploration for cryoET particle picking
5
+ Project-URL: Homepage, https://github.com/chanzuckerberg/octopi
6
+ Project-URL: Documentation, https://chanzuckerberg.github.io/octopi/
7
+ Project-URL: Issues, https://github.com/chanzuckerberg/octopi/issues
8
+ Author: Jonathan Schwartz, Kevin Zhao, Daniel Ji, Utz Ermel
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
20
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
21
+ Requires-Python: >=3.9
22
+ Requires-Dist: copick
23
+ Requires-Dist: copick-utils
24
+ Requires-Dist: ipywidgets
25
+ Requires-Dist: kaleido
26
+ Requires-Dist: matplotlib
27
+ Requires-Dist: mlflow
28
+ Requires-Dist: monai
29
+ Requires-Dist: mrcfile
30
+ Requires-Dist: multiprocess
31
+ Requires-Dist: nibabel
32
+ Requires-Dist: optuna
33
+ Requires-Dist: optuna-integration[botorch,pytorch-lightning]
34
+ Requires-Dist: pandas
35
+ Requires-Dist: python-dotenv
36
+ Requires-Dist: requests
37
+ Requires-Dist: rich-click
38
+ Requires-Dist: torch-ema
39
+ Requires-Dist: tqdm
40
+ Provides-Extra: dev
41
+ Requires-Dist: black>=24.8.0; extra == 'dev'
42
+ Requires-Dist: pre-commit>=3.8.0; extra == 'dev'
43
+ Requires-Dist: pytest>=6.2.3; extra == 'dev'
44
+ Requires-Dist: ruff>=0.6.4; extra == 'dev'
45
+ Provides-Extra: docs
46
+ Requires-Dist: mkdocs; extra == 'docs'
47
+ Requires-Dist: mkdocs-awesome-pages-plugin; extra == 'docs'
48
+ Requires-Dist: mkdocs-git-authors-plugin; extra == 'docs'
49
+ Requires-Dist: mkdocs-git-committers-plugin-2; extra == 'docs'
50
+ Requires-Dist: mkdocs-git-revision-date-localized-plugin; extra == 'docs'
51
+ Requires-Dist: mkdocs-material; extra == 'docs'
52
+ Requires-Dist: mkdocs-minify-plugin; extra == 'docs'
53
+ Requires-Dist: mkdocs-redirects; extra == 'docs'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # OCTOPI 🐙🐙🐙
57
+
58
+ [![License](https://img.shields.io/pypi/l/octopi.svg?color=green)](https://github.com/chanzuckerberg/octopi/raw/main/LICENSE)
59
+ [![PyPI](https://img.shields.io/pypi/v/octopi.svg?color=green)](https://pypi.org/project/octopi)
60
+ [![Python Version](https://img.shields.io/pypi/pyversions/octopi.svg?color=green)](https://www.python.org/)
61
+
62
+ **O**bject dete**CT**ion **O**f **P**rote**I**ns. A deep learning framework for Cryo-ET 3D particle picking with autonomous model exploration capabilities.
63
+
64
+ ## 🚀 Introduction
65
+
66
+ octopi addresses a critical bottleneck in cryo-electron tomography (cryo-ET) research: the efficient identification and extraction of proteins within complex cellular environments. As advances in cryo-ET enable the collection of thousands of tomograms, the need for automated, accurate particle picking has become increasingly urgent.
67
+
68
+ Our deep learning-based pipeline streamlines the training and execution of 3D autoencoder models specifically designed for cryo-ET particle picking. Built on [copick](https://github.com/copick/copick), a storage-agnostic API, octopi seamlessly accesses tomograms and segmentations across local and remote environments.
69
+
70
+ ## 🧩 Core Features
71
+
72
+ - **3D U-Net Training**: Train and evaluate custom 3D U-Net models for particle segmentation
73
+ - **Automatic Architecture Search**: Explore optimal model configurations using Bayesian optimization via Optuna
74
+ - **Flexible Data Access**: Seamlessly work with tomograms from local storage or remote data portals
75
+ - **HPC Ready**: Built-in support for SLURM-based clusters
76
+ - **Experiment Tracking**: Integrated MLflow support for monitoring training and optimization
77
+ - **Dual Interface**: Use via command-line or Python API
78
+
79
+ ## 🚀 Quick Start
80
+
81
+ ### Installation
82
+
83
+ Octopi is availableon PyPI and can be installed using pip:
84
+ ```bash
85
+ pip install octopi
86
+ ```
87
+
88
+ ⚠️ **Note**: One of the current dependencies is currently not working with pip 25.1. We recommend using pip 25.2 or higher,
89
+ or [`uv pip`](https://docs.astral.sh/uv/pip/) when installing octopi.
90
+ ```bash
91
+ pip install --upgrade "pip>=25.2"
92
+ ```
93
+
94
+ ### Basic Usage
95
+
96
+ octopi provides two main command-line interfaces:
97
+
98
+ ```bash
99
+ # Main CLI for training, inference, and data processing
100
+ octopi
101
+ ```
102
+
103
+ ## 📚 Documentation
104
+
105
+ For detailed documentation, tutorials, CLI and API reference, visit our [documentation](https://chanzuckerberg.github.io/octopi/).
106
+
107
+ ## 🤝 Contributing
108
+
109
+ ## Code of Conduct
110
+
111
+ This project adheres to the Contributor Covenant [code of conduct](https://github.com/chanzuckerberg/.github/blob/master/CODE_OF_CONDUCT.md).
112
+ By participating, you are expected to uphold this code.
113
+ Please report unacceptable behavior to [opensource@chanzuckerberg.com](mailto:opensource@chanzuckerberg.com).
114
+
115
+ ## 🔒 Security
116
+
117
+ If you believe you have found a security issue, please responsibly disclose by contacting us at security@chanzuckerberg.com.
118
+
119
+
@@ -0,0 +1,65 @@
1
+ octopi/__init__.py,sha256=beQMKMHE1aAGVJf4HlsSe-4jGeqA9VPa94kfg-WgYmM,184
2
+ octopi/main.py,sha256=PFbRc2pK7G0QVkGNY5NUTxoNy2iWa3k08bE_FujwKz8,1285
3
+ octopi/workflows.py,sha256=PBHsxfF30e-ZQCWeExgXrVllM2Jg_spU2vrHRVltkhQ,10846
4
+ octopi/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ octopi/datasets/augment.py,sha256=saS95ThwsknuQQaT0pvLFmNtbGOH_5gqHj8LgU_R8Co,3117
6
+ octopi/datasets/cached_datset.py,sha256=z20Ldfve1nNfLLPNx6nUE2p6i4IXx4V2SHmt99aVN_k,3918
7
+ octopi/datasets/dataset.py,sha256=9C3AuD83FMswj4MYLFn5XPqvAP1a7MQSG7UNiStg090,511
8
+ octopi/datasets/generators.py,sha256=Xolx1CBdwo-86JoSlWGDkmB9Z64u-_RBrT_K6JIfo1A,20155
9
+ octopi/datasets/io.py,sha256=O2dl9i4lRCizu_8CCn41JMX9jH9QKMayjEzvvibAYAU,6987
10
+ octopi/datasets/mixup.py,sha256=BJUAmM7ItZWFChs8glnd8RNSXR5qGW7DHscbcVc3TsU,1575
11
+ octopi/datasets/multi_config_generator.py,sha256=G59VcwrOUP6JfDeZkREsXerea8PSovfsvtc56nEE1ik,10762
12
+ octopi/entry_points/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ octopi/entry_points/common.py,sha256=P9ynM3heJUK9bTa2eXITBem_dNmGnClNrlrIU0Vbz_8,6691
14
+ octopi/entry_points/create_slurm_submission.py,sha256=rW1hr59mLLvKzmHG-uozYvJvTcqnHNZdmy2nMr5EBDc,8914
15
+ octopi/entry_points/groups.py,sha256=vjK_y2PeEyciimmvUKfSx8oAeVuUYCk-yVhXvl98Ky0,5013
16
+ octopi/entry_points/run_create_targets.py,sha256=yVkgt7YvWLq6TtVFiFqLvrpMSKO5GfP5NzBlRyZJNLE,8687
17
+ octopi/entry_points/run_evaluate.py,sha256=fr6LTi8jCeC9OkXWblJMjB83DcHVIPNYp4GWjR-yKhU,4148
18
+ octopi/entry_points/run_extract_mb_picks.py,sha256=lzBMNyoYTQMACs6RnbhM8KsD9rodqhWKA3wvuMcqxdM,7071
19
+ octopi/entry_points/run_extract_midpoint.py,sha256=O6GdkSD7oXIpSVqizOc6PHhv9nunz3j0RucmYQ2yryM,5742
20
+ octopi/entry_points/run_localize.py,sha256=nxkzrTUnZrPRIbev_Rrv5GlS60ZPlCATJfgzuNrHa7E,6449
21
+ octopi/entry_points/run_optuna.py,sha256=0GFhDi12Gpv9odNtboM2q_G82WDpTkvX1UkpuzB2Gu8,6141
22
+ octopi/entry_points/run_segment.py,sha256=zHD1HopPB8ROEXiovdEX3JNYGbkXcvGdoHkHuJQyRDs,5150
23
+ octopi/entry_points/run_train.py,sha256=RlFZgWyV7vmxm7CTWR3i1e5DM98YxZYltYOuFCmdGLI,7457
24
+ octopi/extract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ octopi/extract/localize.py,sha256=AZDmt1g8NUKQ3vKkiZZpng1qr88idZiGkDyFKTuXcf0,7796
26
+ octopi/extract/membranebound_extract.py,sha256=kTV_QFBbvzd3STJsC55QKoRTYcvg_raV3C757Y_9HBo,11087
27
+ octopi/extract/midpoint_extract.py,sha256=iEUZJShlhBC5qAdP5w-zjjEOMz_nu9JZF6jhbJvcV94,7036
28
+ octopi/models/AttentionUnet.py,sha256=r185aXRtfXhN-n8FxA-Sjz18nqpxHH_2t2uadrH-Mgs,1991
29
+ octopi/models/MedNeXt.py,sha256=9q0FsyrqTx211hCbDv0Lm2XflzXL_bGA4-76BscziGk,4875
30
+ octopi/models/ModelTemplate.py,sha256=X80EOXwSovCjmVb7x-0_JmRjHfDfLByDdd60MrgFTyw,1084
31
+ octopi/models/SegResNet.py,sha256=1dK8dy_7hHHKYZLsTYafl__7MxQOlWGbBqQWPGxHSXg,3609
32
+ octopi/models/Unet.py,sha256=7RGT_nl7ogsNlS3Y3Qexe305Ym9NlK9CV0y45g2DEU4,2171
33
+ octopi/models/UnetPlusPlus.py,sha256=fnV-SvJV8B432KJXQAtdwLy8Va6DJ4fRB_7a1mZiqTU,1529
34
+ octopi/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ octopi/models/common.py,sha256=TfxO7RZ-YzZ8vX9cwrxkboiF89rfCC-NoyePJGo1cS0,2587
36
+ octopi/processing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ octopi/processing/create_targets_from_picks.py,sha256=N0adnmbSWuTV6yLPKRPxw6guo08OPWdxSp4Dbik-tfE,8843
38
+ octopi/processing/downloader.py,sha256=YF9EbQ9xH0KI05daylFoJWRunEOjiPXksW6_sfsPMtg,5515
39
+ octopi/processing/downsample.py,sha256=u3V2HULdKTLEthzI-MqJmI-NqpiyX0Vg61i77-j2MKQ,5392
40
+ octopi/processing/evaluate.py,sha256=Xxx8hJrWzZ_pSxEs89CC_6AxGUch3_RSHpH7UtEBs1c,14139
41
+ octopi/processing/importers.py,sha256=o-GdWHJa1D2NT8D34K62quq306eGjtaegHkq9-Gbgks,4501
42
+ octopi/processing/segmentation_from_picks.py,sha256=jah1gAXEn09LIok1Cb8IeVN-fT3jktcVPfjbOFHkgg0,7089
43
+ octopi/pytorch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
+ octopi/pytorch/hyper_search.py,sha256=nPW2z-GRKvLtQ1yxgTbQ_X8rMjMZpvKpf9mS2wj5seU,9683
45
+ octopi/pytorch/model_search_submitter.py,sha256=26nfZTK6mYvYHZKzT-dLX_nZCPTAh2WqhQSeTGSIvNY,11432
46
+ octopi/pytorch/segmentation.py,sha256=C_pv-ZeknhGV29D4Yw5tHeu2B9GW2TJGJtm8R7HUvYE,14343
47
+ octopi/pytorch/segmentation_multigpu.py,sha256=KK8BZIdB1PJBs_jCv7WBS0xORR_XlpcKmmPf3AgIfYY,6781
48
+ octopi/pytorch/trainer.py,sha256=jNqr2HBBM4WFa90LOloh9BEglfXecAn2DBSZ6HKr8Gs,18775
49
+ octopi/pytorch_lightning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
+ octopi/pytorch_lightning/optuna_pl_ddp.py,sha256=ynD5i81IP-awr6OD9GDurjrQK-5Kc079qPaukphTHnA,11924
51
+ octopi/pytorch_lightning/train_pl.py,sha256=igOHzU_mUdZRQGhoOGW5vmxJcHFcw5fAPHfVCIZ0eG4,10220
52
+ octopi/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
+ octopi/utils/config.py,sha256=RLrHmyjnQ0tXX2_bls--ZecbgRTNlnGtkvLl7YWtYtc,1833
54
+ octopi/utils/io.py,sha256=5qRgIDYJXHUz9OJ-a_PZZpe15Q1SobpzTQZRziEv5V8,8145
55
+ octopi/utils/losses.py,sha256=fs9yR80Hs-hL07WgVMkRy5N81vzP5m9XBCvzO76bIPU,3097
56
+ octopi/utils/parsers.py,sha256=strDggVL5Mvh4bChBeRiP10Vu0gfN6s1dSU_5NqF1kg,5657
57
+ octopi/utils/progress.py,sha256=nRFXOBjoYxUufBQl8Z9fuclneYPLkktz4U6Ab5WXNaA,2171
58
+ octopi/utils/stopping_criteria.py,sha256=meX-RTDJUaeVULNePb1y6huIxFHf7jTkyNqNZFBae4s,6112
59
+ octopi/utils/submit_slurm.py,sha256=cRbJTESbPFCt6Cq4Hat2uPOQKFYMPcQxuNs0jc1ygUA,1945
60
+ octopi/utils/visualization_tools.py,sha256=rSuqw13ooVPHuEZ4AALcSbko_2_mDOTNIm1vghlX9xU,10635
61
+ octopi-1.4.0.dist-info/METADATA,sha256=8zOTRFu47Y1264_pOOvKli3ic09hSg_m4-15I_FdFZA,5073
62
+ octopi-1.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
63
+ octopi-1.4.0.dist-info/entry_points.txt,sha256=wDIFjSaHaWHi9gm1uNhYEO1LS3VrtxVk-3HX9_lHhY4,90
64
+ octopi-1.4.0.dist-info/licenses/LICENSE,sha256=DRoLUEjEHgru_AwKHhii9UIOt6QA65am4WQd7UFzqnE,1822
65
+ octopi-1.4.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ octopi = octopi.main:routines
3
+ octopi-slurm = octopi.main:slurm_routines
@@ -0,0 +1,41 @@
1
+ # Legal
2
+
3
+ ## License for the octopi package
4
+
5
+ This package is licensed under the MIT License:
6
+
7
+ ```
8
+ MIT License
9
+
10
+ Copyright (c) 2025 Chan Zuckerberg Initiative
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the "Software".
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE "SOFTWARE" OR THE USE OR OTHER DEALINGS IN THE
28
+ "SOFTWARE".
29
+ ```
30
+
31
+ ## License Notice for Dependencies
32
+
33
+ ```
34
+ This repository is licensed under the MIT License; however, it relies on certain third-party dependencies that are licensed under the GNU General Public License (GPL). Specifically:
35
+
36
+ - monai is licensed under the Apache License 2.0.
37
+ - pytorch-lightning is licensed under the Apache License 2.0.
38
+
39
+ All dependencies use permissive open-source licenses that are compatible with this project's MIT License. No GPL or other copyleft licensed dependencies are included.
40
+ For specific licensing information about any dependency, please refer to the respective package documentation or repository.
41
+ ```