feat(gui): drive inference via sleap predict (sleap-nn 0.3.0 unified pipeline)#2800
Draft
talmo wants to merge 1 commit into
Draft
feat(gui): drive inference via sleap predict (sleap-nn 0.3.0 unified pipeline)#2800talmo wants to merge 1 commit into
sleap predict (sleap-nn 0.3.0 unified pipeline)#2800talmo wants to merge 1 commit into
Conversation
…d pipeline) Switch the GUI inference subprocess from the legacy `sleap track` subcommand to the new unified `sleap predict` pipeline (sleap-nn 0.3.0, #530) in InferenceTask.make_predict_cli_call. Why it's safe (verified): `predict`'s option surface is a strict SUPERSET of `track`'s — {track.params} - {predict.params} is empty (68 vs 105 params). Every one of the 26 options the GUI emits (data/model/output/batch/peak/max_instances, the full tracking arg set, and filter_overlapping) is accepted by `predict` under identical primary names. No option is renamed, dropped, or missing. Two changes: - `"track"` -> `"predict"` (the subcommand). - Add `--no-restore_source_videos`. Legacy `track` saved with restore_original_videos=False; `predict` defaults restore_source_videos=True, which would rewrite the output's video reference to the original source media. For non-embedded projects this is a no-op, but for an embedded `.pkg.slp` input it would make the post-inference `sio.load_slp` + `Labels.merge` create a DUPLICATE video instead of merging. The negative flag preserves exact legacy save semantics. `--gui` progress parsing is unchanged: `predict --gui` emits byte-identical JSON ({n_processed, n_total, rate, eta}) to `track --gui`, so predict_subprocess and the threaded worker parser need no edits. Tests: tests/gui/learning/test_cli_construction.py updated to assert `predict` + the new flag; full tests/gui/learning/ suite passes (345). ruff clean. NOTE (draft): needs end-to-end validation with real trained models before merge — see PR description checklist (embedded .pkg.slp merge, live --gui progress, ID-model tracking behavior, centroid-only, negative --frames). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019w47Wyu6LYBGZdEEegteDV
Contributor
Docs Preview
API changes detected - View API Reference This preview will be removed when the PR is closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #2796 (base =
talmo/1.7.0-deps-upgrade-tier0; retarget todevelopafter it merges).Summary
Switches the GUI's inference subprocess from the legacy
sleap tracksubcommand to the new unifiedsleap predictpipeline (sleap-nn 0.3.0, #530), inInferenceTask.make_predict_cli_call.Why this is safe (verified against sleap-nn 0.3.0)
predict's option surface is a strict superset oftrack's —{track.params} − {predict.params}is empty (68 vs 105 params, confirmed by introspecting the live click commands). Every one of the 26 options the GUI emits — data/model/output/batch_size/peak_threshold/max_instances, the entire tracking arg set (--tracking,--track_matching_method,--tracking_window_size,--candidates_method,--max_tracks,--use_flow,--post_connect_single_breaks,--tracking_target_instance_count,--scoring_reduction,--robust_best_instance,--features,--scoring_method), and--filter_overlapping*— is accepted bypredictunder identical primary names. Nothing is renamed, dropped, or missing.Changes (2 lines + 1 defensive flag)
"track"→"predict"— the subcommand.--no-restore_source_videos. Legacytracksaved withrestore_original_videos=False;predictdefaultsrestore_source_videos=True, which rewrites the output's video reference to the original source media. For non-embedded projects this is a no-op, but for an embedded.pkg.slpinput it would make the post-inferencesio.load_slp+Labels.mergecreate a duplicate video instead of merging. The negative flag preserves exact legacy save semantics.--guiprogress parsing is unchanged —predict --guiemits byte-identical JSON ({n_processed, n_total, rate, eta}) totrack --gui, so neitherpredict_subprocessnor the threaded-worker parser needs edits.Tests
tests/gui/learning/test_cli_construction.pyupdated to assertpredict+--no-restore_source_videos.tests/gui/learning/suite: 345 passed. ruff clean..pkg.slpinput → run inference, confirmload_slp+mergefolds into the existing video (no duplicate). The one genuine behavioral delta; should be neutralized by the flag — confirm.--guiprogress end-to-end — bar advances, "Predicted: n/n FPS ETA" renders (emitter confirmed by code reading only).--tracking. Genuine divergence: legacytracksilently skipped tracking for BottomUp/TopDown-MultiClass even with--tracking;predicthas no such guard and will run the flow tracker. Confirm whether the GUI exposes tracking for ID configs; decide whether predict's behavior is desired (likely a fix) or needs a narrow guard.trackhard-errors (feat(gui): centroid-only models - training pipeline UX (2/2) #2724);predictshould now work. Smoke-test.--frameswith explicit/negative indices (GUI emits e.g.0,-2559).Scope decision
The parity analysis recommends a clean, ungated full switch (predict is a strict superset; progress is byte-identical) rather than a feature flag or per-model-type gate — a gate would institutionalize the legacy path we're retiring. The only thing that would justify a narrow guard is if ID-model tracking (item 3) turns out unwanted.
🤖 Generated with Claude Code
https://claude.ai/code/session_019w47Wyu6LYBGZdEEegteDV