preprocessor_eval.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:HandwritingRecognition 作者: eng-tsmith 项目源码 文件源码
def label_preproc(label_string):
    """
    This function is supposed to prepare the label so that it fits the standard of the rnn_ctc network.
    It computes following steps:
    1. make list of integers out of string    e.g. [hallo] --> [8,1,12,12,15]
    :param label_string: a string of the label
    :return: label_int: the string represented in integers
    """
    chars = char_alpha.chars

    label_int = []

    for letter in label_string:
        label_int.append(chars.index(letter))

    label_int_arr = np.resize(np.asarray(label_int), (1, len(label_int)))

    # print(label_int_arr.shape)

    return label_int_arr
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号