Inference Config
Pydantic model representing CAREamics prediction configuration.
InferenceConfig
Bases: BaseModel
Configuration class for the prediction model.
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, czi, 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:
Returns:
Raises:
-
ValueError–If the patch size is 0.
-
ValueError–If the patch size is not even.
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:
-
axes(str) –Axes to validate.
Returns:
-
str–Validated axes.
Raises:
-
ValueError–If axes are not valid.
set_3D(axes, tile_size, tile_overlap)
Set 3D parameters.
Parameters:
-
axes(str) –Axes.
-
tile_size(list of int) –Tile size.
-
tile_overlap(list of int) –Tile overlap.
std_only_with_mean()
Check that mean and std are either both None, or both specified.
Returns:
-
Self–Validated prediction model.
Raises:
-
ValueError–If std is not None and mean is None.
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:
-
tile_list(list of int) –Patch size.
Returns:
-
list of int–Validated patch size.
Raises:
-
ValueError–If the patch size if smaller than 8.
-
ValueError–If the patch size is not a power of 2.