deeplabcut.utils.plotting
DeepLabCut2.0 Toolbox (deeplabcut.org) © A. & M. Mathis Labs https://github.com/DeepLabCut/DeepLabCut
Please see AUTHORS for contributors. https://github.com/DeepLabCut/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0
Functions:
| Name | Description |
|---|---|
PlottingResults |
Plots poses vs time; pose x vs pose y; histogram of differences and |
plot_edge_affinity_distributions |
Display the distribution of affinity costs of within- and between-animal edges. |
plot_trajectories |
Plots the trajectories of various bodyparts across the video. |
PlottingResults
PlottingResults(
tmpfolder,
Dataframe,
cfg,
bodyparts2plot,
individuals2plot,
showfigures=False,
suffix=".png",
resolution=100,
linewidth=1.0,
)
Plots poses vs time; pose x vs pose y; histogram of differences and likelihoods.
Source code in deeplabcut/utils/plotting.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 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 | |
plot_edge_affinity_distributions
plot_edge_affinity_distributions(eval_pickle_file, include_bodyparts='all', output_name='', figsize=(10, 7))
Display the distribution of affinity costs of within- and between-animal edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Path
|
Path to a *_full.pickle from the evaluation-results folder. |
required |
|
list of strings
|
A list of body part names whose edges are to be shown. By default, all body parts and their corresponding edges are analyzed. We recommend only passing a subset of body parts for projects with large graphs. Defaults to "all". |
'all'
|
|
string
|
Path where the plot is saved. By default, it is stored as costdist.png. |
''
|
|
tuple
|
Figure size in inches. |
(10, 7)
|
Source code in deeplabcut/utils/plotting.py
plot_trajectories
plot_trajectories(
config: str | Path,
videos: list[str | Path],
video_extensions: str | Sequence[str] | None = None,
shuffle=1,
trainingsetindex=0,
filtered=False,
displayedbodyparts="all",
displayedindividuals="all",
showfigures=False,
destfolder=None,
modelprefix="",
imagetype=".png",
resolution=100,
linewidth=1.0,
track_method="",
pcutoff: float | None = None,
**kwargs
)
Plots the trajectories of various bodyparts across the video.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Path
|
Full path of the config.yaml file. |
required |
|
list[str | Path]
|
Full paths to videos for analysis or a path to the directory, where all the videos with same extension are stored. |
required |
|
str | Sequence[str] | None
|
Controls how |
None
|
|
int
|
Integer specifying the shuffle index of the training dataset. Defaults to 1. |
1
|
|
int
|
Integer specifying which TrainingsetFraction to use. Note that TrainingFraction is a list in config.yaml. Defaults to 0. |
0
|
|
bool
|
Boolean variable indicating if filtered output should be plotted rather than
frame-by-frame predictions. Filtered version can be calculated with
|
False
|
|
list[str] or str
|
This select the body parts that are plotted in the video.
Either |
'all'
|
|
bool
|
If |
False
|
|
string or None
|
Destination folder for analysis data. If
|
None
|
|
str
|
Directory containing the deeplabcut models to use when evaluating the network. By default, the models are assumed to exist in the project folder. Defaults to "". |
''
|
|
string
|
Output image format: '.tif', '.jpg', '.svg', ".png". Defaults to ".png". |
'.png'
|
|
int
|
Specifies the resolution (in dpi) of saved figures. Note higher resolution figures take longer to generate. Defaults to 100. |
100
|
|
float
|
Specifies width of line for line and histogram plots. Defaults to 1.0. |
1.0
|
|
string
|
Specifies the tracker used to generate the data. Empty by default (corresponding to a single animal project). For multiple animals, must be either 'box', 'skeleton', or 'ellipse' and will be taken from the config.yaml file if none is given. Defaults to "". |
''
|
|
float | None
|
Overrides project pcutoff for plotting trajectories. Defaults to None. |
None
|
|
dict
|
Additional arguments. For torch-based shuffles, can be used to specify: - snapshot_index - detector_snapshot_index |
{}
|
Returns:
| Type | Description |
|---|---|
|
None |
Examples:
To label the frames
deeplabcut.plot_trajectories(
'home/alex/analysis/project/reaching-task/config.yaml',
['/home/alex/analysis/project/videos/reachingvideo1.avi'],
)
Source code in deeplabcut/utils/plotting.py
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 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |