Skip to content

Latest commit

 

History

History
90 lines (55 loc) · 4.07 KB

HelperFunctions.md

File metadata and controls

90 lines (55 loc) · 4.07 KB

Helper Function Documentation

There are additional functions that are not required, but can be extremely helpful.

First off, if you are new to Python, you might not know this handy trick: you can see ALL the functions in deeplabcut by typing deeplabcut. then hitting "tab." You will see a massive list!

Or perhaps you sort of know the name of the function, but not fully, then you can start typing the command, i.e. as in deeplabcut.a then hit tab:

Now, for any of these functions, you type deeplabcut.analyze_videos_converth5_to_csv? you get:

Signature: deeplabcut.analyze_videos_converth5_to_csv(videopath, videotype='.avi')
Docstring:
By default the output poses (when running analyze_videos) are stored as MultiIndex Pandas Array, which contains the name of the network, body part name, (x, y) label position  in pixels, and the likelihood for each frame per body part. These arrays are stored in an efficient Hierarchical Data Format (HDF) in the same directory, where the video is stored. If the flag save_as_csv is set to True, the data is also exported as comma-separated value file. However, if the flag was *not* set, then this function allows the conversion of all h5 files to csv files (without having to analyze the videos again)!
    
This functions converts hdf (h5) files to the comma-separated values format (.csv), which in turn can be imported in many programs, such as MATLAB, R, Prism, etc.
    
 Parameters
----------
    
    videopath : string
        A strings containing the full paths to videos for analysis or a path to the directory where all the videos with same extension are stored.

    videotype: string, optional
        Checks for the extension of the video in case the input to the video is a directory.
Only videos with this extension are analyzed. The default is ``.avi``

 Examples
-----------

    Converts all pose-output files belonging to mp4 videos in the folder '/media/alex/experimentaldata/cheetahvideos' to csv files. 
    deeplabcut.analyze_videos_converth5_to_csv('/media/alex/experimentaldata/cheetahvideos','.mp4')  

While some of the names are ridiculously long, we wanted them to be "self-explanatory." Here is a list (that is bound to be continually updated) of currently available helper functions. To see information about any of them, including HOW to use them, use the ? at the end of the call, as described above.

deeplabcut.analyze_videos_converth5_to_csv

deeplabcut.mergeandsplit

deeplabcut.analyze_time_lapse_frames

deeplabcut.convertcsv2h5

deeplabcut.ShortenVideo

deeplabcut.DownSampleVideo

deeplabcut.CropVideo

deeplabcut.adddatasetstovideolistandviceversa

deeplabcut.comparevideolistsanddatafolders

deeplabcut.dropannotationfileentriesduetodeletedimages
 
deeplabcut.dropduplicatesinannotatinfiles

deeplabcut.load_demo_data

deeplabcut.merge_datasets

deeplabcut.export_model

New! Model Export function:

This function allows you to export a well-trained model for real-time applications, etc.

  • One such example use case is with the Bonsai-DeepLabCut plug in. Namely, you need to first export your trained model from DLC, then follow the instructions for Bonsai-specific use.
deeplabcut.export_model(cfg_path, iteration=None, shuffle=1, trainingsetindex=0, snapshotindex=None, TFGPUinference=True, overwrite=False, make_tar=True)