Sanster / text_renderer

Generate text images for training deep learning ocr model
MIT License
1.39k stars 384 forks source link

出现assert width > height无限循环 #60

Open MrZWJax opened 5 years ago

MrZWJax commented 5 years ago

运行过程中一开始没有问题,过一会儿就会出现assert width > height,然后一直循环在这个报错中,请问怎么解决

after pick font After draw_text_on_bg after pick font Retry gen_img: Traceback (most recent call last): File "main.py", line 67, in gen_img_retry return renderer.gen_img(img_index) File "/home/mrzwjax/PycharmProjects/text_renderer/textrenderer/renderer.py", line 50, in gen_img bg = self.gen_bg(width=word_size[0] 8, height=word_size[1] 8) File "/home/mrzwjax/PycharmProjects/text_renderer/textrenderer/renderer.py", line 403, in gen_bg bg = self.gen_bg_from_image(int(width), int(height)) File "/home/mrzwjax/PycharmProjects/text_renderer/textrenderer/renderer.py", line 425, in gen_bg_from_image assert width > height

uceclz0 commented 4 years ago

同样遇到了该问题,是在设置了背景图之后,请问您解决了吗

zhangyingying520 commented 2 years ago

同样遇到了该问题,是在设置了背景图之后,请问您解决了吗

同问,一加背景图就出问题

tronghieuit commented 1 year ago
def gen_bg_from_image(self, width, height):
    """
    Resize background, let bg_width>=width, bg_height >=height, and random crop from resized background
    """
    if height >= width:
        height = width - 1
    assert width > height
    ......

I edited the code to be able to run the code with 1 character @uceclz0 @zhangyingying520 @MrZWJax