inference_model
Pydantic model representing CAREamics prediction configuration.
InferenceConfig
#
Bases: BaseModel
Configuration class for the prediction model.
Source code in src/careamics/config/inference_model.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
axes
instance-attribute
#
Data axes (TSCZYX) in the order of the input data.
batch_size = Field(default=1, ge=1)
class-attribute
instance-attribute
#
Batch size for prediction.
data_type
instance-attribute
#
Type of input data: numpy.ndarray (array) or path (tiff or custom).
image_means = Field(..., min_length=0, max_length=32)
class-attribute
instance-attribute
#
Mean values for each input channel.
image_stds = Field(..., min_length=0, max_length=32)
class-attribute
instance-attribute
#
Standard deviation values for each input channel.
tile_overlap = Field(default=None, min_length=2, max_length=3)
class-attribute
instance-attribute
#
Overlap between tiles, only effective if tile_size
is specified.
tile_size = Field(default=None, min_length=2, max_length=3)
class-attribute
instance-attribute
#
Tile size of prediction, only effective if tile_overlap
is specified.
tta_transforms = Field(default=True)
class-attribute
instance-attribute
#
Whether to apply test-time augmentation (all 90 degrees rotations and flips).
all_elements_non_zero_even(tile_overlap)
classmethod
#
Validate tile overlap.
Overlaps must be non-zero, positive and even.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile_overlap | list[int] or None | Patch size. | required |
Returns:
Type | Description |
---|---|
list[int] or None | Validated tile overlap. |
Raises:
Type | Description |
---|---|
ValueError | If the patch size is 0. |
ValueError | If the patch size is not even. |
Source code in src/careamics/config/inference_model.py
axes_valid(axes)
classmethod
#
Validate axes.
Axes must: - be a combination of 'STCZYX' - not contain duplicates - contain at least 2 contiguous axes: X and Y - contain at most 4 axes - not contain both S and T axes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axes | str | Axes to validate. | required |
Returns:
Type | Description |
---|---|
str | Validated axes. |
Raises:
Type | Description |
---|---|
ValueError | If axes are not valid. |
Source code in src/careamics/config/inference_model.py
set_3D(axes, tile_size, tile_overlap)
#
Set 3D parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axes | str | Axes. | required |
tile_size | list of int | Tile size. | required |
tile_overlap | list of int | Tile overlap. | required |
Source code in src/careamics/config/inference_model.py
std_only_with_mean()
#
Check that mean and std are either both None, or both specified.
Returns:
Type | Description |
---|---|
Self | Validated prediction model. |
Raises:
Type | Description |
---|---|
ValueError | If std is not None and mean is None. |
Source code in src/careamics/config/inference_model.py
tile_min_8_power_of_2(tile_list)
classmethod
#
Validate that each entry is greater or equal than 8 and a power of 2.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile_list | list of int | Patch size. | required |
Returns:
Type | Description |
---|---|
list of int | Validated patch size. |
Raises:
Type | Description |
---|---|
ValueError | If the patch size if smaller than 8. |
ValueError | If the patch size is not a power of 2. |
Source code in src/careamics/config/inference_model.py
validate_dimensions()
#
Validate 2D/3D dimensions between axes and tile size.
Returns:
Type | Description |
---|---|
Self | Validated prediction model. |