def get_bg(self) -> PILImage: # TODO: add efficient data augmentation if self.pre_load: return random_choice(self.bg_imgs) bg_path = random_choice(self.bg_paths) pil_img = self._get_bg(bg_path) return pil_img
def __call__(self, img: PILImage, text_bbox: BBox) -> Tuple[PILImage, BBox]: effect = random_choice(self.effects) return effect(img, text_bbox)
def get_text(self): text = random_choice(self.texts, self.cfg.num_pick) return "".join(text)
def get_text(self): length = np.random.randint(*self.cfg.length) chars = random_choice(self.chars, length) text = "".join(chars) return text