Skip to content

Commit e5d5479

Browse files
making cpsam_v2 default
1 parent 86f3062 commit e5d5479

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Example notebooks:
3232

3333
New Cellpose4 models added! We have included new Cellpose models based on [DINOv3](https://github.com/facebookresearch/dinov3), `cpdino` and `cpdino-vitb`.
3434
We have also updated the CellposeSAM model (`cpsam_v2`), and it now predicts fewer spurious masks in low-contrast regions.
35-
To use the new models, `pip install cellpose[dino] --upgrade`, and find more details [here](https://cellpose.readthedocs.io/en/latest/models.html).
35+
To use the new models, `pip install cellpose --upgrade` and `pip install git+https://github.com/facebookresearch/dinov3`, and find more details [here](https://cellpose.readthedocs.io/en/latest/models.html).
3636

3737
:triangular_flag_on_post: All Cellpose models are trained on data that is licensed under **CC-BY-NC**. The Cellpose annotated dataset is also CC-BY-NC.
3838

@@ -105,7 +105,8 @@ If you are using a GPU, make sure its drivers and the cuda libraries are correct
105105
3. Create a new environment with `conda create --name cellpose python=3.12`. We recommend python 3.12, but python 3.9 and 3.11 will also work.
106106
4. To activate this new environment, run `conda activate cellpose`
107107
5. (option 1) To install cellpose with the GUI, run `python -m pip install cellpose[gui]`. If you're on a zsh server, you may need to use ' ': `python -m pip install 'cellpose[gui]'`.
108-
6. (option 2) To install cellpose without the GUI, run `python -m pip install cellpose[dino]`.
108+
6. (option 2) To install cellpose without the GUI, run `python -m pip install cellpose`.
109+
7. Install the DINOv3 package to use the CellposeDINO models with `python -m pip install git+https://github.com/facebookresearch/dinov3`.
109110

110111
To upgrade cellpose (package [here](https://pypi.org/project/cellpose/)), run the following in the environment:
111112

cellpose/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def get_arg_parser():
6565

6666
# model settings
6767
model_args = parser.add_argument_group("Model Arguments")
68-
model_args.add_argument("--pretrained_model", required=False, default="cpdino",
68+
model_args.add_argument("--pretrained_model", required=False, default="cpsam_v2",
6969
type=str,
70-
help="path to model for segmentation or starting training, or builtin model name: cpdino, cpsam_v2, cpdino-vitb, or cpsam")
70+
help="path to model for segmentation or starting training, or builtin model name: cpsam_v2, cpdino, cpdino-vitb, or cpsam")
7171
model_args.add_argument(
7272
"--add_model", required=False, default=None, type=str,
7373
help="model path to copy model to hidden .cellpose folder for using in GUI/CLI")

cellpose/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
_MODEL_DIR_DEFAULT = Path.home().joinpath(".cellpose", "models")
2929
MODEL_DIR = Path(_MODEL_DIR_ENV) if _MODEL_DIR_ENV else _MODEL_DIR_DEFAULT
3030

31-
MODEL_NAMES = ["cpdino", "cpsam_v2", "cpdino-vitb", "cpsam"]
31+
MODEL_NAMES = ["cpsam_v2", "cpdino", "cpdino-vitb", "cpsam"]
3232

3333
MODEL_LIST_PATH = os.fspath(MODEL_DIR.joinpath("gui_models.txt"))
3434

@@ -89,7 +89,7 @@ class CellposeModel():
8989
nclasses (int): Number of classes in the model.
9090
nbase (list): List of base values for the model.
9191
net (CPnet): Cellpose network.
92-
pretrained_model (str): Name of pretrained model ("cpdino", "cpsam_v2", etc) or path to pretrained cellpose model.
92+
pretrained_model (str): Name of pretrained model ("cpdino", "cpsam_v2", etc) or path to pretrained cellpose model. Default is "cpsam_v2".
9393
backbone (str): Type of network ("default" is the standard res-unet, "transformer" for the segformer).
9494
9595
Methods:
@@ -101,7 +101,7 @@ class CellposeModel():
101101
102102
"""
103103

104-
def __init__(self, gpu=False, pretrained_model="cpdino", model_type=None,
104+
def __init__(self, gpu=False, pretrained_model="cpsam_v2", model_type=None,
105105
diam_mean=None, device=None, nchan=None, use_bfloat16=True):
106106
"""
107107
Initialize the CellposeModel.
@@ -149,7 +149,7 @@ def __init__(self, gpu=False, pretrained_model="cpdino", model_type=None,
149149
models_logger.warning(
150150
f"pretrained model {pretrained_model} not found, using default model"
151151
)
152-
pretrained_model = cache_model_path("cpdino")
152+
pretrained_model = cache_model_path("cpsam_v2")
153153

154154
self.pretrained_model = pretrained_model
155155
dtype = torch.bfloat16 if use_bfloat16 else torch.float32

docs/models.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Built-in models
88

99
We have four built-in models available:
1010

11-
* ``cpdino``: this is the CellposeDINO model released in June 2026 using the DINOv3-ViTL backbone
1211
* ``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
12+
* ``cpdino``: this is the CellposeDINO model released in June 2026 using the DINOv3-ViTL backbone
1313
* ``cpdino-vitb``: this is the CellposeDINO model released in June 2026 using the DINOv3-ViTB backbone (smaller model)
1414
* ``cpsam``: this is the original CellposeSAM model released in April 2025 using the SAM-ViTL backbone
1515

0 commit comments

Comments
 (0)