Augmentations

December 14, 2022 · View on GitHub

class Augmentation:
    def _augment(self, sample: Sample) -> Sample:
        raise NotImplementedError("Please Implement this method")

    def _set_metadata(self, sample: Sample) -> Sample:
        return sample

    def __call__(self, sample: Sample) -> Sample:
        sample = init_augmentation(sample)
        sample = self._augment(sample)
        sample = self._set_metadata(sample)
        return sample

Base types of augmentations

InterfaceDescriptionMetadata ChangesCode
AugmentationBase Augmentation class from which every Augmentation inheritsNonehere
OODAugmentationAugmentation that transforms ID images into OOD images e.g. artifactsOOD Flag, Augmentation severity if providedhere
INAugmentationAugmentation that does not change the OOD flag but keeps the data IN Distribution e.g. cropping or resizing of imagesNonehere
AugmentationCompositeAn Augmentation composite is a combination of multiple augmentations e.g. pick N of a listDependent of parametershere

Special types of augmentations

InterfaceDescriptionMetadata ChangesCode
SampableAugmentationSample Augmentation have sampable parameters which makes it possible to run an experiment with augmentations with different parameter values e.g. different scales for artifactsKeeps Changes of base augmentationhere
ArtifactAugmentationAn Artifact Augmentation is a realization of an OODAugmentation and therefore inherits from it. This interface comes with a method that overlays an artifact on the imagelike OODAugmentationhere

FrOoDos Augmentations

NameShort descriptionInterfaceCode
DarkSpotsAugmentationCreates a dark spot on the imageArtifactAugmentation, SampableAugmentation, OODAugmentationhere
FatAugmentationCreates a fat drop on the imageArtifactAugmentation, SampableAugmentation, OODAugmentationhere
SquamousAugmentationCreates a tissue piece on the imageArtifactAugmentation, SampableAugmentation, OODAugmentationhere
ThreadAugmentationCreates a thread on the imageArtifactAugmentation, SampableAugmentation, OODAugmentationhere
GaussianBlurAugmentationBlures the imageSampableAugmentation, OODAugmentationhere
ZoomInAugmentationCrops the image and then resizes it back to original sizeSampableAugmentation, OODAugmentationhere
BrightnessAugmentationChanges brightness of imageSampableAugmentation, OODAugmentationhere
InCropCrops imageINAugmentationhere
InResizeResizes imageINAugmentationhere

References

[1] Schömig-Markiefka, B., Pryalukhin, A., Hulla, W., Bychkov, A., Fukuoka, J., Mad- abhushi, A., Achter, V., Nieroda, L., Büttner, R., Quaas, A., et al.: Quality control stress test for deep learning-based diagnostic model in digital pathology. Modern Pathology (2021)