captcha_break icon indicating copy to clipboard operation
captcha_break copied to clipboard

RNN分类之后, 在评估处怎么获得每个字符的概率呢

Open lijiajun3029 opened this issue 5 years ago • 1 comments

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

每个字符的概率该如何读出,我对RNN不熟悉,请大佬指点迷津,万分感谢

lijiajun3029 avatar Nov 27 '19 14:11 lijiajun3029

y_pred 就是每个字符的概率,比如我们可以对 y_pred 的概率找最大的值来看输出的概率对应的字符:

argmax = np.argmax(y_pred, axis=2)[0]
list(zip(argmax, ''.join([characters2[x] for x in argmax])))

ypwhs avatar Nov 28 '19 11:11 ypwhs