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]
                [--save_each]

Named Arguments

--version

show cellpose version info

Default: False

--verbose

show information about running and settings and save to log

Default: False

Hardware Arguments

--use_gpu

use gpu if torch with cuda installed

Default: False

--gpu_device

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

Default: “0”

--check_mkl

check if mkl working

Default: False

Input Image Arguments

--dir

folder containing data to run or train on.

Default: []

--image_path

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

Default: []

--look_one_level_down

run processing on all subdirectories of current folder

Default: False

--img_filter

end string for images to run on

Default: []

--channel_axis

axis of image which corresponds to image channels

--z_axis

axis of image which corresponds to Z dimension

--chan

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

Default: 0

--chan2

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

Default: 0

--invert

invert grayscale channel

Default: False

--all_channels

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

Default: False

Model Arguments

--pretrained_model

model to use for running or starting training

Default: “cyto”

--add_model

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

--unet

run standard unet instead of cellpose flow output

Default: False

--nclasses

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

Default: 3

Algorithm Arguments

--no_resample

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

Default: False

--net_avg

run 4 networks instead of 1 and average results

Default: False

--no_interp

do not interpolate when running dynamics (was default)

Default: False

--no_norm

do not normalize images (normalize=False)

Default: False

--do_3D

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

Default: False

--diameter

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

--stitch_threshold

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

Default: 0.0

--min_size

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

Default: 15

--fast_mode

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

Default: False

--flow_threshold

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

Default: 0.4

--cellprob_threshold

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

Default: 0

--anisotropy

anisotropy of volume in 3D

Default: 1.0

--exclude_on_edges

discard masks which touch edges of image

Default: False

Output Arguments

--save_png

save masks as png and outlines as text file for ImageJ

Default: False

--save_tif

save masks as tif and outlines as text file for ImageJ

Default: False

--no_npy

suppress saving of npy

Default: False

--savedir

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

--dir_above

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

Default: False

--in_folders

flag to save output in folders (off by default)

Default: False

--save_flows

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

Default: False

--save_outlines

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

Default: False

--save_rois

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

Default: False

--save_ncolor

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

Default: False

--save_txt

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

Default: False

Training Arguments

--train

train network using images in dir

Default: False

--train_size

train size network at end of training

Default: False

--test_dir

folder containing test data (optional)

Default: []

--mask_filter

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

Default: “_masks”

--diam_mean

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

learning rate. Default: 0.2

Default: 0.2

--weight_decay

weight decay. Default: 1e-05

Default: 1e-05

--n_epochs

number of epochs. Default: 500

Default: 500

--batch_size

batch size. Default: 8

Default: 8

--min_train_masks

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

Default: 5

--residual_on

use residual connections

Default: 1

--style_on

use style vector

Default: 1

--concatenation

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

Default: 0

--save_every

number of epochs to skip between saves. Default: 100

Default: 100

--save_each

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

Default: False