Skip to content

Commit

Permalink
Admin/cleanup instance segmentation (#299)
Browse files Browse the repository at this point in the history
* remove omnipose

* rename skoots -> instanceseg

* cleanup comments

* add astropy and edt

* fix geomloss import

* pre-commit

* format

* pin lightning and astropy

---------

Co-authored-by: Benjamin Morris <[email protected]>
  • Loading branch information
benjijamorris and Benjamin Morris authored Oct 19, 2023
1 parent e5c64e9 commit 7e7e8ae
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 784 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ sync-reqs-files: requirements/$(PLATFORM)/requirements.txt \
requirements/$(PLATFORM)/torchserve-requirements.txt \
requirements/$(PLATFORM)/equiv-requirements.txt \
requirements/$(PLATFORM)/spharm-requirements.txt \
requirements/$(PLATFORM)/omnipose-requirements.txt \
requirements/$(PLATFORM)/all-requirements.txt \
requirements/$(PLATFORM)/test-requirements.txt \
requirements/$(PLATFORM)/docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ transforms:
- _target_: monai.transforms.Zoomd
keys: ${data.columns}
zoom: 0.25
- _target_: cyto_dl.models.im2im.utils.SkootsPreprocessd
- _target_: cyto_dl.models.im2im.utils.InstanceSegPreprocessd
label_keys: ${target_col}
dim: ${spatial_dims}
- _target_: monai.transforms.ToTensord
Expand Down Expand Up @@ -86,7 +86,7 @@ transforms:
- _target_: monai.transforms.Zoomd
keys: ${data.columns}
zoom: 0.25
- _target_: cyto_dl.models.im2im.utils.SkootsPreprocessd
- _target_: cyto_dl.models.im2im.utils.InstanceSegPreprocessd
label_keys: ${target_col}
dim: ${spatial_dims}
- _target_: monai.transforms.ToTensord
Expand Down Expand Up @@ -141,7 +141,7 @@ transforms:
- _target_: monai.transforms.Zoomd
keys: ${data.columns}
zoom: 0.25
- _target_: cyto_dl.models.im2im.utils.SkootsPreprocessd
- _target_: cyto_dl.models.im2im.utils.InstanceSegPreprocessd
label_keys: ${target_col}
dim: ${spatial_dims}
- _target_: monai.transforms.ToTensord
Expand Down
163 changes: 0 additions & 163 deletions configs/data/im2im/omnipose.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# python train.py experiment=example

defaults:
- override /data: im2im/omnipose.yaml
- override /model: im2im/omnipose.yaml
- override /data: im2im/instance_seg.yaml
- override /model: im2im/instance_seg.yaml
- override /callbacks: default.yaml
- override /trainer: gpu.yaml
- override /logger: mlflow.yaml
Expand All @@ -30,6 +30,5 @@ data:
path: ${paths.data_dir}/example_experiment_data/segmentation
cache_dir: ${paths.data_dir}/example_experiment_data/cache
batch_size: 1

_aux:
patch_shape: [16, 32, 32]
36 changes: 0 additions & 36 deletions configs/experiment/im2im/skoots.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ _aux:
- - ${target_col}
- _target_: cyto_dl.nn.BaseHead
loss:
_target_: cyto_dl.models.im2im.utils.SkootsLoss
_target_: cyto_dl.models.im2im.utils.InstanceSegLoss
dim: ${spatial_dims}
save_raw: True
postprocess:
Expand Down
51 changes: 0 additions & 51 deletions configs/model/im2im/omnipose.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions configs/model/test/omnipose.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions configs/trainer/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ max_epochs: 10

accelerator: cpu
devices: 1

# mixed precision for extra speed-up
# precision: 16
precision: 16

# perform a validation loop every N training epochs
check_val_every_n_epoch: 1
Expand Down
1 change: 0 additions & 1 deletion configs/trainer/gpu.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
defaults:
- default.yaml
precision: 16
accelerator: gpu
devices: 1
19 changes: 8 additions & 11 deletions cyto_dl/models/im2im/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
try:
from .omnipose import OmniposeClustering, OmniposeLoss, OmniposePreprocessd
from .instance_seg import (
InstanceSegCluster,
InstanceSegLoss,
InstanceSegPreprocessd,
)
except (ModuleNotFoundError, ImportError):
OmniposeClustering = None
OmniposeLoss = None
OmniposePreprocessd = None

try:
from .skoots import SkootsCluster, SkootsLoss, SkootsPreprocessd
except (ModuleNotFoundError, ImportError):
SkootsCluster = None
SkootsLoss = None
SkootsPreprocessd = None
InstanceSegCluster = None
InstanceSegLoss = None
InstanceSegPreprocessd = None

from .postprocessing import ActThreshLabel, DictToIm, detach
Loading

0 comments on commit 7e7e8ae

Please sign in to comment.