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
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 165 | |
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
eval_pickle_file : string Path to a *_full.pickle from the evaluation-results folder.
list of strings, optional
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.
string, optional
Path where the plot is saved. By default, it is stored as costdist.png.
tuple
Figure size in inches.
Source code in deeplabcut/utils/plotting.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
plot_trajectories
plot_trajectories(
config,
videos,
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
config: str Full path of the config.yaml file.
list[str]
Full paths to videos for analysis or a path to the directory, where all the videos with same extension are stored.
str | Sequence[str] | None, optional, default=None
Controls how videos are filtered, based on file extension.
File paths and directory contents are treated differently:
- None (default): file paths are accepted as-is; directories are
scanned for files with a recognized video extension.
- str or Sequence[str] (e.g. "mp4" or ["mp4", "avi"]):
both file paths and directory contents are filtered by the given
extension(s).
int, optional, default=1
Integer specifying the shuffle index of the training dataset.
int, optional, default=0
Integer specifying which TrainingsetFraction to use. Note that TrainingFraction is a list in config.yaml.
bool, optional, default=False
Boolean variable indicating if filtered output should be plotted rather than
frame-by-frame predictions. Filtered version can be calculated with
deeplabcut.filterpredictions.
list[str] or str, optional, default="all"
This select the body parts that are plotted in the video.
Either all, then all body parts from config.yaml are used,
or a list of strings that are a subset of the full list.
E.g. ['hand','Joystick'] for the demo Reaching-Mackenzie-2018-08-30/config.yaml
to select only these two body parts.
bool, optional, default=False
If True then plots are also displayed.
string or None, optional, default=None
Specifies the destination folder that was used for storing analysis data. If
None, the path of the video is used.
str, optional, default=""
Directory containing the deeplabcut models to use when evaluating the network. By default, the models are assumed to exist in the project folder.
string, optional, default=".png"
Specifies the output image format - '.tif', '.jpg', '.svg' and ".png".
int, optional, default=100
Specifies the resolution (in dpi) of saved figures. Note higher resolution figures take longer to generate.
float, optional, default=1.0
Specifies width of line for line and histogram plots.
string, optional, default=""
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.
string, optional, default=None
Overrides the pcutoff set in the project configuration to plot the trajectories.
additional arguments.
For torch-based shuffles, can be used to specify: - snapshot_index - detector_snapshot_index
Returns
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
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 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |