From f04782cb54dbf56a681c7244b1d9bb222d7c9891 Mon Sep 17 00:00:00 2001 From: rhoadesScholar Date: Thu, 14 Mar 2024 10:58:06 -0400 Subject: [PATCH 1/6] Add cellpose[gui] as a main dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0f4e0d7..a93d166 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ dependencies = [ 'torchvision', 'numpy', "tqdm", + 'cellpose[gui]' ] [project.optional-dependencies] @@ -32,7 +33,6 @@ dev = [ 'mypy', 'pdoc', 'pre-commit', - 'cellpose[gui]' ] [project.urls] From 95ea92afb8faaf6f176dd21da3658aa395890992 Mon Sep 17 00:00:00 2001 From: rhoadesScholar Date: Mon, 18 Mar 2024 11:14:27 -0400 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E2=9A=A1=EF=B8=8F=20Generalize=20m?= =?UTF-8?q?odel=20definitions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- src/cellmap_models/pytorch/cosem/README.md | 4 ++-- src/cellmap_models/pytorch/cosem/load_model.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 727505d..b54ae4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ license = { text = "BSD 3-Clause License" } authors = [ { email = "rhoadesj@hhmi.org", name = "Jeff Rhoades" }, ] -version = "0.0.0" +version = "0.0.1" dependencies = [ 'torch', 'torchvision', diff --git a/src/cellmap_models/pytorch/cosem/README.md b/src/cellmap_models/pytorch/cosem/README.md index 8ff020b..ef9c8e3 100755 --- a/src/cellmap_models/pytorch/cosem/README.md +++ b/src/cellmap_models/pytorch/cosem/README.md @@ -20,12 +20,12 @@ Available models can be seen with the following code: cosem_models.models_list ``` -Each model has a separate unet backbone and single layer prediction head. The `unet` and `head` objects are both PyTorch modules and can be used as such. You can access the separate components of the model using the following code: +Each model has a separate backbone and single layer prediction head. The `backbone` and `head` objects are both PyTorch modules and can be used as such. You can access the separate components of the model using the following code: ```python import cellmap_models.cosem as cosem_models model = cosem_models.load_model('setup04/1820500') -unet = model.unet +backnone = model.backbone head = model.prediction_head ``` diff --git a/src/cellmap_models/pytorch/cosem/load_model.py b/src/cellmap_models/pytorch/cosem/load_model.py index 6be1fe9..5d0c8b6 100755 --- a/src/cellmap_models/pytorch/cosem/load_model.py +++ b/src/cellmap_models/pytorch/cosem/load_model.py @@ -127,7 +127,7 @@ def __init__(self, model_params): kernel_size=(1,) * 3, ) model = torch.nn.Sequential(*layers) - self.unet = model + self.backbone = model self.prediction_head = prediction_head for k, v in model_params.__dict__.items(): setattr(self, k, v) @@ -136,7 +136,7 @@ def __init__(self, model_params): self.compute_minimal_shapes() def forward(self, x): - return self.prediction_head(self.unet(x)) + return self.prediction_head(self.backbone(x)) def compute_minimal_shapes(self): """ From 07e06b2e082e1f5193a58d1f9b3bb2127c36a0ea Mon Sep 17 00:00:00 2001 From: Jeff Rhoades <37990507+rhoadesScholar@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:43:46 -0400 Subject: [PATCH 3/6] Update pyproject.toml --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b54ae4e..ce2d27e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,8 @@ dependencies = [ 'torch', 'torchvision', 'numpy', - "tqdm", - 'cellpose[gui]' + 'tqdm', + 'cellpose' ] [project.optional-dependencies] @@ -34,6 +34,8 @@ dev = [ 'pdoc', 'pre-commit', ] +pretrained = ['cellpose[gui]'] +all = ["cellmap-models[dev,pretrained]"] [project.urls] homepage = "https://janelia-cellmap.github.io/cellmap-models" From 0412461b3d850f1887bc9dfe7530173db8a9d711 Mon Sep 17 00:00:00 2001 From: Jeff Rhoades <37990507+rhoadesScholar@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:50:59 -0400 Subject: [PATCH 4/6] Update python-publish.yml --- .github/workflows/python-publish.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index a04c287..2dca966 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -9,8 +9,10 @@ name: Upload Python Package on: - release: - types: [published] + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] permissions: contents: read From dbe1f8b930e08e6fa5525405e1637a1eac954fd8 Mon Sep 17 00:00:00 2001 From: Jeff Rhoades <37990507+rhoadesScholar@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:53:43 -0400 Subject: [PATCH 5/6] Update python-publish.yml --- .github/workflows/python-publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 2dca966..191de5c 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -11,8 +11,6 @@ name: Upload Python Package on: push: branches: [ "main" ] - pull_request: - branches: [ "main" ] permissions: contents: read From 9839555085ebb0bdfb0576c5f0176ffcf712d643 Mon Sep 17 00:00:00 2001 From: rhoadesScholar Date: Mon, 18 Mar 2024 14:19:40 -0400 Subject: [PATCH 6/6] Update README docs --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 6eec80e..c1fdbe5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,4 +5,4 @@ - \ No newline at end of file + \ No newline at end of file