Skip to content

How-ToGPU

How to Segment Cells in Microscope Images With Cellpose on Your Own GPU

Cellpose is a free, open-source AI tool that outlines cells and nuclei in microscope images on your own PC. Following the official docs, we cover what you need, installing it in a Python environment, getting PyTorch to use your NVIDIA GPU, segmenting images in the GUI and batch-processing a folder.

By , Systems & Technical Editor

5 min read

How to Segment Cells in Microscope Images With Cellpose on Your Own GPU

Cellpose is a free, open-source AI tool that finds and outlines individual cells and nuclei in microscope images, and it runs entirely on your own PC. Its latest models, Cellpose-SAM and the newer DINOv3-based models, work on Windows, Linux and macOS, and its developers recommend using an NVIDIA graphics card if you plan to process a lot of images.

What Cellpose does

The Cellpose team describes Cellpose-SAM as "cell and nucleus segmentation with superhuman generalization". It can be fine-tuned on your own data, used in 3D, and copes with images that have shot noise, blur, undersampling or contrast inversions, regardless of channel order and object size. You draw nothing up front: load an image, run the model and you get a mask for every cell, which you can then correct by hand or use to train your own model.

The v4.2 update in June 2026 added two models based on Meta's DINOv3, cpdino and cpdino-vitb, plus an updated Cellpose-SAM model (cpsam_v2) that the developers say predicts fewer spurious masks in low-contrast regions. In the current command-line reference, cpsam_v2 is the default model.

One licensing point matters before you start: the developers say all Cellpose models are trained on data licensed under CC-BY-NC, and the Cellpose annotated dataset is also CC-BY-NC. GitHub lists the code itself under the BSD-3-Clause licence.

What you need

  • A Windows, Linux or Mac PC. The README says the code runs on all three and has been most heavily tested on Windows 10 and Ubuntu.

  • At least 8GB of system RAM. The developers say 16GB to 32GB may be needed for larger images and 3D volumes.

  • An NVIDIA graphics card (optional but recommended). Cellpose uses PyTorch, so it runs on the CPU without one, but the README recommends the GPU version of PyTorch if you plan to process many images. A 16GB card such as the MSI GeForce RTX 5060 Ti 16GB Ventus 2X OC Plus gives you room for bigger images, and the NVIDIA GeForce RTX 5090 Founders Edition has 32GB of GDDR7 for heavy 3D work. The official docs don't set a minimum VRAM figure.

  • Python 3. The developers recommend Python 3.12 in a dedicated environment.

The developers also offer older standalone Windows and macOS executables, but the README says these have no GPU support, so use the Python install below if you want to use your graphics card.

Step 1: Create an environment

The README's recommended route uses a Miniforge (conda) distribution of Python. Open a Miniforge or Anaconda prompt and create a fresh environment:

conda create --name cellpose python=3.12
conda activate cellpose

You'll need to run conda activate cellpose every time before you use Cellpose. Python's built-in venv works too if you'd rather not install conda.

Step 2: Install Cellpose with the GUI

python -m pip install cellpose[gui]

On zsh, wrap the package name in quotes: 'cellpose[gui]'. To use the DINOv3-based models, the developers say you also need python -m pip install git+https://github.com/facebookresearch/dinov3.

Step 3: Make sure your GPU is being used

On Linux, the README says that with the latest PyTorch versions the GPU build is installed by default with pip as long as your NVIDIA driver is installed. On Windows, check which build you have. The quickest check is to open the GUI (next step): if the GPU is working, the GPU box is ticked and the CUDA version is shown in the command line.

If it isn't, uninstall torch with pip uninstall torch and install the CUDA build from the PyTorch website. The README's example for Windows with CUDA 12.6 is:

pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126

Our guide to installing PyTorch with CUDA on Windows covers this in more detail, and if PyTorch still can't see your card, see how to fix PyTorch CUDA not available.

Step 4: Segment your first image in the GUI

Start the GUI with:

python -m cellpose

The first time it runs, Cellpose downloads the latest trained model weights; Cellpose 4 models come from Hugging Face. Then:

  1. Drag and drop an image (.tif, .png, .jpg or .gif) into the window. The developers provide a zip file of demo images on cellpose.org if you don't have your own.

  2. Run segmentation. With MASKS ON ticked, you'll see an outline over each detected cell.

  3. Use the left and right arrow keys to move through other images in the same folder.

For best accuracy and speed, the developers recommend resizing images so cells are less than 100 pixels across. Results are saved next to the image as a _seg.npy file, but the GUI does not save automatically after running a model, so press Ctrl+S. For 3D stacks, open the GUI with python -m cellpose --Zstack.

Step 5: Batch-process a folder from the command line

Once you're happy with the results, the command-line interface processes a whole folder. Add --use_gpu to run on your NVIDIA card (the CLI default is the CPU):

python -m cellpose --dir /path/to/images --use_gpu --save_png

The docs recommend an absolute path for --dir. --save_tif saves masks as TIFF instead, and --pretrained_model picks a model such as cpsam_v2, cpdino, cpdino-vitb or cpsam, or the path to one you trained. From Python, the equivalent is models.CellposeModel(gpu=True) followed by model.eval().

If you run out of GPU memory

The timing and memory page says runtime and memory use grow with image size. If your images don't fit, reduce the batch_size setting (the default is 8) in model.eval or the CLI, and for very large images tile them before running Cellpose. Our guide to fixing CUDA out of memory errors covers general fixes too.

Training on your own images

If the built-in models miss your cells, the GUI can fine-tune a pretrained model on your own images: correct a few masks by hand, train, and repeat. The developers call this human-in-the-loop training, and trained models can be loaded back into the GUI, the CLI or Python. You can also find and share Cellpose models on the BioImage.IO Model Zoo.

The bottom line

Cellpose is a straightforward way to get AI cell segmentation on your own PC: create a Python 3.12 environment, install cellpose[gui], make sure PyTorch can see your NVIDIA card and drag an image into the GUI. Use --use_gpu for batch jobs, lower the batch size if you run out of video memory, and remember the models are trained on non-commercial (CC-BY-NC) data. Forge PC hasn't tested it.

In this article

Sources

  1. 01Cellpose repository and README (MouseLand, GitHub)
  2. 02Cellpose installation guide (Cellpose documentation)
  3. 03Cellpose GUI guide (Cellpose documentation)
  4. 04Cellpose settings (Cellpose documentation)
  5. 05Cellpose CLI reference (Cellpose documentation)
  6. 06Cellpose command line usage (Cellpose documentation)
  7. 07Cellpose timing and memory usage (Cellpose documentation)
  8. 08Cellpose models (Cellpose documentation)
  9. 09NVIDIA GeForce RTX 5090 (NVIDIA UK)
  10. 10NVIDIA GeForce RTX 5060 family (NVIDIA UK)

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Add an Exclusion to Microsoft Defender in Windows 11 (Safely)

How-To

How to Add an Exclusion to Microsoft Defender in Windows 11 (Safely)

Microsoft Defender keeps flagging a file you trust? Rather than switching protection off, you can exclude a file, folder, file type or process in Windows Security. Following Microsoft's guidance, we show how to add and remove exclusions, use wildcards safely and what exclusions don't cover.

Marcus Thorne4 min

The Best NVIDIA App Features in 2026: What's Worth Using on a GeForce PC

Best Picks

The Best NVIDIA App Features in 2026: What's Worth Using on a GeForce PC

The NVIDIA App does far more than update drivers. Based on NVIDIA's official pages, we pick the features most worth using on a GeForce PC, from DLSS Override and Smooth Motion to Instant Replay, the performance overlay, RTX HDR and one-click GPU tuning, and explain who each suits.

Hannah Vance4 min