CLI Reference#
PhenoTypic provides a command-line interface for batch processing plate images.
Usage#
python -m phenotypic --mode full --pipeline PIPELINE_JSON --input INPUT_DIR --output OUTPUT_DIR [OPTIONS]
Path Options#
-p, --pipeline PIPELINE_JSONPath to a pipeline configuration file created with
pipeline.to_json(). Required forfull,measure, andprocessmodes. Rejected inrecompilemode, which reloads the saved pipeline from the output root.-i, --input INPUT_DIRDirectory containing plate images to process. Required for
fullandprocessmodes. Rejected inmeasureandrecompilemodes, which discover prior outputs from the output root.-o, --output OUTPUT_DIRDirectory where results (overlays, measurements, checkpoints) are saved. Required for every mode.
Image Options#
--image-type {Image,GridImage}Image class to use for loading. Default:
Image.--nrows NNumber of grid rows (GridImage only). Default: 8.
--ncols NNumber of grid columns (GridImage only). Default: 12.
--bit-depth {8,16}Force bit depth. Default: auto-detect.
--detect-mode MODEDetection matrix source channel. Default:
gray.--ext EXTFile extension filter (e.g.,
.png,.jpg). Default: all supported formats.
Execution Options#
-m, --mode {full,measure,recompile,process}Select the execution mode. Default:
full.fullApply the pipeline, measure, and emit all deliverables.
measureRe-run measurements from HDF files in an existing output root. Requires
--pipelineand--output. Rejects--inputand--dry-run.recompileRebuild aggregate deliverables from an existing output root. Requires
--output. Rejects--pipeline,--input, and--dry-run.processApply the pipeline and export one image layer per input. Requires
--pipeline,--input,--output, and--layer.
--layer {rgb,gray,detect_mat,objmap}Image layer exported by
--mode process. Rejected in other modes.--njobs NNumber of parallel worker processes. Default: all available CPUs.
--force-localRun locally even if SLURM is available.
--dry-runValidate pipeline and list images without processing. Supported by
fullandprocessmodes; rejected bymeasureandrecompile.--sample NProcess only N random images (for testing).
--random-seed SEEDRandom seed for
--samplereproducibility.
Resume and Recovery#
--resumeContinue from a previous run. Skips already-processed images.
--retry-failuresRe-process only images that failed. Requires
--resume.--restartClear all state and start fresh. Mutually exclusive with
--resume.--overwriteReprocess all images. Mutually exclusive with
--resume.--checkpoint-interval NSave checkpoint state every N images. Default: 100.
SLURM Options#
--slurm KEY=VALUEPass SLURM scheduling parameters as repeated key-value pairs (e.g.,
--slurm time=04:00:00 --slurm partition=gpu).--waitWait for SLURM jobs to complete before returning.
Output Options#
--overlay-alpha FLOATOpacity of detection overlay in saved images. Default: 0.3.
--include-dataset-columnAdd a dataset column to measurement CSV output.
--metadata-csv PATHPath to a CSV file with additional metadata to merge into results.
--skip-validationSkip pipeline validation before processing.
Tuning CLI#
PhenoTypic also ships a hyperparameter-tuning engine, python -m phenotypic.tune,
which searches an ImagePipeline’s parameters to maximize a scorer. It has two
subcommands: run (the search engine) and auto-space (infer a reviewable search
space from a pipeline). The tpe, cmaes, gp, and nsga2 strategies require
the optional tune extra (uv sync --extras tune); grid and random work out
of the box.
See the tuning how-to for an end-to-end walkthrough and the distributed HPCC guide for SLURM and Postgres fan-out.
run — run a tuning spec#
python -m phenotypic.tune run SPEC_JSON -i INPUT_DIR [OPTIONS]
Path Options#
SPEC_JSONPositional. Path to a
tuning_spec.jsondescribing the search space, scorer, and budget.-i, --input INPUT_DIRDirectory of plate images to tune against. Required.
-o, --output OUTPUT_DIRDirectory where tuning results are written.
Search Options#
--strategy {grid,random,tpe,cmaes,gp,nsga2}Override the spec’s strategy.
grid/randomuse the built-in configs;tpe/cmaes/gp/nsga2build anOptunaConfig(needs thetuneextra).--n-trials NTrial-budget override.
--screen/--no-screenEnable or disable the two-round screening freeze. Default:
--no-screen.
Storage Options#
--storage-url URLOptuna storage URL:
sqlite:///…(local single node) or a password-lesspostgresql+psycopg://USER@HOST:PORT/DB(distributed; libpq reads the password from~/.pgpassor$PGPASSWORD, so it never enters argv or the worker script). Falls back to$PHENOTYPIC_TUNE_STORAGE_URL.
Distributed Options#
--slurmSubmit a distributed worker fleet over SLURM instead of running locally.
--n-workers NNumber of SLURM array workers in the fleet (
--slurmonly). When unset, defaults tomin(8, n_trials)(or 4 if no trial budget is known). The fleet shares the one--n-trialsbudget rather than multiplying it.--slurm-partition NAMESLURM partition for the worker fleet (
--slurmonly). When unset the#SBATCH --partitiondirective is omitted (cluster default).--slurm-mem MEMSLURM
--memfor each worker (--slurmonly), e.g.8G.--slurm-time HMSSLURM
--timewall-clock limit for each worker (--slurmonly), e.g.04:00:00.
Robust-Eval Options#
--held-out-fraction FOverride the spec’s held-out fraction: the target share of plates reserved for the generalization pass.
--cv-group COLOverride the held-out grouping column. When unset, the spec value (then the count scorer’s
groupby[0]) is inferred.
auto-space — infer a search space#
python -m phenotypic.tune auto-space PIPELINE_JSON [OPTIONS]
PIPELINE_JSONPositional. Path to a pipeline JSON created with
pipeline.to_json().-o, --output OUTPUT_DIRDirectory where the inferred search space is written.
--unattendedReserved: skip the interactive review prompt (currently a no-op).