Transform Configs¶
- pydantic model SkiNet.ML.configs.transform_configs.transform_config.TransformConfig[source]¶
Bases:
BaseTransformConfigMain configuration for transformations applied to samples, including cropping and augmentations.
- Fields:
crop (SkiNet.ML.configs.transform_configs.crop_config.CropConfig)normalization_mode (Literal['standard', 'image_per_channel', 'image', 'min_max'])photometric_augmentation (SkiNet.ML.configs.transform_configs.augment_config.PhotoAugmentConfig)spatial_augmentation (SkiNet.ML.configs.transform_configs.augment_config.SpatialAugmentConfig)
- field crop: CropConfig [Optional]¶
Cropping configuration for segmentation experiments, including crop size and method.
- field normalization_mean: tuple[float, float, float] | None = None¶
Per-channel mean for ‘standard’ normalization (R, G, B), values in [0, 1]. Required when normalization_mode=’standard’. Compute with compute_dataset_stats.py.
- field normalization_mode: Literal['standard', 'image_per_channel', 'image', 'min_max'] = 'image_per_channel'¶
Albumentations normalization mode. Use ‘standard’ with dataset-level mean/std (fastest — fixed constants, no per-image reductions). ‘image_per_channel’ computes mean/std per sample at runtime and is ~20x slower. ‘image’ and ‘min_max’ are intermediate options.
- field normalization_std: tuple[float, float, float] | None = None¶
Per-channel std for ‘standard’ normalization (R, G, B), values in [0, 1]. Required when normalization_mode=’standard’. Compute with compute_dataset_stats.py.
- field photometric_augmentation: PhotoAugmentConfig [Optional]¶
Photometric augmentation configuration for segmentation experiments, including random brightness/contrast adjustments, hue/saturation adjustments, and RGB shifts.
- field spatial_augmentation: SpatialAugmentConfig [Optional]¶
Spatial augmentation configuration for segmentation experiments, including random flips, affine transformations, perspective transformations, and square symmetry.
- pydantic model SkiNet.ML.configs.transform_configs.crop_config.CropConfig[source]¶
Bases:
BaseModelDefault configuration for cropping in segmentation.
- Fields:
- field crop_type: Literal['center_crop', 'random_crop', 'random_resized_crop'] = 'random_resized_crop'¶
Type of cropping to apply. Required if crop_apply is True.
- pydantic model SkiNet.ML.configs.transform_configs.augment_config.SpatialAugmentConfig[source]¶
Bases:
BaseModelDefault configuration for spatial image augmenation in segmentation experiments using Albumentations library. Note that spatial augmentations are geometric transformations that manipulate the spatial arrangement of pixels in an image.
References: Chlap, P., Min, H., Vandenberg, N., Dowling, J., Holloway, L., & Haworth, A. (2021). A review of medical image data augmentation techniques for deep learning applications. Journal of medical imaging and radiation oncology, 65(5), 545-563
Basic augmentation techniques:
geometric: geometric transformations (scaling, translation, rotation, flipping, shear, skew); cropping; occlusion
photometric: gamma contrast, linear contrast, histogram equalization; filtering; adding noise (Gaussian, salt and pepper, uniform)
Deformable augmentation techniques:
randomised displacement of pixels
spline interpolation (B-splines)
deformable image registration
statistical shape models
- field affine_scale: Tuple[float, float] = (0.8, 1.0)¶
Scaling (zoom) factor for affine transformation.
- field affine_translate_percent: dict[str, float | Tuple[float, float]] [Optional]¶
Translation as a fraction of the image size.
- field elastic_p: float = 0.3¶
Probability of applying elastic deformation.
- Constraints:
ge = 0.0
le = 1.0
- field elastic_sigma: float = 10.0¶
Gaussian smoothing factor; larger values produce smoother deformation.
- field perspective_p: float = 0.2¶
Probability of applying perspective transformation.
- Constraints:
ge = 0.0
le = 1.0
- pydantic model SkiNet.ML.configs.transform_configs.augment_config.PhotoAugmentConfig[source]¶
Bases:
BaseModelDefault configuration for photometric image augmenation in segmentation experiments using Albumentations library. Note that photometric augmentations are transformations that manipulate the intensity values of pixels in an image without changing their spatial arrangement.
References: Chlap, P., Min, H., Vandenberg, N., Dowling, J., Holloway, L., & Haworth, A. (2021). A review of medical image data augmentation techniques for deep learning applications. Journal of medical imaging and radiation oncology, 65(5), 545-563.
Photometric augmentation techniques: - gamma contrast, linear contrast, histogram equalization - filtering (convolution to sharpen, blur or smooth) - adding noise (Gaussian, salt and pepper, uniform)
Implemented transforms: - ColorJitter (albumentations.ColorJitter) - GaussianBlur (albumentations.GaussianBlur) - GaussNoise (albumentations.GaussNoise)
- Fields:
- field color_jitter_p: float = 0.5¶
Probability of applying color jitter.
- Constraints:
ge = 0.0
le = 1.0
- field gaussian_blur_p: float = 0.2¶
Probability of applying Gaussian blur.
- Constraints:
ge = 0.0
le = 1.0
- field gaussian_blur_sigma_limit: Tuple[float, float] = (0.5, 2.0)¶
Sigma range for Gaussian blur kernel.