Skip to content
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

Add cellpose[gui] as a main dependency #5

Merged
merged 8 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ license = { text = "BSD 3-Clause License" }
authors = [
{ email = "[email protected]", name = "Jeff Rhoades" },
]
version = "0.0.0"
version = "0.0.1"
dependencies = [
'torch',
'torchvision',
'numpy',
"tqdm",
'tqdm',
'cellpose'
]

[project.optional-dependencies]
Expand All @@ -32,8 +33,9 @@ dev = [
'mypy',
'pdoc',
'pre-commit',
'cellpose[gui]'
]
pretrained = ['cellpose[gui]']
all = ["cellmap-models[dev,pretrained]"]

[project.urls]
homepage = "https://janelia-cellmap.github.io/cellmap-models"
Expand Down
4 changes: 2 additions & 2 deletions src/cellmap_models/pytorch/cosem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions src/cellmap_models/pytorch/cosem/load_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
"""
Expand Down
Loading