convert
sleap.io.convert
¶
Command line utility for converting between various dataset formats.
Reads: * SLEAP dataset in .slp * SLEAP "analysis" file in .h5 format * LEAP dataset in .mat file * DeepLabCut dataset in .yaml or .csv file * COCO keypoints dataset in .json file
Writes: * SLEAP dataset (defaults to .slp if no extension specified) * SLEAP "analysis" file (.h5)
You don't need to specify the input format; this will be automatically detected.
If you don't specify an output path, then by default we will convert to a .slp
dataset file and save it at <input path>.slp.
Analysis HDF5:
If you want to export an "analysis" h5 file, use --format analysis. If no
output path is specified, the default is
<input path>.<video index>_<video filename>.analysis.h5.
The analysis HDF5 file has these datasets:
- "track_occupancy" (shape: tracks * frames)
- "tracks" (shape: frames * nodes * 2 * tracks)
- "track_names" (shape: tracks)
- "node_names" (shape: nodes)
- "edge_names" (shape: nodes - 1)
- "edge_inds" (shape: nodes - 1)
- "point_scores" (shape: frames * nodes * tracks)
- "instance_scores" (shape: frames * tracks)
- "tracking_scores" (shape: frames * tracks)
Note: the datasets are stored column-major as expected by MATLAB. This means that if you're working with the file in Python you may want to first transpose the datasets so they matche the shapes described above.
Functions:
| Name | Description |
|---|---|
main |
Entrypoint for |
main(args=None)
¶
Entrypoint for sleap-convert CLI for converting .slp to different formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
list
|
A list of arguments to be passed into sleap-convert. |
None
|
Source code in sleap/io/convert.py
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 | |