Skip to content

Commit

Permalink
updating available model names (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Sep 13, 2024
1 parent 8bc3f62 commit 8783ce1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
5 changes: 3 additions & 2 deletions cellpose/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,14 @@ def _run_tiled(net, imgi, batch_size=8, augment=False, bsize=224, tile_overlap=0
IMG = np.reshape(IMG, (ny * nx, nchan, ly, lx))
niter = int(np.ceil(IMG.shape[0] / batch_size))
y = np.zeros((IMG.shape[0], nout, ly, lx))
for k in range(niter):
iterator = (trange(niter, file=tqdm_out, mininterval=30)
if niter > 25 else range(niter))
for k in iterator:
irange = slice(batch_size * k, min(IMG.shape[0],
batch_size * k + batch_size))
y0, style = _forward(net, IMG[irange])
y[irange] = y0.reshape(irange.stop - irange.start, y0.shape[-3],
y0.shape[-2], y0.shape[-1])
# check size models!
if k == 0:
styles = style.sum(axis=0)
else:
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FAQ
~~~~~~~~~~~~~~~~~~~~~~~~

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

These parameters should be set experimentally by running Cellpose, viewing the results, and tuning the parameters
to get the best results. The default parameters are set to work well for most images, but may not be optimal
Expand Down
20 changes: 18 additions & 2 deletions docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ Set channels to a list with each of these elements, e.g.
``channels = [0,0]`` if you want to segment cells in grayscale or for single channel images, or
``channels = [2,3]`` if you green cells with blue nuclei.

The `'cyto3'` model is trained on 9 datasets, see the Cellpose3 paper for more details.
The `'cyto3'` model is trained on 9 datasets, see the `Cellpose3 paper <https://www.biorxiv.org/content/10.1101/2024.02.10.579780v2>`_
for more details.

These models are downloadable from the website with MODEL_NAME: ``cytotorch_0``, ``cyto2torch_0``, and ``cyto3``.
The size models are ``size_cytotorch_0.npy``, ``size_cyto2torch_0.npy``, and ``size_cyto3.npy``.

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

The `'nuclei'` model is downloadable from the website with MODEL_NAME ``nucleitorch_0``,
and size model ``size_nucleitorch_0.npy``.

Other built-in models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

There are also legacy models which remain on the website with MODEL_NAME:
- Cellpose2 style-specific models: ``CP``, ``CPx``, ``TN1``, ``TN2``, ``TN3``, ``LC1``, ``LC2``, ``LC3``, ``LC4``, ``style_choice.npy``.
- Cellpose2 general models: ``tissuenet``, ``livecell``, ``general``.
- Cellpose1 mxnet models: ``cyto_0``, ``nuclei_0``, ``size_cyto_0.npy``, ``size_nuclei_0.npy``.

We see no improvement with transformer models in the Cellpose3 paper and the
`Neurips challenge response <https://www.biorxiv.org/content/10.1101/2024.04.06.587952v1>`_,
but the models are available as ``transformer_cp3`` and ``neurips_cellpose_transformer``. These model take three channels as input.
The u-net based Neurips challenge model is available as ``neurips_cellpose_default`` and also takes three channels as input.

User-trained models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
16 changes: 12 additions & 4 deletions docs/restore.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
Image Restoration
=================

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

Each of the models above were trained with the segmentation loss and perceptual loss. We also make available
the models trained with different loss functions for verifying the results of the paper,
e.g. ``'denoise_rec_cyto2'`` is the denoising model trained with the reconstruction loss function
on the ``cyto2`` training set.

DenoiseModel
--------------

Expand Down

0 comments on commit 8783ce1

Please sign in to comment.