SynthText_kr
SynthText_kr copied to clipboard
Encoding problem occurs
in text_utils.py Line 457, there is load call for font_model. However, I got this error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc9 in position 0: ordinal not in range(128)
I tried to change the encoding to 'utf-8' by this code from original repo by ankush-me.
with open(font_model_path,'rb') as f: # self.font_model = cp.load(f) u = cp._Unpickler(f) u.encoding = 'utf-8' p = u.load() self.font_model = p
But still not working with this error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 0: invalid continuation byte
What is the proper encoding?
@minty99 I believe it's 'latin-1'
@xxxpsyduck I tried to use 'latin-1', but then similar error occurs at line 50 of colorize3_poisson.py. If I change encoding to latin-1 similarly in text_utils.py, then I got this error:
SynthText_kr git/master*
(venv_SynthText) ❯ python make_h5.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
8010
4400 8010 8010
Traceback (most recent call last):
File "make_h5.py", line 105, in <module>
main(True)
File "make_h5.py", line 60, in main
RV3 = RendererV3(config['data_dir'], max_time=SECS_PER_IMG)
File "/DATA1/minty99/SynthText_kr/synthgen.py", line 373, in __init__
self.colorizer = Colorize(data_dir)
File "/DATA1/minty99/SynthText_kr/colorize3_poisson.py", line 152, in __init__
self.font_color = FontColor(col_file=osp.join(model_dir,'models/colors_new.cp'))
File "/DATA1/minty99/SynthText_kr/colorize3_poisson.py", line 54, in __init__
p = cp.load(f)
EOFError: Ran out of input
I also tried 'utf-8' but UnicodeDecodeError occured.
I fixed this error (It was my typo...) However, the program prints this log
4418 of 8009
** instance # : 0
THIS IS THE REASON WHY!!!!!
bg_img/monuments_66.jpg
4419 of 8009
** instance # : 0
THIS IS THE REASON WHY!!!!!
bg_img/monuments_68.jpg
I'm still investigating about this.
I found some fixes are needed to run this code with Python 3.5 and latest versions of required packages. I will make a pull request after checking the result.
Can you tell me which part of this code I need to fix? I'm having a hard time with this code^^