Exemplo n.º 1
0
    def __init__(self,
                 corpus,
                 fonts,
                 bgs,
                 cfg,
                 width=256,
                 height=32,
                 clip_max_chars=False,
                 debug=False,
                 gpu=False,
                 strict=False):
        self.corpus = corpus
        self.fonts = fonts
        self.bgs = bgs
        self.out_width = width
        self.out_height = height
        self.clip_max_chars = clip_max_chars
        self.max_chars = math.floor(width / 4) - 1
        self.debug = debug
        self.gpu = gpu
        self.strict = strict
        self.cfg = cfg

        self.timer = Timer()
        self.liner = Liner(cfg)
        self.noiser = Noiser(cfg)
        self.remaper = Remaper(cfg)

        self.create_kernals()

        if self.strict:
            self.font_chars = get_fonts_chars(self.fonts, corpus.chars_file)
Exemplo n.º 2
0
    def __init__(self,
                 corpus,
                 fonts,
                 bgs,
                 cfg,
                 width=256,
                 height=32,
                 debug=False,
                 gpu=False,
                 strict=False):
        self.corpus = corpus
        self.fonts = fonts
        self.bgs = bgs
        self.out_width = width
        self.out_height = height
        self.debug = debug
        self.gpu = gpu
        self.strict = strict
        self.cfg = cfg

        self.timer = Timer()
        self.liner = Liner(cfg)
        self.noiser = Noiser(cfg)

        if self.strict:
            self.font_chars = get_fonts_chars(self.fonts, corpus.chars_file)