Skip to content

Settings and Configuration

Dave Walker edited this page Nov 1, 2026 · 2 revisions

FishTrack exposes different settings for finding starting regions, tracking them, and exporting the result. The desktop interface is the usual starting point: it groups related options and disables controls that do not apply to the chosen method. For more specialised experiments, the same processing engine can also be used from the command line.

Everyday Controls

Setting Meaning
Tracking method Choose Conventional CV or SAM 2
Find fish Start with Grounding DINO proposals, manual selection, or conventional motion acquisition
Start / duration Choose the segment of footage to investigate
DINO prompt Describe the objects to propose; the default is fish.
DINO threshold Make automatic proposals more or less selective; the score is not a probability of correct detection
SAM 2 model/device Choose a model size and processing device. Tiny and CPU are the documented desktop defaults
Annotations Include outlines, temporary tracking IDs, bounding boxes or diagnostic exports

A setting for one method may have no effect on another. For example, Conventional CV's camera-motion controls do not govern SAM 2 tracking. The interface disables irrelevant options to help make this clear.

Why Thresholds are not Universal

Motion-based area and distance controls operate in pixels, so settings useful for one video resolution may not work equally well for another. Increasing a motion threshold generally discards weaker apparent movement; increasing the permitted tracking distance can cause unrelated regions to be associated.

Grounding DINO thresholds affect which starting regions are proposed. SAM 2's minimum mask area instead determines whether an already predicted mask is drawn in the output. Neither setting is a direct measure of how reliably an individual fish has been identified and followed.

Saved Settings and Defaults

FishTrack's shipped, read-only desktop defaults reside in src/config/defaults/ui.json.

User preferences are stored separately in a versioned preferences.json under the operating system's Qt application configuration directory.

Choosing a footage folder saves that choice immediately. Valid settings are saved when processing starts or when the window closes.

Restore defaults reloads the packaged processing options without changing the selected footage folder.

If saved preferences are invalid, FishTrack logs the problem and uses packaged defaults in memory; incomplete edits do not replace the last valid saved settings.

Distinguish three types of defaults: the desktop begins with packaged values or previously saved user preferences; the CLI has its own argument defaults; and each model family has a default model variant. The CLI defaults to Conventional CV, while the documented packaged desktop configuration starts with SAM 2 and reviewed automatic proposals. A recommended first experiment is a suggestion, not necessarily the settings currently saved in your desktop application.

Command-Line Reference

The command line provides the same underlying processing engine and is useful for repeatable experiments. From the project root:

venv/bin/python -m fishtrack --help
venv/bin/python -m fishtrack \
  --input /path/to/reef.mp4 \
  --output /path/to/new-result.mp4 \
  --outline --track-ids

The installed fishtrack command and venv/bin/python main.py expose the same general interface. CLI defaults below may differ from the desktop UI's saved or packaged values.

Selection and Tracking Method

Option CLI default Purpose
--input required Existing MP4 input file.
--output required New MP4 output file.
--backend conventional Select conventional or sam2.
--roi X Y W H none Supply a starting rectangle; repeat for multiple fish.
--select-roi off Select regions interactively in the CLI's Tk window.
--auto-roi off Generate Grounding DINO proposals in the first processed frame.
--accept-auto-roi off Explicitly accept proposals without interactive review.
--detect-additional off Allow Conventional CV to acquire additional motion candidates.
--start 0 Start time in seconds.
--duration remainder of video Requested interval; SAM 2 requires a bounded run.
--max-frames unlimited Maximum number of frames; SAM 2 is capped at 240.

Grounding DINO and SAM 2

Option CLI default Purpose
--grounding-prompt fish. Description used to propose starting regions.
--grounding-threshold 0.3 Box proposal score threshold.
--grounding-text-threshold 0.25 Text-token threshold.
--max-auto-rois 10 Maximum surviving proposals.
--grounding-device cpu Processing device.
--grounding-model local Tiny model directory Override the Grounding DINO model path.
--sam2-model tiny Model size: Tiny, Small, Base-plus or Large.
--sam2-device auto Prefer available CUDA, then Apple MPS, otherwise CPU.
--sam2-checkpoint matching local checkpoint Override SAM 2 model weights; must match model size.
--sam2-min-area 40 Minimum mask area in pixels for drawing.

Conventional Motion and Tracking

Option CLI default Purpose
--min-area 80 Minimum candidate contour area, pixels².
--max-area 50000 Maximum candidate contour area, pixels².
--max-aspect-ratio 8 Maximum ratio of rectangle dimensions.
--motion-threshold 25 Grayscale difference threshold.
--min-residual-motion 2 Required local residual movement, pixels per frame.
--max-distance 60 Maximum position disagreement for matching, pixels.
--max-missing 5 Missing frames tolerated before a track expires.
--min-hits 3 Consecutive detections required to confirm a track.
--tracking-threshold 0.035 CSRT tracking response threshold.

The following switches are principally useful for testing or comparing Conventional CV behaviour:

  • --no-compensation: disable global camera alignment.
  • --no-local-motion: disable local optical-flow filtering.
  • --allow-unreliable-motion: allow candidates when motion estimation is unreliable.
  • --no-appearance: disable independent appearance-based following.

These Conventional CV controls do not apply to SAM 2's segmentation predictor.

Annotations, Output and Diagnostics

Option Purpose
--outline / --no-outline Enable or suppress candidate outlines.
--track-ids Draw temporary tracking identifiers.
--bounding-boxes Draw diagnostic rectangles.
--debug Enable verbose diagnostic logging.
--debug-dir Write diagnostic files to a new directory.
--save-start-frame Export the first processed frame as a PNG.

For safety, the CLI refuses an existing output path and never overwrites the source footage.

See Diagnostics and Troubleshooting for the files produced by each processing method, or Finding Fish and Tracking Fish for the workflows these settings control.

Clone this wiki locally