def apply(self, img, **params): if img.ndim == 3 and img.shape[2] > 1 and img.dtype == np.uint8: # Opencv is faster than numpy only in case of # non-gray scale 8bits images return af.hflip_cv2(img) else: return af.hflip(img)
def albumentations(self, img): if img.ndim == 3 and img.shape[2] > 1 and img.dtype == np.uint8: return albumentations.hflip_cv2(img) else: return albumentations.hflip(img)