Cellpose CLI

See example usage at CLI examples. A description of the most important settings can be found on the Settings page.

Command Line Usage

Cellpose Command Line Parameters

usage: cellpose [-h] [--version] [--verbose] [--use_gpu]
                [--gpu_device GPU_DEVICE] [--check_mkl] [--dir DIR]
                [--image_path IMAGE_PATH] [--look_one_level_down]
                [--img_filter IMG_FILTER] [--channel_axis CHANNEL_AXIS]
                [--z_axis Z_AXIS] [--chan CHAN] [--chan2 CHAN2] [--invert]
                [--all_channels] [--pretrained_model PRETRAINED_MODEL]
                [--add_model ADD_MODEL] [--unet] [--nclasses NCLASSES]
                [--no_resample] [--net_avg] [--no_interp] [--no_norm]
                [--do_3D] [--diameter DIAMETER]
                [--stitch_threshold STITCH_THRESHOLD] [--min_size MIN_SIZE]
                [--fast_mode] [--flow_threshold FLOW_THRESHOLD]
                [--cellprob_threshold CELLPROB_THRESHOLD]
                [--anisotropy ANISOTROPY] [--exclude_on_edges] [--save_png]
                [--save_tif] [--no_npy] [--savedir SAVEDIR] [--dir_above]
                [--in_folders] [--save_flows] [--save_outlines] [--save_rois]
                [--save_ncolor] [--save_txt] [--train] [--train_size]
                [--test_dir TEST_DIR] [--mask_filter MASK_FILTER]
                [--diam_mean DIAM_MEAN] [--learning_rate LEARNING_RATE]
                [--weight_decay WEIGHT_DECAY] [--n_epochs N_EPOCHS]
                [--batch_size BATCH_SIZE] [--min_train_masks MIN_TRAIN_MASKS]
                [--residual_on RESIDUAL_ON] [--style_on STYLE_ON]
                [--concatenation CONCATENATION] [--save_every SAVE_EVERY]

Named Arguments


show cellpose version info

Default: False


show information about running and settings and save to log

Default: False

Hardware Arguments


use gpu if torch with cuda installed

Default: False


which gpu device to use, use an integer for torch, or mps for M1

Default: “0”


check if mkl working

Default: False

Input Image Arguments


folder containing data to run or train on.

Default: []


if given and –dir not given, run on single image instead of folder (cannot train with this option)

Default: []


run processing on all subdirectories of current folder

Default: False


end string for images to run on

Default: []


axis of image which corresponds to image channels


axis of image which corresponds to Z dimension


channel to segment; 0: GRAY, 1: RED, 2: GREEN, 3: BLUE. Default: 0

Default: 0


nuclear channel (if cyto, optional); 0: NONE, 1: RED, 2: GREEN, 3: BLUE. Default: 0

Default: 0


invert grayscale channel

Default: False


use all channels in image if using own model and images with special channels

Default: False

Model Arguments


model to use for running or starting training

Default: “cyto”


model path to copy model to hidden .cellpose folder for using in GUI/CLI


run standard unet instead of cellpose flow output

Default: False


if running unet, choose 2 or 3; cellpose always uses 3

Default: 3

Algorithm Arguments


disable dynamics on full image (makes algorithm faster for images with large diameters)

Default: False


run 4 networks instead of 1 and average results

Default: False


do not interpolate when running dynamics (was default)

Default: False


do not normalize images (normalize=False)

Default: False


process images as 3D stacks of images (nplanes x nchan x Ly x Lx

Default: False


cell diameter, if 0 will use the diameter of the training labels used in the model, or with built-in model will estimate diameter for each image

Default: 30.0


compute masks in 2D then stitch together masks with IoU>0.9 across planes

Default: 0.0


minimum number of pixels per mask, can turn off with -1

Default: 15


now equivalent to –no_resample; make code run faster by turning off resampling

Default: False


flow error threshold, 0 turns off this optional QC step. Default: 0.4

Default: 0.4


cellprob threshold, default is 0, decrease to find more and larger masks

Default: 0


anisotropy of volume in 3D

Default: 1.0


discard masks which touch edges of image

Default: False

Output Arguments


save masks as png and outlines as text file for ImageJ

Default: False


save masks as tif and outlines as text file for ImageJ

Default: False


suppress saving of npy

Default: False


folder to which segmentation results will be saved (defaults to input image directory)


save output folders adjacent to image folder instead of inside it (off by default)

Default: False


flag to save output in folders (off by default)

Default: False


whether or not to save RGB images of flows when masks are saved (disabled by default)

Default: False


whether or not to save RGB outline images when masks are saved (disabled by default)

Default: False


whether or not to save ImageJ compatible ROI archive (disabled by default)

Default: False


whether or not to save minimal “n-color” masks (disabled by default

Default: False


flag to enable txt outlines for ImageJ (disabled by default)

Default: False

Training Arguments


train network using images in dir

Default: False


train size network at end of training

Default: False


folder containing test data (optional)

Default: []


end string for masks to run on. use “_seg.npy” for manual annotations from the GUI. Default: “_masks”

Default: “_masks”


mean diameter to resize cells to during training – if starting from pretrained models it cannot be changed from 30.0

Default: 30.0


learning rate. Default: 0.2

Default: 0.2


weight decay. Default: 1e-05

Default: 1e-05


number of epochs. Default: 500

Default: 500


batch size. Default: 8

Default: 8


minimum number of masks a training image must have to be used. Default: 5

Default: 5


use residual connections

Default: 1


use style vector

Default: 1


concatenate downsampled layers with upsampled layers (off by default which means they are added)

Default: 0


number of epochs to skip between saves. Default: 100

Default: 100


save the model under a different filename per –save_every epoch for later comparsion

Default: False