DeepLabCut 3.0 - Video Analysis with `use_shelve=True` by n-poulsen · Pull Request #2790 · DeepLabCut/DeepLabCut
Implements shelving data during video analysis for the PyTorch engine.
DeepLabCut 3.0 new API features - analyze_videos
- addition of the
use_shelve - addition of the
robust_nframesparameter for theanalyze_videos
Changes to the code
- implementation of a
ShelfReaderand aShelfWriterindeeplabcut.pose_estimation_pytorch.runners.shelving - as the
ShelfWriternow creates the_full.picklefile on-the-fly,assign_identityis called in a newAssignIndividualIdentitiespost-processor instead of invideo_inference(which is an improvement on the previous implementation)
Notes
When reading from the ShelfReader, the order of keys returned does not necessarily match the order in which the keys were inserted. This could cause the predictions for frames to be shuffled when iterating over the frame keys. To solve this issue, the nframes parameter is now used to iterate over the number of frames in the video (in _generate_assemblies_file and in convert_detections2tracklets), and a "key_str_width" parameter is added to the metadata, storing the str_width parameter so that frame keys can be recreated from the frame index.