How to customize a Transform in Albumentations

37 Views Asked by At

I'm working on a data augmentation problem on 2D object detection task, during which customized transforms are needed to transform both the input image and its corresponding labels.

given an image and its yolo label:

image = get_image() # image shape (H, W, 3)
label = get_label() # yolo label [cls_id, xc, yc, hn, wn]

For example, create a CopyPaste transform

class CopyPaste(DualTransform):

    def apply(self, img, factor=0, **params):
        return img

    def apply_to_bbox(self, bbox, factor=0, **params):
        return bbox

I suppose customizing the apply and apply_to_bbox would do the job?

any suggesstions are welcome

0

There are 0 best solutions below