Skip to content
New issue

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

crnn训练部分 lable问题 #12

Open
qixxtny opened this issue Jul 21, 2019 · 7 comments
Open

crnn训练部分 lable问题 #12

qixxtny opened this issue Jul 21, 2019 · 7 comments

Comments

@qixxtny
Copy link

qixxtny commented Jul 21, 2019

def __getitem__(self, index):
	label = [int(x) for x in keys] 
    请问label是要识别的str,怎么转成int呢?
@guess3w
Copy link

guess3w commented Aug 30, 2019

同问,这个怎么解决?用字典编号解决?
看了下代码,反推识别的字是如何得来的:result->cor.model()->carRec()->predict()->decode()
在orc.py中 decode()函数里,貌似是用char_set里的index来的

@Miscoding
Copy link

同问,这个怎么解决?用字典编号解决?
看了下代码,反推识别的字是如何得来的:result->cor.model()->carRec()->predict()->decode()
在orc.py中 decode()函数里,貌似是用char_set里的index来的

data_train.txt 里应该就是 图像名+每个汉字的对应字典索引数字 但是 decode()函数中
if preds[i] != 0 and ((i == 0) or (i != 0 and preds[i] != preds[i-1])): pred_text += char_set[int(preds[i])-1]
为什么要preds[i]!=0 并且char_set预测结果要index-1呢?label中每个汉字的对应索引要加1吗
请问你能完整训练一遍代码吗?

@guess3w
Copy link

guess3w commented Sep 2, 2019

@Miscoding preds[i]!=0 好像是ctc loss里的空白占位符,我也是刚看。

@guess3w
Copy link

guess3w commented Sep 2, 2019

@Miscoding if preds[i] != 0 and ((i == 0) or (i != 0 and preds[i] != preds[i-1]))这个是CTC LOSS里的,两个连续的输出值一样的话视为同一字符,除非用占位符0分隔开。

@Miscoding
Copy link

@guess3w 那训练的时候label 中汉字的字典索引是不是要从1开始呢?

@guess3w
Copy link

guess3w commented Sep 2, 2019

@Miscoding 个人理解不用,我用的是label = [char_set.index(x) for x in list(keys[0])]
char_set 已经将第一个去掉了(char_set[1:])

@zblfly
Copy link

zblfly commented Feb 3, 2023

@Miscoding 个人理解不用,我用的是label = [char_set.index(x) for x in list(keys[0])] char_set 已经将第一个去掉了(char_set[1:])

博主可以请教下是怎么训练的吗?我按您的改了以后还是无法成功训练

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants