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 on videos using a trained network. |
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 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. |
extract_outlier_frames |
Extracts the outlier frames in case, the predictions are not correct for a |
label_frames |
Manually label/annotate the extracted frames. |
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.
Delegates to deeplabcut.add_new_videos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
String containing the full path of the config file in the project. |
required |
|
list
|
A list of string containing the full paths of the videos to include in the project. |
required |
|
bool
|
If True, symlinks of the videos are copied to
project/videos. Default |
required |
Examples:
To add a new video to the project:
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 on videos using a trained network.
Delegates to deeplabcut.analyze_videos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file in the train directory of a project. |
required |
|
list
|
Full path(s) to video(s). |
required |
|
int
|
Shuffle index of the training dataset. Defaults to 1. |
required |
|
string
|
Video extension when the input is a directory.
Defaults to |
required |
|
bool
|
Also save predictions as a CSV file. Defaults to False. |
required |
Examples:
To analyze a video:
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.
Delegates to deeplabcut.check_labels.
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.
Delegates to deeplabcut.create_labeled_video.
Make sure the video is already analyzed by the function analyze_videos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file. |
required |
|
list
|
Full path(s) to video(s). |
required |
|
int
|
Shuffle index of the training dataset. Defaults to 1. |
required |
|
string
|
Video extension when the input is a directory.
Defaults to |
required |
|
bool
|
Save individual frames before combining into video. Defaults to False. |
required |
|
bool
|
Delete individual frames after video generation. Defaults to False. |
required |
Source code in deeplabcut/cli.py
create_new_project
Create a new project directory, sub-directories and a basic configuration file.
Delegates to deeplabcut.create_new_project.
The configuration file is loaded with default values. Change its parameters to your projects need.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
String containing the name of the project. |
required |
|
string
|
String containing the name of the experimenter. |
required |
|
list
|
A list of string containing the full paths of the videos to include in the project. |
required |
|
string
|
The directory where the project will be created.
The default is the |
required |
|
bool
|
If True, symlink videos into project/videos directory.
The default is |
required |
Examples:
To create the project in the current working directory without symbolic links:
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
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 an array. Create training and test sets.
Delegates to deeplabcut.create_training_dataset.
Update parameters TrainFraction and iteration in config.yaml. Also update parameters for pose_config.yaml as wanted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file in the train directory of a |
required |
|
int
|
Number of shuffles of training dataset to create. |
required |
Examples:
To create a training dataset with only 1 shuffle:
To create a training dataset with only 2 shuffles:
Source code in deeplabcut/cli.py
evaluate_network
Evaluates a trained Feature detector model.
Delegates to deeplabcut.evaluate_network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file in the train directory of a |
required |
|
list
|
Shuffle index of the training dataset. Defaults to [1]. |
required |
|
bool
|
Make evaluation plots. Defaults to False. |
required |
Examples:
Evalaute the network:
Source code in deeplabcut/cli.py
export_model
Export DLC models for the model zoo or for live inference.
Delegates to deeplabcut.export_model.
Saves the pose configuration, snapshot files, and frozen graph of the model to a directory named exported-models within the project directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Path to the DLC Project config.yaml file. |
required |
|
int
|
The model iteration you wish to export. If None, uses the iteration listed in the config file. |
required |
|
int
|
The shuffle of the model to export. Defaults to 1. |
required |
|
int
|
Index of the training fraction for the model to export. Defaults to 0. |
required |
|
int
|
The snapshot index for the weights you wish to export. If None, uses the snapshotindex as defined in config.yaml. Defaults to None. |
required |
|
bool
|
Use the tensorflow inference model? Defaults to True. For DeepLabCut-live, set TFGPUinference=False. |
required |
|
bool
|
If the model was already exported, whether to overwrite. Defaults to False. |
required |
|
bool
|
Compress the exported directory to a tar file? Defaults to True. Required for model zoo export, not for live inference. |
required |
Source code in deeplabcut/cli.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | |
extract_frames
Extracts frames from the videos in the config.yaml file.
Delegates to deeplabcut.extract_frames.
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file as a string. |
required |
|
string
|
Mode of extraction. Must be either |
required |
|
string
|
For automatic extraction, the algorithm to use: |
required |
|
bool
|
If True, crop frames according to config.yaml parameters. |
required |
Examples:
For selecting frames automatically with 'kmeans' and do not want to crop the frames:
For selecting frames automatically with 'uniform' and want to crop the frames based on
the crop parameters in config.yaml:
To select frames manually:
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.
Delegates to deeplabcut.extract_outlier_frames.
Another crucial parameter in config.yaml is how many frames to extract 'numframes2extract'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file as a string. |
required |
|
string
|
Full path of the video to extract frames from. Make sure that this video is already analyzed. |
required |
|
string
|
Algorithm used to detect outliers.
Defaults to |
required |
|
string
|
Body parts used for comparison.
Defaults to |
required |
|
float
|
Meaning depends on outlier algorithm. Defaults to 20. |
required |
|
float
|
Likelihood threshold for |
required |
|
int
|
Autoregressive degree for |
required |
|
int
|
Moving average degree for |
required |
|
float
|
Significance level for SARIMAX outlier detection. Defaults to 0.01. |
required |
|
string
|
Algorithm for selecting outlier frames.
Defaults to |
required |
Examples:
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
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 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 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |
label_frames
Manually label/annotate the extracted frames.
Delegates to deeplabcut.label_frames.
Update the list of body parts you want to localize in the config.yaml file first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file. |
required |
Examples:
To launch the frame labeling GUI:
Source code in deeplabcut/cli.py
plot_trajectories
Plots the trajectories of various bodyparts across the video.
Delegates to deeplabcut.plot_trajectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file. |
required |
|
list
|
Full path(s) to video(s). |
required |
|
int
|
Shuffle index of the training dataset. Defaults to 1. |
required |
|
string
|
Video extension when the input is a directory. |
required |
|
bool
|
Also display plots interactively. Defaults to False. |
required |
Examples:
For plotting trajectories:
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.
Delegates to deeplabcut.refine_labels.
Helps in augmenting the training dataset. Use the function analyze_videos to
analyze a video and extract the outlier frames using extract_outlier_frames
before refining the labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file. |
required |
Examples:
To refine the labels:
Source code in deeplabcut/cli.py
train_network
Train a trained Feature detector with a specific training data set.
Delegates to deeplabcut.train_network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file in the train directory of a project. |
required |
|
int
|
Shuffle index of the training dataset. Defaults to 1. |
required |
Examples:
To train the network with the default settings: