Developing custom image augmentation techniques
Suppose the custom augmentation requires annotations loaded from one data sample (dataset_dict
). In that case, it is relatively simple to implement the custom augmentation or transformation and incorporate it using the declarative approach described in the previous section. This section focuses on more complicated augmentation types that require loading and combining inputs from multiple samples. In these cases, we need to rewrite several parts of the Detectron2 data loader system. Thus, this section describes modifications to the Detectron2 data loader system and develops two custom image augmentations (MixUp and Mosaic) for illustration purposes.
Modifying the existing data loader
The following code snippet imports some required packages and creates an extended version (ExtendedAugInput
) of the AugInput
class that also enables passing a dataset_dict
parameter. The reason is that augmentations such as MixUp and Mosaic may add annotations...