Skip to content

Latest commit

 

History

History
79 lines (60 loc) · 3.45 KB

File metadata and controls

79 lines (60 loc) · 3.45 KB

CLI reference

MATs installs a single mats command with four subcommands:

mats run             Batch-measure a folder of images (the default).
mats app             Launch the Streamlit GUI.
mats fetch-weights   Download the model checkpoints.
mats doctor          Report weights, devices and QR decoders.

mats -i IN -o OUT ... with no subcommand is treated as mats run -i IN -o OUT ....

mats run

Measures every image in a folder and writes a CSV.

mats run -i ./images -o ./out -r results.csv --sheet-dimensions 12x12in
Flag Description Default
-i, --input_dir, --input-dir Directory of images to analyze. prompted if omitted (interactive)
-o, --output_dir, --output-dir Directory for masks / target boxes. prompted if omitted (interactive)
-r, --results_path, --results-path Measurement CSV path. ./leaf_morpho_results.csv
--sheet-dimensions Finished Template Creator sheet size as <w>x<h><unit>, e.g. 12x12in or 30x30cm; MATS derives calibration using Creator margins. read from QR
-t, --template_dimensions, --template-dimensions Legacy/custom marker-centre calibration area. Retained for existing scripts and non-Creator sheets. unused
--output-mode masks (segment leaves) or target-boxes (only save corrected boxes). masks
--mask-method birefnet (accurate, GPU) or threshold (fast). threshold
--threshold-level For threshold: auto (Otsu), low (100), medium (125), high (150). auto
--csv-schema full (area/width/length + per-axis pixels-per-selected-unit) or compact. full
--results-unit CSV measurement unit: mm, cm, or in. cm
-w, --workers Parallel workers. Only the CPU threshold path over pre-made target boxes parallelizes; model-backed runs use one worker. auto
--save-axes Also write per-image length/width overlay images for QC. off

Interactive vs non-interactive

If --input_dir / --output_dir are omitted and a terminal is attached, mats run prompts for them. Under a job scheduler or any non-TTY context it fails fast with a clear message instead of hanging on a prompt — always pass -i and -o in scripts.

Workers

Model-backed inference (RF-DETR, BiRefNet) shares one in-process model, so those runs execute on a single worker regardless of -w. Parallelism helps only when you re-segment already-extracted *_target_box images with --mask-method threshold.

mats fetch-weights

mats fetch-weights                 # RF-DETR only (default)
mats fetch-weights --all           # both checkpoints
mats fetch-weights --only birefnet --source lfs # explicitly fetch just BiRefNet
mats fetch-weights --force         # re-download even if present

Git LFS downloads write to the Git checkout's weights/ directory. MATS_WEIGHTS_DIR is for pre-staged local or shared checkpoints; a configured Hugging Face source may use it as its download destination. See weights.md.

mats doctor

Prints the resolved checkpoint paths and whether they exist, the Torch version and available devices, and which QR-decoding backends are available (OpenCV by default; pyzbar/qreader when the optional qr extra is installed). Run it first whenever something is off.

mats app

Launches the Streamlit GUI. Extra arguments are forwarded verbatim to streamlit run, e.g.:

mats app --server.port 8502 --server.headless true