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

CTC模型不定长输出问题 #66

Open
ctzhang2008 opened this issue Mar 15, 2021 · 1 comment
Open

CTC模型不定长输出问题 #66

ctzhang2008 opened this issue Mar 15, 2021 · 1 comment

Comments

@ctzhang2008
Copy link

ctzhang2008 commented Mar 15, 2021

背景:
楼主程序改动了两处,识别率可达到96%(因笔记本电脑性能,训练不到10个epoch)。

characters = string.digits + string.ascii_uppercase
n_class = len(characters)

x = Dense(n_class, activation='softmax')(x)
改为:
x = Dense(n_class+1, activation='softmax')(x)

out = K.get_value(K.ctc_decode(y_pred, input_length=np.ones(y_pred.shape[0])*y_pred.shape[1], )[0][0])[:, :4]
改为:
out = K.get_value(K.ctc_decode(y_pred, input_length=np.ones(y_pred.shape[0])*y_pred.shape[1], )[0][0])[:, :]。

问题:
去掉后面的多个Z就是识别的不定长结果?
如果是ZZZZ,那有怎么办?

举例:输出结果为
image

image

image

image

@ctzhang2008
Copy link
Author

ctzhang2008 commented Mar 16, 2021

我搞清楚了, 可能是character没加空格,我再测试一下:

characters = string.digits + string.ascii_uppercase
characters += ' '
n_class = len(characters)

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

1 participant