lightning_pose

lightning_pose.callbacks Module

Custom Lightning callbacks for training schedule, backbone unfreezing, and augmentation.

Functions

get_callbacks(cfg[, early_stopping, ...])

Build and return the list of training callbacks based on the config.

Classes

AnnealWeight

Callback to change weight value during training.

UnfreezeBackbone

Callback that ramps up the backbone learning rate from 0 to upsampling_lr on unfreeze_epoch or unfreeze_step.

PatchMasking

Callback to apply curriculum patch masking during training.

lightning_pose.metrics Module

Evaluation metrics for assessing pose estimation model quality.

CSV format conventions

Labels CSV (DLC format, 3-row MultiIndex header: scorer / bodyparts / coords):
  • coord values are x, y, and optionally visible.

  • visible encodes per-keypoint visibility: 2 = labeled, 1 = present but unlabeled in this dataset, 0 = keypoint does not belong to this dataset.

  • Functions that consume labels filter coords to x/y before any reshape, so CSVs with a visible column are handled transparently.

Predictions CSV (same 3-row MultiIndex header):
  • coord values are x, y, likelihood.

  • An optional trailing column whose first MultiIndex level is 'set' signals that the file comes from a labeled dataset (not a video). Its presence sets is_video = False, which triggers pixel-error computation instead of temporal-norm computation in compute_metrics_single.

  • get_keypoint_names identifies keypoints by finding columns whose coord level equals 'x', so the 'set' column is automatically excluded from the returned keypoint list.

Functions

pixel_error(keypoints_true, keypoints_pred)

Root mean square error between true and predicted keypoints.

temporal_norm(keypoints_pred)

Norm of difference between keypoints on successive time bins.

pca_singleview_reprojection_error(...)

PCA reprojection error.

pca_multiview_reprojection_error(...)

PCA reprojection error.

compute_metrics_single(cfg, labels_file, ...)

Compute various metrics on a predictions csv file from a single view.

lightning_pose.train Module

Example model training function.

Functions

train(cfg[, model_dir, skip_evaluation])

Train a model using the configuration cfg, saving outputs to model_dir.