Visitar URL original
Refactor `ctd_conditions` / `conditions_provider` + add `ConditionsConfig` + fix `InferenceConfig` by deruyter92 · Pull Request #3387 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dfaeabb
refactor ctd config (inference)
deruyter92 Jul 9, 2026
d698c85
refactor data/ctd.py: replace get_loader_and_snapshot with helper.
deruyter92 Jul 10, 2026
c13f25f
refactor data/ctd.py: remove ABC CondProvider
deruyter92 Jul 10, 2026
986ac8d
refactor ConditionsConfig: add build from shuffle
deruyter92 Jul 10, 2026
73f0d77
refactor ConditionsConfig: clean up build constructors
deruyter92 Jul 10, 2026
77807e2
Add affords_bu_inference property to ConditionsConfig
deruyter92 Jul 10, 2026
67229b9
refactor callers with ctd_conditions: use normalized ConditionsConfig…
deruyter92 Jul 10, 2026
0660100
refactor data/ctd.py and apis/ctd.py
deruyter92 Jul 10, 2026
8553294
add ConditionsShuffleConfig and `resolve_from_conditions()`
deruyter92 Jul 10, 2026
3ebd7b0
refactor analyze_images: clean normalization of ctd_conditions
deruyter92 Jul 14, 2026
1ed7e61
refactor analyze_image_folder (only accept resolved cond_provider)
deruyter92 Jul 14, 2026
35cf90a
refactor analyze_videos and analyze_images (strict ConditionsShuffleC…
deruyter92 Jul 14, 2026
38cca93
add missing shuffle literal
deruyter92 Jul 14, 2026
b87c970
Fix load_conditions_for_evaluation: add support for Typed ConditionsC…
deruyter92 Jul 14, 2026
3592b16
Improve docstrings and function signatures
deruyter92 Jul 14, 2026
03036d9
add tests for ctd conditions configurations
deruyter92 Jul 14, 2026
047dfa4
remove unused property "affords_bu_inference"
deruyter92 Jul 14, 2026
c37fc07
refactor tests_ctd_conditions, improve variable names and fix circula…
deruyter92 Jul 14, 2026
9642add
update test_ctd_conditions
deruyter92 Jul 14, 2026
7a36f4a
Merge branch 'main' into jaap/fix_ctd_conditions_config
deruyter92 Jul 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor ConditionsConfig: clean up build constructors
  • Loading branch information
deruyter92 committed Jul 10, 2026
commit 73f0d773a0e3e2fe32463d81c436f9d4708fbc44
20 changes: 13 additions & 7 deletions deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Licensed under GNU Lesser General Public License v3.0
#
"""Typed configuration for CTD (Conditional Top-Down) model conditions.
Two subclasses are supported (``ConditionsFileConfig`` and `ConditionsModelConfig``)
Two subclasses are supported (``ConditionsFileConfig`` and ``ConditionsModelConfig``)
depending on the source of the conditions (a file path, or a reference to a BU
model). Use ``ConditionsConfig.build()`` to construct from any raw input.
"""
Expand Down Expand Up @@ -57,14 +57,20 @@ def build(
if isinstance(v, (str, Path)):
return ConditionsFileConfig(filepath=Path(v))
if isinstance(v, dict):
source = v.get("source")
v = v.copy()
source = v.pop("source", None)
if source == "file" or (source is None and "filepath" in v):
return ConditionsFileConfig.model_validate(v if source else {"source": "file", **v})
# model source — direct form or shuffle shorthand
return ConditionsFileConfig(**v)
if "config" in v and "shuffle" in v:
shuffle_keys = {"config", "shuffle", "trainset_index", "modelprefix", "snapshot", "snapshot_index"}
return ConditionsModelConfig.from_shuffle(**{k: v[k] for k in shuffle_keys if k in v})
return ConditionsModelConfig.model_validate(v if source else {"source": "model", **v})
return ConditionsModelConfig.from_shuffle(**v)
if source == "model" or "config_path" in v or "snapshot_path" in v:
return ConditionsModelConfig(**v)
raise ValueError(
"Cannot determine conditions source from dict. "
"Provide 'filepath' for a file source, "
"'config_path'+'snapshot_path' for a model source, "
"or 'config'+'shuffle' for a shuffle shorthand."
)
raise TypeError(f"Cannot build a ConditionsConfig from {type(v).__name__!r}: {v!r}")


Expand Down