We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hi,great code. Thanks for sharing. 在训练过程中,发现了一个地方有些疑问。 在数据生成的代码中有一些疑问, 在gernerator.py 的 line 180,这里需要随机生成文字。但是看到这里的逻辑确实从所有font文件中加载所有字符,而不是使用Generaotr初始化时传入的字典(self.alpha)。这个可能会导致不能更换字符集的问题。
`
def gen_image(self): idx = np.random.randint(len(self.max_len_list)) image = self.gen_background() image = image.astype(np.uint8) target_len = int(np.random.uniform(self.min_len, self.max_len_list[idx], size=1)) # 随机选择size,font size_idx = np.random.randint(len(self.font_size_list)) font_idx = np.random.randint(len(self.font_path_list)) font = self.font_list[size_idx][font_idx] font_path = self.font_path_list[font_idx] # 在选中font字体的可见字符中随机选择target_len个字符 text = np.random.choice(FONT_CHARS_DICT[font_path], target_len) text = ''.join(text)
考虑使用: text = random.choices(self.alpha[1:], k=target_len)
text = random.choices(self.alpha[1:], k=target_len)
替换
text = np.random.choice(FONT_CHARS_DICT[font_path], target_len)
但是不知道会不会出现有些字符在font文件中不存在的情况。
The text was updated successfully, but these errors were encountered:
@wayneszq 感谢您的反馈,这个问题之前已经修复了,请看fontutils.py中word_set.__contains__(c)
word_set.__contains__(c)
word_set = set(cfg.word.get_all_words()) ... ... for font, font_path in zip(font_list, font_path_list): font_chars = get_font_chars(font_path) font_chars = [c.strip() for c in font_chars if len(c) == 1 and word_set.__contains__(c) and is_char_visible(font, c)] # 可见字符 font_chars = list(set(font_chars)) # 去重 font_chars.sort() font_chars_dict[font_path] = font_chars
Sorry, something went wrong.
感谢,利用上面的功能确实可以解决:“有些字符在font文件中不存在的情况”。
另外请教两个问题:
有尝试过CRNN处理彩色文字吗?可以分享下经验吗 我把网络输入的第一个CNN input channel的输入改成了3, 正在尝试彩色的效果。loss目前下降到了0.088,60epoch左右。好像loss也没有再下降了。
请问有计划添加val 模块吗?包括tensorboard的eval图片展示等等功能。
@wayneszq 1. 彩色图像可以转为灰度图处理;2. 训练时的验证后面会加,tensorboard图像展示没有,只有scalar展示
No branches or pull requests
hi,great code. Thanks for sharing. 在训练过程中,发现了一个地方有些疑问。
在数据生成的代码中有一些疑问, 在gernerator.py 的 line 180,这里需要随机生成文字。但是看到这里的逻辑确实从所有font文件中加载所有字符,而不是使用Generaotr初始化时传入的字典(self.alpha)。这个可能会导致不能更换字符集的问题。
`
`
考虑使用:
text = random.choices(self.alpha[1:], k=target_len)
替换
text = np.random.choice(FONT_CHARS_DICT[font_path], target_len)
但是不知道会不会出现有些字符在font文件中不存在的情况。
The text was updated successfully, but these errors were encountered: