Skip to content

Commit 3c2399d

Browse files
2 parents 8cafd51 + d177934 commit 3c2399d

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

doc/installation.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
# Installation
22

3-
We provide three different ways of installing `micro_sam`:
3+
There are three ways to install `micro_sam`:
44
- [From mamba](#from-mamba) is the recommended way if you want to use all functionality.
55
- [From source](#from-source) for setting up a development environment to use the latest version and be able to change and contribute to our software.
6-
- [From installer](#from-installer) to install without having to use conda. This mode of installation is still experimental! It only provides the annotation tools and does not enable model finetuning.
7-
8-
Our software requires the following dependencies:
9-
- [PyTorch](https://pytorch.org/get-started/locally/)
10-
- [SegmentAnything](https://github.com/facebookresearch/segment-anything#installation)
11-
- [elf](https://github.com/constantinpape/elf)
12-
- [torch_em](https://github.com/constantinpape/torch-em)
13-
- [napari](https://napari.org/stable/) (for the interactive annotation tools)
14-
6+
- [From installer](#from-installer) to install without having to use conda (supported platforms: Windows and Linux, only for CPU users).
157

168
## From mamba
179

18-
[mamba](https://mamba.readthedocs.io/en/latest/) is a drop-in replacement for conda, but is much faster than it.
10+
[mamba](https://mamba.readthedocs.io/en/latest/) is a drop-in replacement for conda, but much faster.
1911
While the steps below may also work with `conda`, we highly recommend using `mamba`.
20-
You can follow the instrutions [here](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html) to install `mamba`.
12+
You can follow the instructions [here](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html) to install `mamba`.
13+
14+
**IMPORTANT**: Make sure to avoid installing anything in the base environment.
2115

22-
`micro_sam` can then be installed in an existing environment via
16+
`micro_sam` can be installed in an existing environment via:
2317
```
2418
$ mamba install -c conda-forge micro_sam
2519
```
26-
or you can create a new environment (here called `micro-sam`) via
20+
or you should create a new environment (here called `micro-sam`) via:
2721
```
2822
$ mamba create -c conda-forge -n micro-sam micro_sam
2923
```

micro_sam/training/joint_sam_trainer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ def __init__(
2525
self.instance_loss = instance_loss
2626
self.instance_metric = instance_metric
2727

28-
def save_checkpoint(self, name, best_metric, **extra_save_dict):
28+
def save_checkpoint(self, name, current_metric, best_metric, **extra_save_dict):
2929
current_unetr_state = self.unetr.state_dict()
3030
decoder_state = []
3131
for k, v in current_unetr_state.items():
3232
if not k.startswith("encoder"):
3333
decoder_state.append((k, v))
3434
decoder_state = OrderedDict(decoder_state)
3535

36-
super().save_checkpoint(name, best_metric, decoder_state=decoder_state, **extra_save_dict)
36+
super().save_checkpoint(
37+
name, current_metric=current_metric, best_metric=best_metric, decoder_state=decoder_state, **extra_save_dict
38+
)
3739

3840
def load_checkpoint(self, checkpoint="best"):
3941
save_dict = super().load_checkpoint(checkpoint)

micro_sam/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ def segmentation_to_one_hot(
812812
n_ids = int(segmentation.max())
813813

814814
else:
815-
assert segmentation_ids[0] != 0
815+
assert segmentation_ids[0] != 0, "No objects were found."
816816

817817
# the segmentation ids have to be sorted
818818
segmentation_ids = np.sort(segmentation_ids)

0 commit comments

Comments
 (0)