當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。