deeplabcut.pose_estimation_pytorch.config
Modules:
| Name | Description |
|---|---|
ctd_conditions |
Typed configuration for CTD (Conditional Top-Down) model conditions. |
data |
Data configuration classes for DeepLabCut pose estimation models. |
enums |
|
inference |
Inference configuration classes for DeepLabCut pose estimation models. |
logger |
Logger configuration classes for DeepLabCut training runs. |
make_pose_config |
Methods to create the configuration files for PyTorch DeepLabCut models. |
metadata |
|
model |
Model configuration class for DeepLabCut pose estimation models. |
paf_parameters |
|
pose |
Main pose configuration class for DeepLabCut pose estimation models. |
runner |
Runner configuration class for DeepLabCut pose estimation models. |
training |
Training configuration classes for DeepLabCut pose estimation models. |
utils |
Util functions to create pytorch pose configuration files. |
Classes:
| Name | Description |
|---|---|
AutocastConfig |
Automatic mixed precision configuration. |
COCOLoaderConfig |
Configuration for COCO Loader. |
CSVLoggerConfig |
Configuration for CSV logger. |
CompileConfig |
Model compilation configuration for inference optimization. |
ConditionsConfig |
Base class for CTD conditions configuration. |
ConditionsFileConfig |
Conditions loaded from a pre-computed predictions file (.h5, .json, .pickle). |
ConditionsModelConfig |
Resolved config for a BU model (i.e. a snapshot ref for live inference). |
ConditionsShuffleConfig |
Unresolved shuffle shorthand for CTD conditions. |
DLCLoaderConfig |
Configuration for DeepLabCut Loader. |
DataConfig |
Complete data configuration. |
DataTransformationConfig |
Data transformation configuration. |
DatasetType |
Enumeration of dataset types. |
DetectorModelConfig |
Configuration for detector models |
DetectorType |
Enumeration of detector types. |
EvaluationConfig |
Configuration for evaluation metrics computation. |
GenSamplingConfig |
Configuration for CTD models. |
InferenceConfig |
Complete inference configuration. |
LoggerConfig |
Base configuration for all loggers. |
MethodType |
Enumeration of pose estimation method types. |
ModelConfig |
Complete model configuration. |
MultithreadingConfig |
Multithreading configuration for inference. |
NetType |
Enumeration of network architecture types as stored in configs. |
OptimizerConfig |
Optimizer configuration. |
PoseConfig |
Main configuration class for DeepLabCut pose estimation models. |
PoseMetadata |
|
RunnerConfig |
Training runner configuration. |
SchedulerConfig |
Learning rate scheduler configuration. |
SnapshotCheckpointConfig |
Snapshot configuration for model checkpoints. |
TestConfig |
Configuration class for DeepLabCut test/inference settings. |
TrainSettingsConfig |
Training settings configuration. |
WandbLoggerConfig |
Configuration for Weights & Biases (wandb) logger. |
Functions:
| Name | Description |
|---|---|
available_detectors |
Returns: all the possible detectors that can be used |
available_models |
Returns: the possible variants of models that can be used |
get_config_folder_path |
Returns: the Path to the folder containing the "configs" for DeepLabCut 3.0 |
is_model_cond_top_down |
Checks whether a given net_type is conditional top-down or not. |
is_model_top_down |
Checks whenever a given net_type is top-down or not. |
load_backbones |
Load backbones. |
load_base_config |
Returns: the base configuration for all PyTorch DeepLabCut models |
load_detectors |
Load detectors. |
make_basic_project_config |
Deprecated factory for basic config dict for non-DLC projects. |
pretty_print |
Prints a model configuration in a pretty and readable way. |
read_config_as_dict |
Args: |
replace_default_values |
Replaces placeholder values in a model configuration with their actual values. |
update_config |
Deprecated helper for updating config dictionaries. |
update_config_by_dotpath |
Deprecated helper for updating config dictionaries using dot notation. |
write_config |
Writes a pose configuration file to disk. |
AutocastConfig
Bases: DLCBaseConfig
Automatic mixed precision configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
Whether autocast is enabled |
dtype |
bool
|
Data type for autocast (float16, bfloat16) |
Source code in deeplabcut/pose_estimation_pytorch/config/inference.py
COCOLoaderConfig
Bases: DLCBaseConfig
Configuration for COCO Loader.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal[COCOLoader]
|
Loader type identifier |
Source code in deeplabcut/pose_estimation_pytorch/config/data.py
CSVLoggerConfig
Bases: LoggerConfig
Configuration for CSV logger.
This logger saves training stats and metrics to a CSV file.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal[CSVLogger]
|
Logger type (should be 'CSVLogger') |
train_folder |
str
|
The path of the folder containing training files. |
log_filename |
str
|
The name of the file in which to store training stats |
Source code in deeplabcut/pose_estimation_pytorch/config/logger.py
CompileConfig
Bases: DLCBaseConfig
Model compilation configuration for inference optimization.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
Whether compilation is enabled |
mode |
bool
|
Compilation mode |
Source code in deeplabcut/pose_estimation_pytorch/config/inference.py
ConditionsConfig
Bases: DLCBaseConfig
Base class for CTD conditions configuration.
Use ConditionsConfig.build() to normalise any raw input into a typed subclass.
Subclasses
ConditionsFileConfig— pre-computed predictions file (evaluation only)ConditionsModelConfig— resolved BU model (config + snapshot paths)ConditionsShuffleConfig— unresolved shuffle shorthand (resolve to Model for live inference, or toCondFromFilefor evaluation)
Methods:
| Name | Description |
|---|---|
build |
Normalise any raw input into a typed conditions config. |
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
build
classmethod
build(
v: str | Path | dict | ConditionsConfig | None,
) -> ConditionsFileConfig | ConditionsModelConfig | ConditionsShuffleConfig | None
Normalise any raw input into a typed conditions config.
This method is pure — it never touches the filesystem. For shuffle
shorthand inputs it returns a ConditionsShuffleConfig (unresolved).
To obtain a fully resolved ConditionsModelConfig call
ConditionsModelConfig.resolve_from_conditions() at the point where
the project config is available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Path | dict | ConditionsConfig | None
|
Raw input. Accepted forms:
- |
required |
Returns:
| Type | Description |
|---|---|
ConditionsFileConfig | ConditionsModelConfig | ConditionsShuffleConfig | None
|
A typed |
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
ConditionsFileConfig
Bases: ConditionsConfig
Conditions loaded from a pre-computed predictions file (.h5, .json, .pickle).
File-based conditions are for evaluation only (load_conditions_for_evaluation
/ CondFromFile). They cannot be used for live analyze_images /
analyze_videos inference — use a shuffle or ConditionsModelConfig instead.
Attributes:
| Name | Type | Description |
|---|---|---|
filepath |
Path
|
Path to the predictions file. |
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
ConditionsModelConfig
Bases: ConditionsConfig
Resolved config for a BU model (i.e. a snapshot ref for live inference).
Attributes:
| Name | Type | Description |
|---|---|---|
config_path |
Path
|
Path to the BU model's |
snapshot_path |
Path
|
Path to the BU snapshot file. |
scorer |
str | None
|
Scorer name for the BU model. Used to look for pre-computed conditions files on disk before running the model. |
Methods:
| Name | Description |
|---|---|
from_shuffle |
Resolve a DLC BU shuffle to its model config and snapshot paths. |
resolve_from_conditions |
Resolve conditions input to a |
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
from_shuffle
classmethod
from_shuffle(
config: str | Path,
shuffle: int,
trainset_index: int = 0,
modelprefix: str = "",
snapshot: str | None = None,
snapshot_index: int | None = None,
) -> ConditionsModelConfig
Resolve a DLC BU shuffle to its model config and snapshot paths.
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
resolve_from_conditions
classmethod
resolve_from_conditions(
conditions: dict | ConditionsShuffleConfig | ConditionsModelConfig, config: str | Path | None = None
) -> ConditionsModelConfig
Resolve conditions input to a ConditionsModelConfig for live BUCTD
inference (analyze_images / analyze_videos).
Call this in runtime code. It may touch the filesystem when resolving a
ConditionsShuffleConfig to a ConditionsModelConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict | ConditionsShuffleConfig | ConditionsModelConfig
|
A dict, |
required |
|
str | Path | None
|
Project |
None
|
Returns:
| Type | Description |
|---|---|
ConditionsModelConfig
|
A resolved |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If |
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
ConditionsShuffleConfig
Bases: ConditionsConfig
Unresolved shuffle shorthand for CTD conditions.
Stores shuffle parameters without touching the filesystem. Resolve at runtime when the project config is available:
- Live BU inference:
ConditionsModelConfig.resolve_from_conditions() - Evaluation predictions file:
CondFromFile(config=..., shuffle=..., ...)
Attributes:
| Name | Type | Description |
|---|---|---|
shuffle |
int
|
The index of the BU shuffle to use for conditions. |
config |
Path | None
|
Path to the DLC project |
trainset_index |
int
|
The TrainingsetFraction index. |
modelprefix |
str
|
The model prefix for the shuffle. |
snapshot |
str | None
|
Specific snapshot filename to use. Takes priority over
|
snapshot_index |
int | None
|
Index of the snapshot to use (default: -1, last). |
Source code in deeplabcut/pose_estimation_pytorch/config/ctd_conditions.py
DLCLoaderConfig
Bases: DLCBaseConfig
Configuration for DeepLabCut Loader.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal[DLCLoader]
|
Loader type identifier |
config |
str | dict
|
Path to the DeepLabCut project config, or the project config itself |
trainset_index |
NonNegativeInt
|
Index of the TrainingsetFraction for which to load data |
shuffle |
NonNegativeInt
|
Index of the shuffle for which to load data |
modelprefix |
str
|
The modelprefix for the shuffle |
Source code in deeplabcut/pose_estimation_pytorch/config/data.py
DataConfig
Bases: DLCBaseConfig
Complete data configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
bbox_margin |
NonNegativeInt
|
Bounding box margin for top-down models |
colormode |
Literal['RGB']
|
Color mode for images (e.g., 'RGB', 'BGR') |
gen_sampling |
GenSamplingConfig | None
|
Generation sampling configuration |
inference |
DataTransformationConfig | None
|
Inference data configuration |
train |
DataTransformationConfig | None
|
Training data configuration |
loader |
DLCLoaderConfig | COCOLoaderConfig | None
|
Data loader configuration |
Source code in deeplabcut/pose_estimation_pytorch/config/data.py
DataTransformationConfig
Bases: DLCBaseConfig
Data transformation configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
resize |
dict | None
|
Resize transformation configuration |
longest_max_size |
int | dict | None
|
Maximum size for longest edge |
hflip |
bool | float | dict | None
|
Horizontal flip configuration |
affine |
dict | None
|
Affine transformation configuration |
random_bbox_transform |
dict | None
|
Random bbox transformation configuration |
crop_sampling |
dict | None
|
Crop sampling configuration |
hist_eq |
bool | dict | None
|
Whether to apply histogram equalization |
motion_blur |
bool | dict | None
|
Whether to apply motion blur |
covering |
bool | dict | None
|
Covering/CoarseDropout transformation configuration |
elastic_transform |
bool | dict | None
|
Elastic transformation configuration |
grayscale |
bool | dict | None
|
Grayscale transformation configuration |
gaussian_noise |
bool | float | int | dict | None
|
Gaussian noise standard deviation |
auto_padding |
dict | None
|
Auto padding configuration |
normalize_images |
bool | dict | None
|
Whether to normalize images |
scale_to_unit_range |
bool | dict | None
|
Whether to scale images to [0, 1] range |
top_down_crop |
dict | None
|
Top-down crop configuration |
collate |
dict | None
|
Collate function configuration |
Source code in deeplabcut/pose_estimation_pytorch/config/data.py
DatasetType
Enumeration of dataset types.
Source code in deeplabcut/pose_estimation_pytorch/config/enums.py
DetectorModelConfig
Bases: DLCBaseConfig
Configuration for detector models
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
Type of detector model (e.g., FasterRCNN) |
freeze_bn_stats |
bool
|
Whether to freeze batch normalization statistics |
freeze_bn_weights |
bool
|
Whether to freeze batch normalization weights |
variant |
str | None
|
Specific variant of the detector model |
Source code in deeplabcut/pose_estimation_pytorch/config/model.py
DetectorType
Enumeration of detector types.
Source code in deeplabcut/pose_estimation_pytorch/config/enums.py
EvaluationConfig
Bases: DLCBaseConfig
Configuration for evaluation metrics computation.
Attributes:
| Name | Type | Description |
|---|---|---|
pcutoff |
float | list[float] | dict[str, float]
|
Confidence threshold for RMSE computation. Can be: - float: Single threshold for all bodyparts - list[float]: One value per bodypart (and unique bodypart if any) - dict[str, float]: Mapping bodypart names to thresholds |
comparison_bodyparts |
Literal['all'] | list[str] | None
|
Subset of bodyparts to compute metrics for. Can be "all", None (all bodyparts), or a list of bodypart names. |
per_keypoint_evaluation |
bool
|
Whether to compute train and test RMSE for each keypoint individually. |
force_multi_animal |
bool
|
If True, use multi-animal evaluation even if loader contains only a single animal. |
Source code in deeplabcut/pose_estimation_pytorch/config/inference.py
GenSamplingConfig
Bases: DLCBaseConfig
Configuration for CTD models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
The sigma for each keypoint. |
required | |
|
Indices of symmetric keypoints (e.g. left/right eye) |
required | |
|
The probability of applying jitter. Jitter error is defined as a small displacement from the GT keypoint. |
required | |
|
The probability of applying a swap error. Swap error represents a confusion between the same or similar parts which belong to different persons. |
required | |
|
The probability of applying an inversion error. Inversion error occurs when a pose estimation model is confused between semantically similar parts that belong to the same instance. |
required | |
|
The probability of applying a miss error. Miss error represents a large displacement from the GT keypoint position. |
required |
Source code in deeplabcut/pose_estimation_pytorch/config/data.py
InferenceConfig
Bases: DLCBaseConfig
Complete inference configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
multithreading |
MultithreadingConfig
|
Multithreading configuration |
compile |
CompileConfig
|
Compilation configuration |
autocast |
AutocastConfig
|
Autocast configuration |
conditions |
ConditionsModelConfig | ConditionsFileConfig | ConditionsShuffleConfig | None
|
Conditions for conditional models (CTD). File configs are evaluation-only; Shuffle/Model are used for live analyze. |
snapshot |
int | str | list[int] | None
|
Snapshot(s) to use for inference |
eval |
EvaluationConfig
|
Evaluation configuration |
Source code in deeplabcut/pose_estimation_pytorch/config/inference.py
LoggerConfig
Bases: DLCBaseConfig
Base configuration for all loggers.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
The type of logger to use (WandbLogger or CSVLogger) |
Source code in deeplabcut/pose_estimation_pytorch/config/logger.py
MethodType
ModelConfig
Bases: DLCBaseConfig
Complete model configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
backbone |
dict
|
Backbone configuration |
backbone_output_channels |
int | None
|
Number of output channels from backbone |
heads |
dict[str, dict]
|
Dictionary of head configurations by name |
neck |
dict | None
|
Neck configuration |
pose_model |
dict | None
|
Pose model configuration |
Source code in deeplabcut/pose_estimation_pytorch/config/model.py
MultithreadingConfig
Bases: DLCBaseConfig
Multithreading configuration for inference.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
Whether multithreading is enabled |
queue_length |
int
|
Length of the processing queue |
timeout |
float
|
Timeout for processing tasks |
Source code in deeplabcut/pose_estimation_pytorch/config/inference.py
NetType
Enumeration of network architecture types as stored in configs.
Note
Aliases (e.g. top_down_resnet_50) are user-facing names that map to
a canonical member plus an optional top-down flag. See alias,
from_alias, and available_aliases
Methods:
| Name | Description |
|---|---|
alias |
User-facing name (e.g. |
available_aliases |
All selectable model names for GUI / docs / |
from_alias |
Parse user-facing / legacy name → (canonical enum, top_down). |
Source code in deeplabcut/pose_estimation_pytorch/config/enums.py
alias
User-facing name (e.g. top_down_resnet_50 for backbone + TD).
available_aliases
classmethod
All selectable model names for GUI / docs / create_training_dataset.
Source code in deeplabcut/pose_estimation_pytorch/config/enums.py
from_alias
classmethod
Parse user-facing / legacy name → (canonical enum, top_down).
Source code in deeplabcut/pose_estimation_pytorch/config/enums.py
OptimizerConfig
Bases: DLCBaseConfig
Optimizer configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
Optimizer type (e.g., AdamW, SGD) |
params |
dict[str, Any] | None
|
Optimizer parameters |
Source code in deeplabcut/pose_estimation_pytorch/config/runner.py
PoseConfig
Bases: DLCVersionedConfig
Main configuration class for DeepLabCut pose estimation models.
This is the top-level configuration that brings together all the different configuration domains (project, model, data, training, etc.).
Attributes:
| Name | Type | Description |
|---|---|---|
net_type |
NetType
|
Network architecture type (e.g., resnet_50, hrnet_w32, dlcrnet_stride16_ms5) |
method |
MethodType
|
Method type (bu=Bottom-Up, td=Top-Down, ctd=Conditional Top-Down) |
device |
str
|
Device configuration (auto, cpu, cuda) |
project |
str
|
Project configuration (skeleton, individuals, etc.) |
model |
ModelConfig
|
Model configuration (backbone, heads, etc.) |
detector |
DetectorConfig | None
|
Detector configuration (for top-down models) |
data |
DataConfig
|
Data configuration (loaders, transforms, etc.) |
training |
DataConfig
|
Training configuration (runner, optimizer, etc.) |
inference |
InferenceConfig
|
Inference configuration (multithreading, compilation, etc.) |
logger |
CSVLoggerConfig | WandbLoggerConfig | None
|
Logger configuration (e.g., WandB or CSV logger) |
with_center_keypoints |
bool
|
Whether to include center keypoints (for DEKR models) |
Methods:
| Name | Description |
|---|---|
build |
Build a typed PoseConfig for a project |
Source code in deeplabcut/pose_estimation_pytorch/config/pose.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
build
classmethod
build(
project_config: ProjectConfig | dict | Path | str,
pose_config_path: str | Path,
*,
top_down: bool,
multi_animal: bool | None = None,
net_type: NetType | str | None = None,
detector_type: DetectorType | str | None = None,
weight_init: WeightInitialization | dict | Path | str | None = None,
ctd_conditions: int | str | Path | tuple[int, str] | tuple[int, int] | None = None,
save: bool = False
) -> Self
Build a typed PoseConfig for a project
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ProjectConfig | dict | Path | str
|
The project configuration. |
required |
|
str | Path
|
The path to the pose configuration. |
required |
|
bool
|
Whether to use a top-down backbone. |
required |
|
NetType | str | None
|
The network architecture type (without 'top_down_' prefix). If None, the default net type from the project config will be used. |
None
|
|
DetectorType | str | None
|
The detector architecture. Required for td models. |
None
|
|
WeightInitialization | None
|
The weight initialization object or path. |
None
|
|
int | str | Path | tuple[int, str] | tuple[int, int] | None
|
The conditional top-down conditions. Only required for CTD models. A predictions file path is evaluation-only; shuffle refs work for both evaluation and live analyze. |
None
|
|
bool
|
Whether to save the pose configuration. |
False
|
Note
For generic backbone models, method is resolved from top_down. For non-backbone models,
the top_down is ignored and method is resolved from the default config.
Source code in deeplabcut/pose_estimation_pytorch/config/pose.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
PoseMetadata
Bases: DLCBaseConfig
Methods:
| Name | Description |
|---|---|
build |
Get metadata from a project configuration with optional overrides |
Source code in deeplabcut/pose_estimation_pytorch/config/metadata.py
build
classmethod
build(
project_config: ProjectConfig | dict | Path | str,
*,
project_path: Path | str | None = None,
pose_config_path: Path | str | None = None,
bodyparts: list[str] | None = None,
unique_bodyparts: list[str] | None = None,
individuals: list[str] | None = None,
with_identity: bool | None = None
) -> Self
Get metadata from a project configuration with optional overrides
Source code in deeplabcut/pose_estimation_pytorch/config/metadata.py
RunnerConfig
Bases: DLCBaseConfig
Training runner configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
Runner type (e.g., PoseTrainingRunner) |
gpus |
Any | None
|
GPU configuration |
key_metric |
str
|
Key metric for evaluation |
key_metric_asc |
bool
|
Whether key metric should be ascending |
eval_interval |
int
|
Evaluation interval in epochs |
optimizer |
OptimizerConfig | None
|
Optimizer configuration |
scheduler |
SchedulerConfig | None
|
Scheduler configuration |
snapshots |
SnapshotCheckpointConfig | None
|
Snapshot configuration |
load_weights_only |
bool | None
|
Value for torch.load() weights_only parameter |
Source code in deeplabcut/pose_estimation_pytorch/config/runner.py
SchedulerConfig
Bases: DLCBaseConfig
Learning rate scheduler configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
Scheduler type (e.g., LRListScheduler, CosineAnnealingLR, SequentialLR) |
params |
dict[str, Any] | None
|
Scheduler parameters |
Source code in deeplabcut/pose_estimation_pytorch/config/runner.py
SnapshotCheckpointConfig
Bases: DLCBaseConfig
Snapshot configuration for model checkpoints.
Attributes:
| Name | Type | Description |
|---|---|---|
max_snapshots |
int
|
Maximum number of snapshots to keep |
save_epochs |
int
|
Interval for saving snapshots |
save_optimizer_state |
bool
|
Whether to save optimizer state |
Source code in deeplabcut/pose_estimation_pytorch/config/runner.py
TestConfig
Bases: DLCBaseConfig
Configuration class for DeepLabCut test/inference settings.
This configuration is used for downstream tracking and evaluation, containing the essential metadata about joints and network architecture.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset |
Path
|
Path to the project/dataset. |
dataset_type |
DatasetType
|
Type of dataset (required for downstream tracking). |
num_joints |
NonNegativeInt
|
Total number of joints (bodyparts + unique bodyparts). |
all_joints |
list[list[NonNegativeInt]]
|
List of joint indices, each as a single-element list. |
all_joints_names |
UniqueStrList
|
List of joint names. |
net_type |
NetType
|
Network architecture type. |
global_scale |
Fraction
|
Global scale factor for inference. |
scoremap_dir |
Path
|
Directory for score maps. |
Source code in deeplabcut/pose_estimation_pytorch/config/pose.py
TrainSettingsConfig
Bases: DLCBaseConfig
Training settings configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
batch_size |
int
|
Training batch size |
dataloader_workers |
int
|
Number of data loader workers |
dataloader_pin_memory |
bool
|
Whether to pin memory in data loader |
display_iters |
int
|
Display interval for training progress |
epochs |
int
|
Number of training epochs |
seed |
int
|
Random seed for reproducibility |
weight_init |
WeightInitialization | None
|
Weight initialization configuration |
Source code in deeplabcut/pose_estimation_pytorch/config/training.py
WandbLoggerConfig
Bases: LoggerConfig
Configuration for Weights & Biases (wandb) logger.
This logger tracks experiments and logs data to Weights & Biases. Refer to: https://docs.wandb.ai/guides for more information.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal[WandbLogger]
|
Logger type (should be 'WandbLogger') |
project_name |
str
|
The name of the wandb project |
run_name |
str
|
The name of the wandb run |
image_log_interval |
int | None
|
How often train/test images are logged in epochs (if None, train/test inputs are never logged) |
model |
dict | None
|
The model architecture to log |
train_folder |
str | None
|
The path of the folder containing training files. |
wandb_kwargs |
dict | None
|
Additional keyword arguments to pass to wandb.init |
Source code in deeplabcut/pose_estimation_pytorch/config/logger.py
available_detectors
available_models
Returns: the possible variants of models that can be used
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
get_config_folder_path
Returns: the Path to the folder containing the "configs" for DeepLabCut 3.0
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
is_model_cond_top_down
Checks whether a given net_type is conditional top-down or not.
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
is_model_top_down
Checks whenever a given net_type is top-down or not.
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
load_backbones
Load backbones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
the Path to the folder containing the "configs" for PyTorch DeepLabCut |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
all backbones with default configurations that can be used |
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
load_base_config
Returns: the base configuration for all PyTorch DeepLabCut models
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
load_detectors
Load detectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
the Path to the folder containing the "configs" for PyTorch DeepLabCut |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
all detectors that are available |
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
make_basic_project_config
make_basic_project_config(
dataset_path: Path | str, bodyparts: list[str], max_individuals: int, multi_animal: bool = True
) -> dict
Deprecated factory for basic config dict for non-DLC projects.
Source code in deeplabcut/pose_estimation_pytorch/config/make_pose_config.py
pretty_print
Prints a model configuration in a pretty and readable way.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
the config to print |
required |
|
int
|
the base indent on all keys |
0
|
|
Callable[[str], None] | None
|
custom function to call (simply calls |
None
|
Source code in deeplabcut/core/config/utils.py
read_config_as_dict
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Path
|
the path to the configuration file to load |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The configuration file with pure Python classes |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
if the config file does not exist |
Source code in deeplabcut/core/config/utils.py
replace_default_values
replace_default_values(
config: dict | list,
num_bodyparts: int | None = None,
num_individuals: int | None = None,
backbone_output_channels: int | None = None,
**kwargs
) -> dict
Replaces placeholder values in a model configuration with their actual values.
This method allows to create template PyTorch configurations for models with values such as "num_bodyparts", which are replaced with the number of bodyparts for a project when making its Pytorch configuration.
This code can also do some basic arithmetic. You can write "num_bodyparts x 2" (or any factor other than 2) for location refinement channels, and the number of channels will be twice the number of bodyparts. You can write "backbone_output_channels // 2" for the number of channels in a layer, and it will be half the number of channels output by the backbone. You can write "num_bodyparts + 1" (such as for DEKR heatmaps, where a "center" bodypart is added).
The three base placeholder values that can be computed are "num_bodyparts", "num_individuals" and "backbone_output_channels". You can add more through the keyword arguments (such as "paf_graph": list[tuple[int, int]] or "paf_edges_to_keep": list[int] for DLCRNet models).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict | list
|
the configuration in which to replace default values |
required |
|
int | None
|
the number of bodyparts |
None
|
|
int | None
|
the number of individuals |
None
|
|
int | None
|
the number of backbone output channels |
None
|
|
other placeholder values to fill in |
{}
|
Returns:
| Type | Description |
|---|---|
dict
|
the configuration with placeholder values replaced |
Raises:
| Type | Description |
|---|---|
ValueError
|
If there is a placeholder value who's "updated" value was not given to the method |
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
update_config
Deprecated helper for updating config dictionaries.
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
update_config_by_dotpath
Deprecated helper for updating config dictionaries using dot notation.
DLCBaseConfig.set_nested (new in 3.0.1) can be used instead (not identical).
Updates items in the configuration file using dot notation for nested keys
The configuration dict should only be composed of primitive Python types
(dict, list and values). This is the case when reading the file using
read_config_as_dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
the configuration dict to update |
required |
|
dict
|
single-level dict with dot notation keys indicating nested paths e.g. {"device": "cuda", "runner.gpus": [0,1]} |
required |
|
bool
|
whether to copy the original dict before updating it |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
the updated dictionary |
Source code in deeplabcut/pose_estimation_pytorch/config/utils.py
write_config
Writes a pose configuration file to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Path
|
the path where the config should be saved |
required |
|
dict
|
the config to save |
required |
|
bool
|
whether to overwrite the file if it already exists |
True
|