|
1 | | -Model |
| 1 | +Models |
2 | 2 | ------------------------------- |
3 | 3 |
|
4 | 4 | ``from cellpose import models`` |
5 | 5 |
|
6 | | -The cpsam model weights will be downloaded automatically to your ``models.MODELS_DIR`` (see |
| 6 | +Built-in models |
| 7 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 | + |
| 9 | +We have four built-in models available: |
| 10 | + |
| 11 | +* ``cpdino``: this is the CellposeDINO model released in June 2026 using the DINOv3-ViTL backbone |
| 12 | +* ``cpsam_v2``: this is the CellposeSAM model released in June 2026 using the SAM-ViTL backbone, it includes a fix in the training for low contrast regions |
| 13 | +* ``cpdino-vitb``: this is the CellposeDINO model released in June 2026 using the DINOv3-ViTB backbone (smaller model) |
| 14 | +* ``cpsam``: this is the original CellposeSAM model released in April 2025 using the SAM-ViTL backbone |
| 15 | + |
| 16 | +The DINO-based models use an image tile size of 384x384 by default, but this can be changed through the ``bsize`` parameter, |
| 17 | +e.g. you may want to make ``bsize`` larger if there are very large or long objects in the image. The SAM-based models |
| 18 | +use an image tile size of 256x256 and this cannot be changed - the position embeddings do not support different image sizes. |
| 19 | + |
| 20 | +You can select a model in the GUI in the drop-down, in a notebook with ``models.CellposeModel(pretrained_model='cpdino')``, |
| 21 | +or on the command line with ``python -m cellpose --pretrained_model cpdino``. |
| 22 | + |
| 23 | +The first time that a model is used, the weights will be downloaded automatically to your ``models.MODELS_DIR`` (see |
7 | 24 | Installation instructions for more details on MODELS_DIR). You can also directly |
8 | 25 | download the model by going to the URL, e.g.: |
9 | 26 |
|
10 | | -``https://huggingface.co/mouseland/cellpose-sam/blob/main/cpsam`` |
| 27 | +``https://huggingface.co/mouseland/cellpose-sam/blob/main/cpdino`` |
11 | 28 |
|
12 | | -This model was trained on images with a range of diameters from 7.5 to 120 pixels. |
| 29 | +These models were trained on images with a range of diameters from 7.5 to 120 pixels, with a mean size of 30 pixels. |
13 | 30 | If your images have even larger diameters, you may want to specify the diameter parameter, |
14 | | -e.g. specifying ``diameter=60`` with downsample the image by a factor of 2 |
15 | | -(downsampling is respect to 30). |
| 31 | +e.g. specifying ``diameter=60`` will downsample the image by a factor of 2 |
| 32 | +(downsampling is with respect to 30 pixels). If you have cells with large diameters, |
| 33 | +then you may need to increase the ``niter`` parameter to run the dynamics step for mask creation for longer. |
16 | 34 |
|
17 | 35 |
|
18 | 36 | User-trained models |
19 | 37 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
20 | 38 |
|
21 | | -By default, models are trained with the images and ROIs not resized, and expects that |
22 | | -the testing images will have a similar diameter distribution as the training data. |
| 39 | +By default, models are fine-tuned on your images and ROIs with a small range of image resizing in the augmentations. |
| 40 | +Thus, the testing images should have a similar ROI diameter distribution as the training data. |
23 | 41 |
|
24 | 42 | These models can be loaded and used in the notebook with e.g. |
25 | 43 | ``models.CellposeModel(pretrained_model='name_in_gui')`` or with the full path |
|
0 commit comments