### Example Configuration Parameter Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Defines a configuration parameter with its type, default value, and a descriptive comment. The comment must start with the parameter's type. ```yaml frame_limit: 15 # int; tracklets shorter than this number of frames will be discarded ``` -------------------------------- ### Run Episode with Parameter Updates Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Start a new training episode with modified parameters. Use `parameters_update` to specify changes to configuration files like 'general' or 'ssl'. ```python project.run_episode( 'episode_5', parameters_update={ 'general': {'ssl': ['contrastive']}, 'ssl': {'contrastive': {'ssl_weight': 0.01}}, }, ) ``` -------------------------------- ### Initialize DLC2Action Project Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Instantiate a Project object to begin your experiments. Ensure the project name is provided, and optionally, the projects path if it was used during project creation. ```python from dlc2action.project import Project project = Project('project_name') ``` -------------------------------- ### Run Episode Loading Previous Model and Parameters Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Create a new episode that loads a previously trained model. You can specify the episode and epoch to load from. By default, the last saved epoch is used. ```python project.run_episode( 'episode_6', parameters_update={'training': {'batch_size': 64}}, load_episode='episode_2', load_epoch=100, ) ``` -------------------------------- ### Initialize a new dlc2action Project via Terminal Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Use the dlc2action_init command to create a new project from the terminal, providing project details as arguments. ```bash $ dlc2action_init --name project_name -d data_type -a annotation_type -dp path/to/data_folder -ap path/to/annotation_folder ``` -------------------------------- ### Run a Single Training Episode Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Execute a single training episode using default project parameters. The results are saved under the specified episode name in the meta files. ```python project.run_episode('episode_1') ``` -------------------------------- ### Run Training Episode with Specific Parameters Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Loads specific parameters for training and runs the 'episode_best_params' episode. The `round_to_binary` parameter is useful for parameters like feature map count, rounding to the nearest power of two. ```python project.run_episode( 'episode_best_params', load_search='search_1', load_parameters=['data/overlap', 'general/ssl'], ) ``` -------------------------------- ### Create a new dlc2action Project in Python Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Instantiate the Project class to create a new project, specifying essential details like name, data types, and paths. ```python from dlc2action.project import Project project = Project( 'project_name', data_type='data_type', annotation_type='annotation_type', data_path='path/to/data/folder', annotation_path='path/to/annotation/folder', ) ``` -------------------------------- ### Update Parameters and Run Episode with Best Parameters Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Loads specific parameters from a search result to update configuration files and runs a training episode using other parameters from the same search. The `round_to_binary` option can be used to round certain parameters to the nearest power of two. ```python project.update_parameters( load_search='search_1', load_parameters=['training/lr', 'model/num_f_maps'], round_to_binary=['model/num_f_maps'], ) project.run_episode( 'episode_best_params', load_search='search_1', load_parameters=['data/overlap', 'general/ssl'], ) ``` -------------------------------- ### List Episodes with Filters Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Provides a summary table of training episodes, with options to filter by episode names, display specific parameters, and apply value-based filters on parameters like recall and training time. ```python project.list_episodes( episodes=['episode_1', 'episode_2', 'episode_3', 'episode_4'], display_parameters=['meta/time', 'results/recall', 'training/lr'], episode_filter='results/recall:>0.4,meta/training_time:>=00:30:00', ) ``` -------------------------------- ### Run Hyperparameter Search Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Initiates a hyperparameter search using Optuna. Define the search space, optimization metric, number of trials, and other search parameters. Pruning can be enabled for efficiency. ```python project.run_hyperparameter_search( search_space={ "data/overlap": ("int", 10, 80), "general/ssl": ( "categorical", [["contrastive"], ["contrastive", "masked_features"]] ), "training/lr": ("float_log": 1e-4, 1e-2), "model/num_f_maps": ("int_log", 8, 64), }, metric="recall", n_trials=50, average=5, search_name="search_1", direction="maximize", prune=True, ) ``` -------------------------------- ### List and Filter Training Episodes Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Lists training episodes with filtering options for episode names, displayed parameters, and parameter values. Filters can be combined for precise data retrieval. ```python project.list_episodes( episodes=['episode_1', 'episode_2', 'episode_3', 'episode_4'], display_parameters=['meta/time', 'results/recall', 'training/lr'], episode_filter='results/recall::>0.4,meta/training_time::>=00:30:00', ) ``` -------------------------------- ### Run Hyperparameter Search with dlc2action Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Initiates a hyperparameter search using optuna. Define the search space with parameter names and their types (int, float, categorical), specify the optimization metric, number of trials, and other search parameters like averaging, search name, direction, and pruning. ```python project.run_hyperparameter_search( search_space={ "data/overlap": ("int", 10, 80), "general/ssl": ( "categorical", [["contrastive"], ["contrastive", "masked_features"]] ), "training/lr": ("float_log": 1e-4, 1e-2), "model/num_f_maps": ("int_log", 8, 64), }, metric="recall", n_trials=50, average=5, search_name="search_1", direction="maximize", prune=True, ) ``` -------------------------------- ### Continue a Previously Run Episode Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Resume training for an existing episode. All parameters and state dictionaries are loaded, allowing training to continue from where it stopped. The episode will be re-saved under the same name. Note that `num_epochs` specifies the new total number of epochs. ```python project.continue_episode('episode_2', num_epochs=500) ``` -------------------------------- ### Run Multiple Training Episodes Consecutively Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Train multiple episodes in a sequence. This can save time by reusing the Task instance across episodes. ```python project.run_episodes(['episode_2', 'episode_3', 'episode_4']) ``` -------------------------------- ### Fill dlc2action Project Parameters via Terminal Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Use the dlc2action_fill command to update project configuration parameters. The --all flag prompts for all parameters, otherwise it focuses on missing '???' fields. ```bash $ dlc2action_fill --name project_name --all ``` -------------------------------- ### Visualize Model Predictions Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Generates a prediction for a random sample and visualizes it against the ground truth. Customize parameters for different visualization needs. ```python project.visualize_results('episode_1', load_epoch=50) ``` -------------------------------- ### Plot Training Curves for Multiple Episodes Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Compares training or validation accuracy curves across multiple episodes. Specify the episodes and metrics to plot. ```python project.plot_episodes(['episode_1', 'episode_2'], metrics=['accuracy']) ``` -------------------------------- ### Run Prediction and Suggestion Tasks Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Executes prediction tasks to generate pickled dictionaries or suggestion files for the GUI. Supports specifying the episode, epoch, data subset, or custom data path. ```python project.run_prediction('prediction_1', episode_name='episode_3', load_epoch=150, mode='test') ``` ```python project.run_suggestion( 'suggestion_new_data', suggestion_episode='episode_4', suggestion_classes=['sleeping', 'eating'], suggestion_threshold=0.6, exclude_classes=['inactive'], data_path='/path/to/new_data_folder', ) ``` -------------------------------- ### Update Parameters from Search Results Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Loads the best parameters from a completed hyperparameter search to update the current configuration. ```python project.update_parameters( load_search='search_1', ``` -------------------------------- ### List Best Parameters from a Search Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Retrieves and displays the best parameters found from a previously completed hyperparameter search. Specify the name of the search to query. ```python project.list_best_parameters('search_1') ``` -------------------------------- ### List Best Hyperparameter Search Results Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Retrieves and displays the best parameters found from a specified hyperparameter search. ```python project.list_best_parameters('search_1') ``` -------------------------------- ### Plot Training and Validation Recall Curves Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Plots training and validation recall curves for a specified episode. Useful for analyzing performance trends within a single episode. ```python project.plot_episodes(['episode_3'], metrics=['recall'], modes=['train', 'val']) ``` -------------------------------- ### Plot Combined Episode Curves Source: https://amathislab.github.io/DLC2action/html_docs/dlc2action.html Plots several episodes as a single curve, useful for comparing models where one loaded from another. Specify episodes and metrics. ```python project.plot_episodes([['episode_2', 'episode_6'], 'episode_4'], metrics=['precision']) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.