deeplabcut.utils.conversioncode
Functions:
| Name | Description |
|---|---|
adapt_labeled_data_to_new_project |
Given the config.yaml file, this function will convert the labels of an ancient |
analyze_videos_converth5_to_csv |
By default the output poses (when running analyze_videos) are stored as |
analyze_videos_converth5_to_nwb |
Convert all h5 output data files in |
convertcsv2h5 |
Convert (image) annotation files in folder labeled-data from csv to h5. |
merge_windowsannotationdataONlinuxsystem |
If a project was created on Windows (and labeled there,) but ran on unix then the |
adapt_labeled_data_to_new_project
adapt_labeled_data_to_new_project(config_path, remove_old_bodyparts=False, other_scorer=False, userfeedback=False)
Given the config.yaml file, this function will convert the labels of an ancient project to a new project. For this, the labeled data must be in the project folder, under the labeled-data folder and with the same configuration as all deeplabcut projects.
Parameters
config_path : str The path to the config.yaml file. remove_old_bodyparts : bool (default = False) If True, the old bodyparts that are not in the new project will be removed from the dataframe. other_scorer : bool (default = False) If True, the labels will be converted to the new scorer. userfeedback : bool (default = True) If true the user will be asked specifically for each folder in labeled-data if the containing csv shall be converted to hdf format.
Source code in deeplabcut/utils/conversioncode.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
analyze_videos_converth5_to_csv
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. 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
video_folder : string Absolute path of a folder containing videos and the corresponding h5 data files.
videotype: string, optional (default=.mp4) Only videos with this extension are screened.
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')
Source code in deeplabcut/utils/conversioncode.py
analyze_videos_converth5_to_nwb
Convert all h5 output data files in video_folder to NWB format.
Parameters
config : string Absolute path to the project YAML config file.
string
Absolute path of a folder containing videos and the corresponding h5 data files.
string, optional (default=.mp4)
Only videos with this extension are screened.
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')
Source code in deeplabcut/utils/conversioncode.py
convertcsv2h5
Convert (image) annotation files in folder labeled-data from csv to h5. This function allows the user to manually edit the csv (e.g. to correct the scorer name and then convert it into hdf format). WARNING: conversion might corrupt the data.
string
Full path of the config.yaml file as a string.
bool, optional
If true the user will be asked specifically for each folder in labeled-data if the containing csv shall be converted to hdf format.
string, optional
If a string is given, then the scorer/annotator in all csv and hdf files that are changed, will be overwritten with this name.
Examples
Convert csv annotation files for reaching-task project into hdf.
deeplabcut.convertcsv2h5('/analysis/project/reaching-task/config.yaml')
Convert csv annotation files for reaching-task project into hdf while changing the scorer/annotator in all annotation files to Albert!
deeplabcut.convertcsv2h5('/analysis/project/reaching-task/config.yaml',scorer='Albert')
Source code in deeplabcut/utils/conversioncode.py
merge_windowsannotationdataONlinuxsystem
If a project was created on Windows (and labeled there,) but ran on unix then the data folders corresponding in the keys in cfg['video_sets'] are not found.
This function gets them directly by looping over all folders in labeled-data