lightning_pose.utils

lightning_pose.utils.cropzoom Module

Functions

generate_cropped_labeled_frames(...[, ...])

generate_cropped_video(video_path, ...)

lightning_pose.utils.fiftyone Module

Functions

check_lists_equal(list_1, list_2)

remove_string_w_substring_from_list(strings, ...)

check_dataset(dataset)

get_image_tags(pred_df)

Classes

FiftyOneImagePlotter(cfg[, ...])

dfConverter(df, keypoint_names)

lightning_pose.utils.io Module

Path handling functions.

Functions

ckpt_path_from_base_path(base_path, model_name)

Given a path to a hydra output with trained model, extract the model .ckpt file.

check_if_semi_supervised([losses_to_use])

Use config file to determine if model is semi-supervised.

get_keypoint_names([cfg, csv_file, header_rows])

return_absolute_path(possibly_relative_path)

Return absolute path from possibly relative path.

return_absolute_data_paths(data_cfg[, ...])

Generate absolute path for our example toy data.

get_videos_in_dir(video_dir[, view_names, ...])

Gather videos to process from a single directory.

check_video_paths(video_paths[, view_names])

get_context_img_paths(center_img_path)

Given the path to a center image frame, return paths of 5 context frames (n-2, n-1, n, n+1, n+2).

lightning_pose.utils.pca Module

PCA class to assist with computing PCA losses.

Functions

format_multiview_data_for_pca(data_arr, ...)

Reformat multiview data so each observation is a single body part across views.

Classes

KeypointPCA(loss_type, data_module[, ...])

Class to collect data from a dataloader and compute PCA params.

ComponentChooser(fitted_pca_object, ...)

Determine the number of PCA components to keep.

lightning_pose.utils.predictions Module

Functions for predicting keypoints on labeled datasets and unlabeled videos.

Functions

predict_dataset(cfg, data_module, preds_file)

Save predicted keypoints for a labeled dataset.

predict_single_video(cfg_file, video_file, ...)

Make predictions for a single video, loading frame sequences using DALI.

make_dlc_pandas_index(cfg, keypoint_names)

get_model_class(map_type, semi_supervised)

[summary]

load_model_from_checkpoint(cfg, ckpt_file[, ...])

Load Lightning Pose model from checkpoint file.

create_labeled_video(clip, xs_arr, ys_arr[, ...])

Helper function for creating annotated videos. Args clip xs_arr: shape T x n_joints ys_arr: shape T x n_joints mask_array: shape T x n_joints; timepoints/joints with a False entry will not be plotted dotsize: size of marker dot on labeled video colormap: matplotlib color map for markers fps: None to default to fps of original video output_video_path: video file name start_time: time (in seconds) of video start.

export_predictions_and_labeled_video(...[, ...])

Export predictions csv and a labeled video for a single video file.

Classes

PredictionHandler(cfg[, data_module, video_file])

Convert batches of model outputs into a prediction dataframe.

lightning_pose.utils.scripts Module

Helper functions to build pipeline components from config dictionary.

Functions

get_imgaug_transform(cfg)

Create simple data transform pipeline that augments images.

get_dataset(cfg, data_dir, imgaug_transform)

Create a dataset that contains labeled data.

get_data_module(cfg, dataset[, video_dir])

Create a data module that splits a dataset into train/val/test iterators.

get_loss_factories(cfg, data_module)

Create loss factory that orchestrates different losses during training.

get_model(cfg, data_module, loss_factories)

Create model: regression or heatmap based, supervised or semi-supervised.

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

calculate_train_batches(cfg[, dataset])

For semi-supervised models, this tells us how many batches to take from each dataloader (labeled and unlabeled) during a given epoch.

compute_metrics(cfg, preds_file[, data_module])

Compute various metrics on predictions csv file, potentially for multiple views.