{"id":23412,"library":"cellpose","title":"Cellpose","description":"Cellpose is a deep learning-based anatomical segmentation algorithm for cells and nuclei, developed by Carsen Stringer and Marius Pachitariu. The current version is 4.1.1 (as of early 2025). Release cadence is active with several minor versions per year.","status":"active","version":"4.1.1","language":"python","source_language":"en","source_url":"https://github.com/MouseLand/cellpose","tags":["segmentation","cell","biomedical-image-analysis","deep-learning","pytorch"],"install":[{"cmd":"pip install cellpose","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Deep learning backend","package":"torch","optional":false},{"reason":"Array operations","package":"numpy","optional":false},{"reason":"Performance for dynamics","package":"numba","optional":false},{"reason":"Image handling","package":"Pillow","optional":false}],"imports":[{"note":"Cellpose class removed in v4.0.0; use CellposeModel instead","wrong":"from cellpose.models import Cellpose","symbol":"CellposeModel","correct":"from cellpose.models import CellposeModel"},{"note":"","wrong":"","symbol":"models","correct":"from cellpose import models"},{"note":"","wrong":"","symbol":"io","correct":"from cellpose import io"}],"quickstart":{"code":"import numpy as np\nfrom cellpose.models import CellposeModel\nmodel = CellposeModel(gpu=True, model_type='cyto')\nimg = np.random.rand(256, 256).astype(np.float32)\nmask, flow, style = model.eval(img, channels=[0,0], diameter=30.0)\nprint(mask.shape)","lang":"python","description":"Loads a pretrained cyto model and segments a random image."},"warnings":[{"fix":"Replace `from cellpose.models import Cellpose` with `from cellpose.models import CellposeModel`.","message":"Cellpose v4 drops the `Cellpose` class and `SizeModel`. Users must use `CellposeModel` for all segmentation.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"For denoising, use Cellpose 3.x or alternative methods.","message":"Cellpose v4 does not include the denoise module (`cellpose.denoise`).","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use `channels=[0,0]` for single-channel grayscale images.","message":"`channels` parameter now expects a list of two integers (channel index, second channel). Passing `None` or single int is deprecated.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Set `torch.backends.mps.is_available()` carefully and consider using CPU or CUDA if artifacts appear.","message":"MPS (Apple Silicon) backend may produce incorrect results with certain operations (e.g., bfloat16).","severity":"gotcha","affected_versions":"all"},{"fix":"Retrain your model using the `CellposeModel` API in v4, or stick to v3 for existing models.","message":"Cellpose models trained in v3.x are not fully compatible with v4.x without retraining.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from cellpose.models import CellposeModel` and instantiate `CellposeModel`.","cause":"Cellpose v4 removed the Cellpose class. Users try to import Cellpose as in v3.","error":"AttributeError: module 'cellpose.models' has no attribute 'Cellpose'"},{"fix":"Set `model = CellposeModel(gpu=True, model_type='cyto')` to automatically match precision, or convert input: `img = img.to(torch.bfloat16)`.","cause":"Mixing float and half precision (bfloat16) on GPU, often because model weights are bfloat16 but input tensor is float32.","error":"RuntimeError: expected scalar type Half but found Float"},{"fix":"Use `channels=[0,0]` for grayscale, or `channels=[0,1]` for two-channel images.","cause":"`channels` parameter passed as a single integer or None, which is no longer supported in v4.","error":"ValueError: channels must be a list of two integers"},{"fix":"Use Cellpose 3.x for denoising, or apply external denoising libraries.","cause":"The denoise module was removed in Cellpose v4.","error":"ModuleNotFoundError: No module named 'cellpose.denoise'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}