|
1 | 1 | Models |
2 | | ------------------------------- |
| 2 | +------------------------------- |
3 | 3 |
|
4 | 4 | ``from cellpose import models`` |
5 | 5 |
|
6 | | -Each model will be downloaded automatically to your ``models.MODELS_DIR`` |
7 | | -(see Installation instructions for more details on MODELS_DIR). |
8 | | -You can also directly download a model by going to the URL, e.g.: |
| 6 | +Each model will be downloaded automatically to your ``models.MODELS_DIR`` (see |
| 7 | +Installation instructions for more details on MODELS_DIR). You can also directly |
| 8 | +download a model by going to the URL, e.g.: |
9 | 9 |
|
10 | 10 | ``https://www.cellpose.org/models/MODEL_NAME`` |
11 | 11 |
|
12 | 12 | All built-in models were trained with the ROIs resized to a diameter of 30.0 |
13 | | -(``diam_mean = 30``), |
14 | | -except the `'nuclei'` model which was trained with a diameter of 17.0 |
15 | | -(``diam_mean = 17``). User-trained models will be trained with the same ``diam_mean`` |
16 | | -as the model they are initalized with. |
17 | | -The models will internally take care of rescaling the images given a |
18 | | -user-provided diameter (or with the diameter from |
19 | | -auto-diameter estimation in full models). |
| 13 | +(``diam_mean = 30``), except the `'nuclei'` model which was trained with a |
| 14 | +diameter of 17.0 (``diam_mean = 17``). User-trained models will be trained with |
| 15 | +the same ``diam_mean`` as the model they are initalized with. The models will |
| 16 | +internally take care of rescaling the images given a user-provided diameter (or |
| 17 | +with the diameter from auto-diameter estimation in full models). |
20 | 18 |
|
21 | 19 | Full built-in models |
22 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 20 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
23 | 21 |
|
24 | 22 | These models have Cellpose model weights and a size model. This means you can |
25 | | -run with ``diameter=0`` or ``--diameter 0`` and the model can estimate the ROI size. |
26 | | -However, we recommend that you set the diameter for your ROIs rather than having Cellpose |
27 | | -guess the diameter. |
| 23 | +run with ``diameter=0`` or ``--diameter 0`` and the model can estimate the ROI |
| 24 | +size. However, we recommend that you set the diameter for your ROIs rather than |
| 25 | +having Cellpose guess the diameter. |
28 | 26 |
|
29 | | -These models can be loaded and used in the notebook with ``models.Cellpose(model_type='cyto3')`` |
30 | | -or in the command line with ``python -m cellpose --pretrained_model cyto3``. |
| 27 | +These models can be loaded and used in the notebook with |
| 28 | +``models.Cellpose(model_type='cyto3')`` or in the command line with ``python -m |
| 29 | +cellpose --pretrained_model cyto3``. |
31 | 30 |
|
32 | | -We have a ``nuclei`` model and a super-generalist ``cyto3`` model. There are also two |
33 | | -older models, ``cyto``, which is trained on only the Cellpose training set, and ``cyto2``, |
34 | | -which is also trained on user-submitted images. |
| 31 | +We have a ``nuclei`` model and a super-generalist ``cyto3`` model. There are |
| 32 | +also two older models, ``cyto``, which is trained on only the Cellpose training |
| 33 | +set, and ``cyto2``, which is also trained on user-submitted images. |
35 | 34 |
|
36 | | -FYI we are no longer using the 4 different versions and ``--net_avg`` is deprecated. |
| 35 | +FYI we are no longer using the 4 different versions and ``--net_avg`` is |
| 36 | +deprecated. |
37 | 37 |
|
38 | 38 | Cytoplasm model (``'cyto3'``, ``'cyto2'``, ``'cyto'``) |
39 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 39 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
40 | 40 |
|
41 | | -The cytoplasm models in cellpose are trained on two-channel images, where |
42 | | -the first channel is the channel to segment, and the second channel is |
43 | | -an optional nuclear channel. Here are the options for each: |
44 | | -1. 0=grayscale, 1=red, 2=green, 3=blue |
45 | | -2. 0=None (will set to zero), 1=red, 2=green, 3=blue |
| 41 | +The cytoplasm models in cellpose are trained on two-channel images, where the |
| 42 | +first channel is the channel to segment, and the second channel is an optional |
| 43 | +nuclear channel. Here are the options for each: 1. 0=grayscale, 1=red, 2=green, |
| 44 | +3=blue 2. 0=None (will set to zero), 1=red, 2=green, 3=blue |
46 | 45 |
|
47 | | -Set channels to a list with each of these elements, e.g. |
48 | | -``channels = [0,0]`` if you want to segment cells in grayscale or for single channel images, or |
| 46 | +Set channels to a list with each of these elements, e.g. ``channels = [0,0]`` if |
| 47 | +you want to segment cells in grayscale or for single channel images, or |
49 | 48 | ``channels = [2,3]`` if you green cells with blue nuclei. |
50 | 49 |
|
51 | | -The `'cyto3'` model is trained on 9 datasets, see the Cellpose3 paper for more details. |
| 50 | +The `'cyto3'` model is trained on 9 datasets, see the Cellpose3 paper for more |
| 51 | +details. |
52 | 52 |
|
53 | 53 | Nucleus model (`'nuclei'`) |
54 | 54 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
55 | 55 |
|
56 | | -The nuclear model in cellpose is trained on two-channel images, where |
57 | | -the first channel is the channel to segment, and the second channel is |
58 | | -always set to an array of zeros. Therefore set the first channel as |
59 | | -0=grayscale, 1=red, 2=green, 3=blue; and set the second channel to zero, e.g. |
60 | | -``channels = [0,0]`` if you want to segment nuclei in grayscale or for single channel images, or |
61 | | -``channels = [3,0]`` if you want to segment blue nuclei. |
| 56 | +The nuclear model in cellpose is trained on two-channel images, where the first |
| 57 | +channel is the channel to segment, and the second channel is always set to an |
| 58 | +array of zeros. Therefore set the first channel as 0=grayscale, 1=red, 2=green, |
| 59 | +3=blue; and set the second channel to zero, e.g. ``channels = [0,0]`` if you |
| 60 | +want to segment nuclei in grayscale or for single channel images, or ``channels |
| 61 | += [3,0]`` if you want to segment blue nuclei. |
62 | 62 |
|
63 | 63 | Other built-in models |
64 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 64 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
65 | 65 |
|
66 | | -The main built-in models are dataset-specific models trained on one of the 9 datasets |
67 | | -in the Cellpose3 paper. These models do not have a size model. |
68 | | -If the diameter is set to 0.0, then the model uses the default ``diam_mean`` for the |
| 66 | +The main built-in models are dataset-specific models trained on one of the 9 |
| 67 | +datasets in the Cellpose3 paper. These models do not have a size model. If the |
| 68 | +diameter is set to 0.0, then the model uses the default ``diam_mean`` for the |
69 | 69 | diameter (``30.0``). |
70 | 70 |
|
71 | 71 | These models can be loaded and used in the notebook with e.g. |
72 | | -``models.CellposeModel(model_type='tissuenet_cp3')`` or ``models.CellposeModel(model_type='livecell_cp3')``, |
73 | | -or in the command line with ``python -m cellpose --pretrained_model tissuenet_cp3``. |
74 | | - |
75 | | -The dataset-specific models were trained on the training images provided in the following datasets: |
76 | | - - ``tissuenet_cp3``: `tissuenet dataset <https://datasets.deepcell.org/>`_. |
77 | | - - ``livecell_cp3``: `livecell dataset <https://sartorius-research.github.io/LIVECell/>`_ |
78 | | - - ``yeast_PhC_cp3``: `YEAZ dataset <https://www.epfl.ch/labs/lpbs/data-and-software/>`_ |
79 | | - - ``yeast_BF_cp3``: `YEAZ dataset <https://www.epfl.ch/labs/lpbs/data-and-software/>`_ |
80 | | - - ``bact_phase_cp3``: `omnipose dataset <https://osf.io/xmury/>`_ |
81 | | - - ``bact_fluor_cp3``: `omnipose dataset <https://osf.io/xmury/>`_ |
82 | | - - ``deepbacs_cp3``: `deepbacs dataset <https://github.com/HenriquesLab/DeepBacs/wiki/Segmentation>`_ |
83 | | - - ``cyto2_cp3``: `cellpose dataset <http://www.cellpose.org/dataset>`_ |
| 72 | +``models.CellposeModel(model_type='tissuenet_cp3')`` or |
| 73 | +``models.CellposeModel(model_type='livecell_cp3')``, or in the command line with |
| 74 | +``python -m cellpose --pretrained_model tissuenet_cp3``. |
| 75 | + |
| 76 | +The dataset-specific models were trained on the training images provided in the |
| 77 | +following datasets: |
| 78 | + |
| 79 | +- ``tissuenet_cp3``: `tissuenet dataset <https://datasets.deepcell.org/>`_. |
| 80 | +- ``livecell_cp3``: `livecell dataset <https://sartorius-research.github.io/LIVECell/>`_ |
| 81 | +- ``yeast_PhC_cp3``: `YEAZ dataset <https://www.epfl.ch/labs/lpbs/data-and-software/>`_ |
| 82 | +- ``yeast_BF_cp3``: `YEAZ dataset <https://www.epfl.ch/labs/lpbs/data-and-software/>`_ |
| 83 | +- ``bact_phase_cp3``: `omnipose dataset <https://osf.io/xmury/>`_ |
| 84 | +- ``bact_fluor_cp3``: `omnipose dataset <https://osf.io/xmury/>`_ |
| 85 | +- ``deepbacs_cp3``: `deepbacs dataset <https://github.com/HenriquesLab/DeepBacs/wiki/Segmentation>`_ |
| 86 | +- ``cyto2_cp3``: `cellpose dataset <http://www.cellpose.org/dataset>`_ |
84 | 87 |
|
85 | 88 |
|
86 | 89 | User-trained models |
|
0 commit comments