utils
sleap_nn.config.utils
¶
Utilities for config building and validation.
Functions:
Name | Description |
---|---|
check_output_strides |
Check max_stride and output_stride in backbone_config with head_config. |
get_backbone_type_from_cfg |
Return the backbone type from the config. One of [unet, swint, convnext]. |
get_model_type_from_cfg |
Return the model type from the config. One of [single_instance, centroid, centered_instance, bottomup]. |
get_output_strides_from_heads |
Get list of output strides from head configs. |
oneof |
Ensure that the decorated attrs class only has a single attribute set. |
check_output_strides(config)
¶
Check max_stride and output_stride in backbone_config with head_config.
Source code in sleap_nn/config/utils.py
get_backbone_type_from_cfg(config)
¶
Return the backbone type from the config. One of [unet, swint, convnext].
Source code in sleap_nn/config/utils.py
get_model_type_from_cfg(config)
¶
Return the model type from the config. One of [single_instance, centroid, centered_instance, bottomup].
Source code in sleap_nn/config/utils.py
get_output_strides_from_heads(head_configs)
¶
Get list of output strides from head configs.
Source code in sleap_nn/config/utils.py
oneof(attrs_cls, must_be_set=False)
¶
Ensure that the decorated attrs class only has a single attribute set.
This decorator is inspired by the oneof
protobuffer field behavior.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attrs_cls
|
An attrs decorated class. |
required | |
must_be_set
|
bool
|
If True, raise an error if none of the attributes are set. If not, error will only be raised if more than one attribute is set. |
False
|
Returns:
Type | Description |
---|---|
The |
Source code in sleap_nn/config/utils.py
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 |
|