Skip to content

Optional parameters for COMnet

joshuahwu edited this page Oct 8, 2021 · 6 revisions

The COMnet has other, optional parameters that can be put in the COMnet base config (see configs/com_mouse_config.yaml) OR the project-specific io.yaml (see, e.g., demo/markerless_mouse_1/io.yaml). Put these optional parameters in the base config if you will use them across many projects, or in the io.yaml file if they are specific to a single project.


verbose.

int. Either 1 or 0. When set to 1, tensorflow will print out training and prediction progress. When set to 0, it won't. (Default: 0)

gpu_id.

string. When using multiple GPUs, use this parameter to set which GPU will be used. If this is not set, by default tensorflow will allocate all GPUs. (Default: "0")

mono.

boolean. Set to True if using monochrome videos and a monochrome version of the COMnet architecture.

dsmode.

string. Either nn or dsm. Sets the method used to downsample images, which reduced the computational load on the network, improving training and prediction times. nn is nearest neighbor, dsm is downsampling with a local mean. (Default: nn)

💡 nn loses more information, but is much faster.

downfac.

int. The factor by which images will be downsampled before being passed to the network. For instance, 4 will reduce a 1000x1000 image to 250x250. (Default: 4)

💡 more downsampling dramatically increases prediction speed but throws away more spatial information.

Training Parameters

loss.

string. This is the loss function used for training. (Default: mask_nan_keep_loss)

💡This can either be the name of a loss function inside dannce/engine/losses.py, or the name of a keras loss function. In most cases, you'll just use mask_nan_keep_loss, which is just a mean squared error loss that ignores missing labels in a sample.

sigma.

int. When using the MAX network, this value sets the size of the 2D spherical Gaussians (in mm) used as training targets for the COM. (Default: 30)

💡This should scale with the size of your species (and image size), and should roughly match the spatial deviation of your COMs across your labeled frames.

lr.

float. The learning rate used by the Adam optimizer during training. (Default: 1e-3)

💡 The learning rate is often included in hyperparameter searches. If not performing a systematic search, you might still try a few different learning rates to see if this improves performance. We do not recommend learning rates larger than 1e-2.

lockfirst.

boolean. When True, the weights in the first convolutional layer are locked during fine-tuning *(Default: False`)*.

💡 Locking early layer weights in a pre-trained CNN can improve fine-tuning in some cases.

augment_rotation.

boolean. When True, images are rotated randomly, in continuous angular units, during training as a form of image augmentation. (Default: False)

💡 Thus far, we have set this to False for all of our analyses, although it is common to use rotation augmentation in other image processing algorithms.

augment_rotation_val.

float. Sets the range or continuous rotations used, in degrees. (Default: 5).

augment_hue.

boolean. When True, image hue is randomly scaled during training as a form of image augmentation. (Default: False)

💡 Thus far, we have set this to False for all of our analyses, although hue augmentation is common in many image analysis tasks.

augment_hue_val.

float. Sets the range of hue scaling used, as a fraction of the full hue range. (Default: 0.05).

augment_brightness.

boolean. When True, image brightness is randomly scaled during training as a form of image augmentation. (Default: False)

💡 Thus far, we have set this to False for all of our analyses, although brightness augmentation is common in many image analysis tasks.

augment_bright_val.

float. Sets the range of brightness scaling used, as a fraction of the full image brightness range. (Default: 0.05).

augment_shear.

boolean. When True, images are randomly sheared during training as a form of image augmentation. (Default: False)

💡 Thus far, we have set this to False for all of our analyses, although shearing augmentation is common in many image analysis tasks.

augment_shear_val.

float. Sets the range of shearing angles used. (Default: 5).

augment_zoom.

boolean. When True, images are randomly zoomed in and out during training as a form of image augmentation. (Default: False)

💡 Thus far, we have set this to False for all of our analyses, although zoom augmentation is common in many image analysis tasks.

augment_zoom_val.

float. Sets the range of zooms used, as a fraction of the total image size. (Default: 0.05).

augment_shift.

boolean. When True, images are randomly shifted during training as a form of image augmentation. (Default: False)

💡 Thus far, we have set this to False for all of our analyses, although shift augmentation is common in many image analysis tasks.

augment_shift_val.

float. Sets the range of shifts used, as a fraction of the total image size. (Default: 5).

data_split_seed.

int. Sets the seed for the random number generator used to split data into training and testing partitions. Useful for comparing validation across separate training conditions. (Default: None).

valid_exp.

list[int]. List of indices indicating which samples to be reserved entirely for validation within the exp parameter inside the io.yaml file. (Default: None).

Prediction Parameters

start_sample.

int. Sample index you want to start predicting from in dannce-predict. Useful for parallelizing prediction over multiple GPUs. (Default: 0)

max_num_samples.

int. If not None, number of samples you will predict over. Useful for parallelizing prediction over multiple GPUs. When None, predicts over all samples. (Default: None)