deeplabcut.cli
Functions:
| Name | Description |
|---|---|
add_new_videos |
Add new videos to the config file at any stage of the project. |
analyze_videos |
Makes prediction. |
check_labels |
Check if labels were stored correctly by plotting annotations and inspect them |
create_labeled_video |
Labels the bodyparts in a video. |
create_new_project |
Create a new project directory, sub-directories and a basic configuration file. |
create_training_dataset |
Combine frame and label information into a an array. Create training and test sets. |
evaluate_network |
Evaluates a trained Feature detector model. |
export_model |
Export DLC models for the model zoo or for live inference. |
extract_frames |
Extracts frames from the videos in the config.yaml file. Only the videos in the |
extract_outlier_frames |
Extracts the outlier frames in case, the predictions are not correct for a |
label_frames |
Manually label/annotate the extracted frames. Update the list of body parts you |
plot_trajectories |
Plots the trajectories of various bodyparts across the video. |
refine_labels |
Refines the labels of the outlier frames extracted from the analyzed videos. |
train_network |
Train a trained Feature detector with a specific training data set. |
add_new_videos
Add new videos to the config file at any stage of the project. .
Options
----------
config : string
String containing the full path of the config file in the project.
videos : list
A list of string containing the full paths of the videos to include in the project.
copy_videos : bool, optional
If this is set to True, the symlink of the videos are copied to the project/videos directory. The default is
``True``; if provided it must be either ``True`` or ``False``
Examples
--------
>>> python3 dlc.py add_new_videos /home/project/reaching-task-Tanmay-2018-08-23/config.yaml /data/videos/mouse5.avi
Source code in deeplabcut/cli.py
analyze_videos
Makes prediction.
CONFIG: Full path of the "config.yaml" file in the train directory of a project.
VIDEOS: Full path to video.
Example
python3 dlc.py analyze_videos /home/project/reaching/config.yaml /home/project/reaching/newVideo/1.avi
Source code in deeplabcut/cli.py
check_labels
Check if labels were stored correctly by plotting annotations and inspect them visually.
If some are wrong, then use the refine_labels to correct the labels.
Source code in deeplabcut/cli.py
create_labeled_video
Labels the bodyparts in a video.
Make sure the video is already analyzed by the function 'analyze_video'
Source code in deeplabcut/cli.py
create_new_project
Create a new project directory, sub-directories and a basic configuration file. The configuration file is loaded with default values. Change its parameters to your projects need. .
Options
----------
project : string
String containing the name of the project.
experimenter : string
String containing the name of the experimenter.
videos : list
A list of string containing the full paths of the videos to include in the project.
working_directory : string, optional
The directory where the project will be created.
The default is the ``current working directory``; if provided, it must be a string
copy_videos : bool, optional
If this is set to True, the symlink of the videos are copied to the project/videos directory.
The default is ``True``; if provided it must be either ``True`` or ``False``
Example
--------
To create the project in the current working directory
python3 dlc.py create_new_project reaching-task
Tanmay /data/videos/mouse1.avi /data/videos/mouse2.avi /data/videos/mouse3.avi /analysis/project/
To create the project in the current working directory but do not want to create the symlinks
python3 dlc.py create_new_project reaching-task
Tanmay /data/videos/mouse1.avi /data/videos/mouse2.avi /data/videos/mouse3.avi /analysis/project/ -c False
To create the project in another directory
python3 dlc.py create_new_project reaching-task
Tanmay /data/vies/mouse1.avi /data/videos/mouse2.avi /data/videos/mouse3.avi analysis/project -d home/project
Source code in deeplabcut/cli.py
create_training_dataset
Combine frame and label information into a an array. Create training and test sets. Update parameters TrainFraction, iteration in config.yaml Also update parameters for pose_config.yaml as wanted.
CONFIG: Full path of the config.yaml file in the train directory of a project.
Example
To create a training dataset with only 1 shuffle python3 dlc.py create_training_dataset /analysis/project/reaching-task/config.yaml
To create a training dataset with only 2 shuffles python3 dlc.py create_training_dataset /analysis/project/reaching-task/config.yaml num_shuffles 2
Source code in deeplabcut/cli.py
evaluate_network
Evaluates a trained Feature detector model.
CONFIG: Full path of the "pose_config.yaml" file in the train directory of a project.
Example
Evalaute the network python3 dlc.py evaluate_network /home/project/reaching/config.yaml
Source code in deeplabcut/cli.py
export_model
Export DLC models for the model zoo or for live inference. Saves the pose configuration, snapshot files, and frozen graph of the model to a directory named exported-models within the project directory.
Parameters
cfg_path : string
path to the DLC Project config.yaml file
iteration : int, optional
the model iteration you wish to export.
If None, uses the iteration listed in the config file
shuffle : int, optional
the shuffle of the model to export. default = 1
trainingsetindex : int, optional
the index of the training fraction for the model you wish to export. default = 1
snapshotindex : int, optional
the snapshot index for the weights you wish to export.
If None, uses the snapshotindex as defined in 'config.yaml'. Default = None
TFGPUinference : bool, optional
use the tensorflow inference model? Default = True
For inference using DeepLabCut-live, it is recommended to set TFGPIinference=False
overwrite : bool, optional
if the model you wish to export has already been exported, whether to overwrite. default = False
make_tar : bool, optional
Do you want to compress the exported directory to a tar file? Default = True
This is necessary to export to the model zoo, but not for live inference.
Source code in deeplabcut/cli.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | |
extract_frames
Extracts frames from the videos in the config.yaml file. Only the videos in the
config.yaml will be used to select the frames.
Use the function add_new_videos
at any stage of the project to add new videos to the config file and extract their
frames.
.
CONFIG : string
Full path of the config.yaml file as a string.
MODE : string
String containing the mode of extraction. It must be either ``automatic`` or ``manual``.
Examples
--------
for selecting frames automatically with 'kmeans' and do not want to crop the frames
>>> python3 dlc.py extract_frames /analysis/project/reaching-task/config.yaml automatic --algo kmeans
--------
for selecting frames automatically with 'uniform' and want to
crop the frames based on the ``crop`` parameters in config.yaml
>>> python3 dlc.py extract_frames /analysis/project/reaching-task/config.yaml automatic --crop
--------
for selecting frames manually,
>>> deeplabcut.extract_frames /analysis/project/reaching-task/config.yaml manual
While selecting the frames manually, you do not need to specify the cropping parameters.
Rather, you will get a prompt in the graphic user interface to choose if you need to crop or not.
--------
Source code in deeplabcut/cli.py
extract_outlier_frames
Extracts the outlier frames in case, the predictions are not correct for a certain video from the cropped video running from start to stop as defined in config.yaml.
Another crucial parameter in config.yaml is how many frames to extract 'numframes2extract'.
CONFIG : string
Full path of the config.yaml file as a string.
VIDEO : Full path of the video to extract the frame from. Make sure that this video is already analyzed.
Example
for extracting the frames with default settings
python3 dlc.py extract_outlier_frames /analysis/project/reaching-task/config.yaml ... /analysis/project/video/reachinvideo1.avi
for extracting the frames with kmeans
python3 dlc.py extract_outlier_frames /analysis/project/reaching-task/config.yaml ... /analysis/project/video/reachinvideo1.avi --extractionalgorithm 'kmeans'
for extracting the frames with kmeans and epsilon = 5 pixels.
python3 dlc.py extract_outlier_frames /analysis/project/reaching-task/config.yaml ... /analysis/project/video/reachinvideo1.avi --epsilon 5 --extractionalgorithm kmeans
Source code in deeplabcut/cli.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | |
label_frames
Manually label/annotate the extracted frames. Update the list of body parts you want to localize in the config.yaml file first. .
Example
--------
python3 dlc.py label_frames /analysis/project/reaching-task/config.yaml
Source code in deeplabcut/cli.py
plot_trajectories
Plots the trajectories of various bodyparts across the video. .
Example
--------
for labeling the frames
>>> python3 dlc.py plot_trajectories /analysis/project/reaching-task/config.yaml
/analysis/project/videos/reachingvideo1.avi
--------
Source code in deeplabcut/cli.py
refine_labels
Refines the labels of the outlier frames extracted from the analyzed videos.
Helps in augmenting the training dataset. Use the function ``analyze_video`` to
analyze a video and extracts the outlier frames using the function
``extract_outlier_frames`` before refining the labels.
.
Examples
--------
>>> python3 dlc.py refine_labels /analysis/project/reaching-task/config.yaml
--------
Source code in deeplabcut/cli.py
train_network
Train a trained Feature detector with a specific training data set.
Provide path to the pose_config file.
CONFIG: Full path of the config.yaml file in the train directory of a project.
e.g. run the script like this: python3 dlc.py step7_train /home/project/reaching/config.yaml