我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用keras.backend.ctc_batch_cost()。
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)
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.
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:, :] ctc_batch_loss = K.ctc_batch_cost(labels, y_pred, input_length, label_length) return ctc_batch_loss
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)
def ctc_lambda_func(args): #labels, y_pred, input_length, label_length = args y_pred = args[:,2:,:] #y_pred = y_pred[:, 2:, :] return K.ctc_decode(y_pred,self.MS_OUTPUT_SIZE) #return K.ctc_batch_cost(labels, y_pred, input_length, label_length)