当前位置: 首页>>代码示例>>Python>>正文


Python backend.ctc_batch_cost方法代码示例

本文整理汇总了Python中keras.backend.ctc_batch_cost方法的典型用法代码示例。如果您正苦于以下问题:Python backend.ctc_batch_cost方法的具体用法?Python backend.ctc_batch_cost怎么用?Python backend.ctc_batch_cost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在keras.backend的用法示例。


在下文中一共展示了backend.ctc_batch_cost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args

    # hack for load_model
    import tensorflow as tf

    ''' from TF: Input requirements
    1. sequence_length(b) <= time for all b
    2. max(labels.indices(labels.indices[:, 1] == b, 2)) <= sequence_length(b) for all b.
    '''

    # print("CTC lambda inputs / shape")
    # print("y_pred:",y_pred.shape)  # (?, 778, 30)
    # print("labels:",labels.shape)  # (?, 80)
    # print("input_length:",input_length.shape)  # (?, 1)
    # print("label_length:",label_length.shape)  # (?, 1)


    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:robmsmt,项目名称:KerasDeepSpeech,代码行数:21,代码来源:model.py

示例2: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred,labels,input_length,label_length = args
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:jarvisqi,项目名称:deep_learning,代码行数:5,代码来源:densenet-ocr.py

示例3: _ctc_loss

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def _ctc_loss(args):
    labels, y_pred, input_length, label_length = args
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:GlassyWing,项目名称:text-detection-ocr,代码行数:5,代码来源:core.py

示例4: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)

#
# Get Model
# 
开发者ID:Orkis-Research,项目名称:Quaternion-Convolutional-Neural-Networks-for-End-to-End-Automatic-Speech-Recognition,代码行数:9,代码来源:interspeech_model.py

示例5: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:fanghon,项目名称:lpr,代码行数:6,代码来源:e2emodel.py

示例6: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    iy_pred, ilabels, iinput_length, ilabel_length = args
    # the 2 is critical here since the first couple outputs of the RNN
    # tend to be garbage:
    iy_pred = iy_pred[:, 2:, :]  # no such influence
    return K.ctc_batch_cost(ilabels, iy_pred, iinput_length, ilabel_length) 
开发者ID:kurapan,项目名称:CRNN,代码行数:8,代码来源:models.py

示例7: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    # the 2 is critical here since the first couple outputs of the RNN
    # tend to be garbage:
    y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:qjadud1994,项目名称:CRNN-Keras,代码行数:8,代码来源:Model_GRU.py

示例8: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    # the 2 is critical here since the first couple outputs of the RNN
    # tend to be garbage:
    y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)


# For a real OCR application, this should be beam search with a dictionary
# and language model.  For this example, best path is sufficient. 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:12,代码来源:image_ocr.py

示例9: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    # From Keras example image_ocr.py:
    # the 2 is critical here since the first couple outputs of the RNN
    # tend to be garbage:
    # y_pred = y_pred[:, 2:, :]
    y_pred = y_pred[:, :, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:rizkiarm,项目名称:LipNet,代码行数:10,代码来源:loss.py

示例10: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(self, args):
        y_pred, labels, input_length, label_length = args
        y_pred = y_pred[:, :, :]
        return K.ctc_batch_cost(y_true=labels, y_pred=y_pred, input_length=input_length, label_length=label_length) 
开发者ID:zw76859420,项目名称:ASR_WORD,代码行数:6,代码来源:speech_model_01.py

示例11: _ctc_lambda

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def _ctc_lambda(args):
        prediction_batch, label_batch, prediction_lengths, label_lengths = args
        return backend.ctc_batch_cost(y_true=label_batch, y_pred=prediction_batch,
                                      input_length=prediction_lengths, label_length=label_lengths) 
开发者ID:JuliusKunze,项目名称:speechless,代码行数:6,代码来源:net.py

示例12: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length) 
开发者ID:YCG09,项目名称:chinese_ocr,代码行数:5,代码来源:train.py

示例13: ctc_loss_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_loss_lambda_func(args):
        """
        Function for computing the ctc loss (can be put in a Lambda layer)
        :param args: 
            y_pred, labels, input_length, label_length
        :return: CTC loss 
        """

        y_pred, labels, input_length, label_length = args
        return K.ctc_batch_cost(labels, y_pred, input_length, label_length)  # , ignore_longer_outputs_than_inputs=True) 
开发者ID:ysoullard,项目名称:CTCModel,代码行数:12,代码来源:CTCModel.py

示例14: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func( args ):
    prediction, labels, prediction_lengths, label_lengths = args
    #  prediction = prediction[:, 2:, :]
    return K.ctc_batch_cost( labels, K.softmax( prediction ), prediction_lengths, label_lengths ) 
开发者ID:harish2704,项目名称:pottan-ocr,代码行数:6,代码来源:custom_training.py

示例15: ctc_lambda_func

# 需要导入模块: from keras import backend [as 别名]
# 或者: from keras.backend import ctc_batch_cost [as 别名]
def ctc_lambda_func( args ):
    y_pred, labels, label_lengths = args
    y_pred_len = [ [y_pred.shape[1] ] ] * batchSize
    #  y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost( labels, K.softmax( y_pred ), y_pred_len, label_lengths ) 
开发者ID:harish2704,项目名称:pottan-ocr,代码行数:7,代码来源:train.py


注:本文中的keras.backend.ctc_batch_cost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。