Skip to contents

Read csv files from LightningPose (LP). Like DeepLabCut, the source is in image (top-left) coordinates and the reader reflects y to bottom_left.

Usage

read_lightningpose(path, video_height = NULL)

Arguments

path

Path to a LightningPose data file

video_height

Optional numeric height of the source video frame in pixels. Falls back to max(y) when not supplied.

Value

an aniframe. time is Lightning Pose's frame index, with the first frame of the video at 0; see "Time" in read_dataset().

Details

Lightning Pose writes DeepLabCut's csv layout, so the file is read by read_deeplabcut(). That includes the output of its Ensemble Kalman Smoother (EKS, scorer ensemble-kalman_tracker), which has nine coords per keypoint: x, y and likelihood are read, and the ensemble medians and variances and the posterior variances (x_ens_median, y_ens_median, x_ens_var, y_ens_var, x_posterior_var, y_posterior_var) are not. Its multi-camera 3D output, multicam_3d_results.csv, reads as 3D with x, y and z, without confidence and without reflecting y; see read_deeplabcut().

References

  • Biderman, D., Whiteway, M. R., Hurwitz, C., et al. (2024). Lightning Pose: improved animal pose estimation via semi-supervised learning, Bayesian ensembling and cloud-native open-source tools. Nature Methods, 21, 1316-1328. doi:10.1038/s41592-024-02319-1 .

  • Aharon, L., Whiteway, M. R., et al. (2026). Lightning Pose 3D: an uncertainty-aware framework for data-efficient multi-view animal pose estimation. bioRxiv. doi:10.64898/2026.04.20.719731 .

Examples

path <- system.file("extdata", "lightningpose.csv", package = "aniread")
read_lightningpose(path)
#> # Keypoints: ear_base_l, ear_tip_l, eye_bottom_l, eye_top_l, nose_tip,
#> #   nostril_l, nostril_r, paw_forward_l, paw_forward_lh, tongue_tip,
#> #   whisker_pad_l_side, whisker_pad_l_top
#>    keypoint    time     x        y confidence
#>    <fct>      <dbl> <dbl>    <dbl>      <dbl>
#>  1 ear_base_l     0  652.   0.0470  1.000    
#>  2 ear_base_l     1  331. 219.      0.0000106
#>  3 ear_base_l     2  394. 281.      0.900    
#>  4 ear_base_l     3  396. 280.      0.992    
#>  5 ear_base_l     4  394. 281.      0.987    
#>  6 ear_base_l     5  393. 282.      0.998    
#>  7 ear_base_l     6  393. 282.      0.998    
#>  8 ear_base_l     7  394. 281.      0.993    
#>  9 ear_base_l     8  392. 283.      0.989    
#> 10 ear_base_l     9  394. 283.      1.000    
#> # ℹ 110 more rows