Patch: seeding, default parameters initialization for tuner, images support and choice of fixing parameters #427
Conversation
…of fixing parameters
There was a problem hiding this comment.
Pull request overview
Adds reproducibility and configurability features to the Optuna-based tracker tuner: a seed for deterministic sampling, an enqueued baseline trial that evaluates each tracker's __init__ defaults first, a fixed_params mechanism to pin specific kwargs across all trials (validated against the tracker __init__ signature and excluded from the sampled search space), and an images_dir option that loads MOT-style frames so trackers needing image input (e.g. BoTSORT CMC) can run inside the tuner. The previously hard-coded enable_cmc=[False] choice in BoTSORT's search_space is removed now that the tuner can feed frames, and the CLI / docs gain matching flags and guidance.
Changes:
- New
Tunerarguments (seed,enqueue_defaults,fixed_params,images_dir) plus helpers_create_optuna_study,_default_trial_params,_validate_tracker_init_params,_load_mot_sequence_frame;_run_tracker_on_detectionsnow optionally passes frames totracker.update. - CLI
trackers tuneexposes--fixed-params,--images-dir,--no-enqueue-defaults,--seed;tune()forwards them; BoTSORT search space no longer locksenable_cmctoFalse. - Tests and
docs/learn/tune.mdupdated to cover seeding, defaults enqueuing, fixed-param validation, and images-based CMC tuning.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/trackers/tune/tuner.py | Core Tuner additions: seed/enqueue/fixed_params/images_dir, helpers, frame loading, merged best-params output. |
| src/trackers/scripts/tune.py | New CLI flags and forwarding to tune()/Tuner. |
| src/trackers/core/botsort/tracker.py | Removes the forced enable_cmc=[False] entry from BoTSORT's search space. |
| docs/learn/tune.md | Documents baseline trial behavior, fixed_params, images_dir, and --seed. |
| tests/tune/test_tuner.py | Tests for default trial params, fixed-params handling, seed reproducibility, enqueue behavior. |
| tests/scripts/test_tune.py | Updates CLI delegation tests to include new kwargs. |
| Default: CLEAR. | ||
| threshold: IoU threshold for CLEAR and Identity matching. | ||
| seqmap: Sequence map file listing sequences to evaluate. | ||
| fixed_params: Tracker kwargs held constant for every trial. |
There was a problem hiding this comment.
seed is already exposed in the CLI as --seed and passed through to Tuner(..., seed=...) (still present after f604246).
| fixed_params: Tracker ``__init__`` kwargs held constant for every trial | ||
| (including the baseline). Overrides ``search_space`` for the same | ||
| key. Use for options you do not want tuned, e.g. | ||
| ``{"enable_cmc": False}`` or ``{"lost_track_buffer": 30}``. | ||
| Keys in ``fixed_params`` are not sampled by Optuna. |
There was a problem hiding this comment.
seem to duplicate the seed functionality?
There was a problem hiding this comment.
its different. Seed is for managing pseudo-random numbers, and this is for explicitly setting parameters that one doesnt want to tune (eg: cmc enable, or State Estimator variant)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/roboflow/trackers/sessions/c2afd571-cb1f-466e-818f-1c9239c2307e Co-authored-by: AlexBodner <61150961+AlexBodner@users.noreply.github.com>
…ps://github.com/roboflow/trackers into patch/tuner-tries-default-combination-and-seed-
…git numbers for dancetrack support
| --tracker botsort \ | ||
| --gt-dir ./data/gt \ | ||
| --detections-dir ./data/detections \ | ||
| --fixed-params '{"enable_cmc": false}' |
There was a problem hiding this comment.
The fixed has sometimes a task if fixing something broken...
What does this PR do?
Improves the hyperparameter tuner with a baseline (default params) trial, fixed tracker options, optional MOT image loading for CMC, and reproducible Optuna sampling.
Baseline trial: By default, trial 0 runs the tracker’s init defaults (merged with fixed_params) before Optuna explores the search space.
fixed_params: Pin options like enable_cmc for every trial; fixed keys are excluded from sampling and included in run()’s returned best params.
images_dir: Load sequence frames during tuning so CMC-enabled trackers (e.g. BoTSORT) can use motion compensation; required when enable_cmc=True.
seed: Optional seed for Optuna’s TPE sampler so sampled trials are reproducible across runs.
CLI/docs: --fixed-params, --images-dir, --no-enqueue-defaults, --seed; BoTSORT no longer exposes enable_cmc in search_space (use fixed_params instead).
Type of Change
Testing
Checklist
Additional Context