Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
 def __call__(self, img: PILImage,
              text_bbox: BBox) -> Tuple[PILImage, BBox]:
     effect = random_choice(self.effects)
     return effect(img, text_bbox)
Ejemplo n.º 3
0
 def get_text(self):
     text = random_choice(self.texts, self.cfg.num_pick)
     return "".join(text)
Ejemplo n.º 4
0
 def get_text(self):
     length = np.random.randint(*self.cfg.length)
     chars = random_choice(self.chars, length)
     text = "".join(chars)
     return text