Applying existing image augmentation techniques
Augmentations are in the Mapper
component. A Mapper
receives a list of augmentations and applies them to the image and annotations accordingly. The following code snippet creates a Detectron2 trainer and specifies a list of existing augmentations to use:
class MyTrainer(DefaultTrainer): @classmethod def build_train_loader(cls, cfg): augs = [] # Aug 1: Add RandomBrightness with 50% chance # Aug 2: Add ResizeShortestEdge # Aug 3: Add RandomFlipping mapper = DatasetMapper(cfg, is_train = True, ...