Skip to content

Commit 8783ce1

Browse files
updating available model names (#952)
1 parent 8bc3f62 commit 8783ce1

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

cellpose/core.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,14 @@ def _run_tiled(net, imgi, batch_size=8, augment=False, bsize=224, tile_overlap=0
334334
IMG = np.reshape(IMG, (ny * nx, nchan, ly, lx))
335335
niter = int(np.ceil(IMG.shape[0] / batch_size))
336336
y = np.zeros((IMG.shape[0], nout, ly, lx))
337-
for k in range(niter):
337+
iterator = (trange(niter, file=tqdm_out, mininterval=30)
338+
if niter > 25 else range(niter))
339+
for k in iterator:
338340
irange = slice(batch_size * k, min(IMG.shape[0],
339341
batch_size * k + batch_size))
340342
y0, style = _forward(net, IMG[irange])
341343
y[irange] = y0.reshape(irange.stop - irange.start, y0.shape[-3],
342344
y0.shape[-2], y0.shape[-1])
343-
# check size models!
344345
if k == 0:
345346
styles = style.sum(axis=0)
346347
else:

docs/faq.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FAQ
22
~~~~~~~~~~~~~~~~~~~~~~~~
33

4-
**Q: What should I set the** ``--flow_threshold``/``--cell_prob``/``--diam`` **parameter to?**
4+
**Q: What should I set the** ``--flow_threshold``/``--cellprob_threshold``/``--diameter`` **parameter to?**
55

66
These parameters should be set experimentally by running Cellpose, viewing the results, and tuning the parameters
77
to get the best results. The default parameters are set to work well for most images, but may not be optimal

docs/models.rst

+18-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ Set channels to a list with each of these elements, e.g.
4848
``channels = [0,0]`` if you want to segment cells in grayscale or for single channel images, or
4949
``channels = [2,3]`` if you green cells with blue nuclei.
5050

51-
The `'cyto3'` model is trained on 9 datasets, see the Cellpose3 paper for more details.
51+
The `'cyto3'` model is trained on 9 datasets, see the `Cellpose3 paper <https://www.biorxiv.org/content/10.1101/2024.02.10.579780v2>`_
52+
for more details.
53+
54+
These models are downloadable from the website with MODEL_NAME: ``cytotorch_0``, ``cyto2torch_0``, and ``cyto3``.
55+
The size models are ``size_cytotorch_0.npy``, ``size_cyto2torch_0.npy``, and ``size_cyto3.npy``.
5256

5357
Nucleus model (`'nuclei'`)
5458
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,6 +64,9 @@ always set to an array of zeros. Therefore set the first channel as
6064
``channels = [0,0]`` if you want to segment nuclei in grayscale or for single channel images, or
6165
``channels = [3,0]`` if you want to segment blue nuclei.
6266

67+
The `'nuclei'` model is downloadable from the website with MODEL_NAME ``nucleitorch_0``,
68+
and size model ``size_nucleitorch_0.npy``.
69+
6370
Other built-in models
6471
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6572

@@ -72,7 +79,7 @@ These models can be loaded and used in the notebook with e.g.
7279
``models.CellposeModel(model_type='tissuenet_cp3')`` or ``models.CellposeModel(model_type='livecell_cp3')``,
7380
or in the command line with ``python -m cellpose --pretrained_model tissuenet_cp3``.
7481

75-
The dataset-specific models were trained on the training images provided in the following datasets:
82+
The dataset-specific models were trained on the training images from the following datasets:
7683
- ``tissuenet_cp3``: `tissuenet dataset <https://datasets.deepcell.org/>`_.
7784
- ``livecell_cp3``: `livecell dataset <https://sartorius-research.github.io/LIVECell/>`_
7885
- ``yeast_PhC_cp3``: `YEAZ dataset <https://www.epfl.ch/labs/lpbs/data-and-software/>`_
@@ -82,6 +89,15 @@ The dataset-specific models were trained on the training images provided in the
8289
- ``deepbacs_cp3``: `deepbacs dataset <https://github.com/HenriquesLab/DeepBacs/wiki/Segmentation>`_
8390
- ``cyto2_cp3``: `cellpose dataset <http://www.cellpose.org/dataset>`_
8491

92+
There are also legacy models which remain on the website with MODEL_NAME:
93+
- Cellpose2 style-specific models: ``CP``, ``CPx``, ``TN1``, ``TN2``, ``TN3``, ``LC1``, ``LC2``, ``LC3``, ``LC4``, ``style_choice.npy``.
94+
- Cellpose2 general models: ``tissuenet``, ``livecell``, ``general``.
95+
- Cellpose1 mxnet models: ``cyto_0``, ``nuclei_0``, ``size_cyto_0.npy``, ``size_nuclei_0.npy``.
96+
97+
We see no improvement with transformer models in the Cellpose3 paper and the
98+
`Neurips challenge response <https://www.biorxiv.org/content/10.1101/2024.04.06.587952v1>`_,
99+
but the models are available as ``transformer_cp3`` and ``neurips_cellpose_transformer``. These model take three channels as input.
100+
The u-net based Neurips challenge model is available as ``neurips_cellpose_default`` and also takes three channels as input.
85101

86102
User-trained models
87103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/restore.rst

+12-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@
33
Image Restoration
44
=================
55

6+
We introduce image restoration in the `Cellpose3 paper <https://www.biorxiv.org/content/10.1101/2024.02.10.579780v2>`_.
67
The image restoration module ``denoise`` provides functions for restoring degraded images.
78
There are two main classes, ``DenoiseModel`` for image restoration only, and
89
``CellposeDenoiseModel`` for image restoration and then segmentation. There are four types
9-
of image restoration provided, denoising, deblurring, upsampling and one-click (trained on
10-
all degradation types), and for each of these
11-
there are three models, one trained on the full ``cyto3`` training set, one trained on the
12-
``cyto2`` training set, and one trained on the ``nuclei`` training set:
10+
of image restoration provided: denoising, deblurring, upsampling and one-click (trained on
11+
all degradation types). For each of these
12+
there are three models: one trained on the full ``cyto3`` training set, one trained on the
13+
``cyto2`` training set, and one trained on the ``nuclei`` training set. Each of these
14+
models are available on the website as ``https://www.cellpose.org/models/MODEL_NAME``, or will be
15+
automatically downloaded when you first run the model in the notebook, CLI or GUI:
1316
``'denoise_cyto3'``, ``'deblur_cyto3'``, ``'upsample_cyto3'``, ``'oneclick_cyto3'``,
1417
``'denoise_cyto2'``, ``'deblur_cyto2'``, ``'upsample_cyto2'``, ``'oneclick_cyto2'``,
1518
``'denoise_nuclei'``, ``'deblur_nuclei'``, ``'upsample_nuclei'``, ``'oneclick_nuclei'``.
1619

20+
Each of the models above were trained with the segmentation loss and perceptual loss. We also make available
21+
the models trained with different loss functions for verifying the results of the paper,
22+
e.g. ``'denoise_rec_cyto2'`` is the denoising model trained with the reconstruction loss function
23+
on the ``cyto2`` training set.
24+
1725
DenoiseModel
1826
--------------
1927

0 commit comments

Comments
 (0)