feat(gui): centroid-only models foundation - skeleton template + feature flag (1/2)#2723
Draft
talmo wants to merge 1 commit into
Draft
feat(gui): centroid-only models foundation - skeleton template + feature flag (1/2)#2723talmo wants to merge 1 commit into
talmo wants to merge 1 commit into
Conversation
Contributor
Docs Preview
API changes detected - View API Reference This preview will be removed when the PR is closed. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2723 +/- ##
========================================
Coverage 66.71% 66.71%
========================================
Files 96 97 +1
Lines 20686 20691 +5
========================================
+ Hits 13800 13805 +5
Misses 6886 6886 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ure flag (1/2) Lay the groundwork for centroid-only model support behind a single, easily-removable feature flag so default behavior is unchanged. - Add sleap/skeletons/centroid.json: a single-node skeleton template with one node named "centroid" and no edges. The SkeletonDock template chooser auto-populates from this folder, so no code wiring is needed. Copied from a pre-verified candidate (the SkeletonEncoder drops edge-less nodes, so the file is shipped verbatim rather than regenerated). Includes an RGBA preview image. - Add sleap/gui/learning/features.py with is_centroid_models_enabled(), gated on the SLEAP_ENABLE_CENTROID_MODELS environment variable (default: off; truthy: "1"/"true"/"yes"/"on", case-insensitive). The helper also honors the "Experimental Features" toggle in the Help menu via an experimental_features argument threaded in by the caller; the env var remains a developer override. This module is temporary: it gates UI for a feature whose inference half is still blocked on sleap-nn (epic talmolab/sleap-nn#508 / PR #562). Remove it and its call sites once centroid-only inference lands. Tests cover the flag's env-var parsing, the Experimental Features toggle, and that the shipped template loads to a single-node, edge-less skeleton with an RGBA preview. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
talmo
force-pushed
the
centroid-models/01-foundation
branch
from
May 29, 2026 00:34
3fdbfd8 to
8ceb0b2
Compare
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.
Do not merge yet
This is the foundation half (1/2) of a two-PR stack adding centroid-only model training to the SLEAP GUI. It is a draft and should not be merged or marked ready until the stack is reviewed together and the upstream inference work has landed (see below).
Summary
Lays the groundwork for centroid-only model support behind a single, easily-removable feature flag, so default behavior is byte-identical to today.
A "centroid-only" model is a standalone multi-animal centroid detector with a single-node skeleton (one node named
centroid), as opposed to centroid being only the first stage of a top-down pipeline.This PR contains no user-visible behavior on its own — it ships the skeleton template and the feature-flag plumbing that PR 2 builds on.
What's in this PR
sleap/skeletons/centroid.json— a single-node skeleton template (one node namedcentroid, no edges, with an RGBA preview image). TheSkeletonDocktemplate chooser auto-populates from this folder, so no code wiring is needed. Shipped verbatim rather than regenerated because theSkeletonEncoderdrops edge-less nodes (see companion fix note below).sleap/gui/learning/features.py—is_centroid_models_enabled(), gated on theSLEAP_ENABLE_CENTROID_MODELSenvironment variable. Default is OFF; truthy values are1/true/yes/on(case-insensitive). This module is intentionally temporary: it gates UI for a feature whose inference half is still blocked upstream. Remove it and its call sites once centroid-only inference lands.Scope: training only
This stack adds training support only. Centroid-only inference is intentionally deferred — it is still blocked upstream on sleap-nn (epic talmolab/sleap-nn#508 / PR talmolab/sleap-nn#562). Until that lands, users can train and export a centroid-only model but not yet run it from the GUI.
Feature flag (default off)
The entire feature is gated behind one flag,
is_centroid_models_enabled()(driven bySLEAP_ENABLE_CENTROID_MODELS, default off). With the flag off,developis byte-identical for users. The flag and its call sites are designed to be deleted in a single, clean removal once inference lands.Companion sleap-io fix
There is a companion fix in sleap-io for a
SkeletonEncoderbug where edge-less nodes (i.e. a single-node skeleton) get dropped during encoding. Because of that bug,centroid.jsonis shipped verbatim rather than round-tripped through the encoder.Stack
This is PR 1 of 2. PR 2 (training pipeline UX) is stacked on top of this branch.