Chinese-speech-to-text icon indicating copy to clipboard operation
Chinese-speech-to-text copied to clipboard

why load weight to model but predict use base_model?

Open zhaowz opened this issue 6 years ago • 1 comments

hi,i have a question about speech_to_text.py . why you load weight to model but predict use base_model? and my prediction answer is always ��, i mean not chinese words

base_model=Model(inputs=input_tensor,outputs=logit); logit_length_input=Input(shape=(1,)); y_true_input=Input(shape=(maxlen_char,)); y_true_length_input=Input(shape=(1,)); loss_out=Lambda(ctc_lambda_function,output_shape=(1,),name="ctc")([y_true_input,logit,logit_length_input,y_true_length_input]) model=Model(inputs=[input_tensor,logit_length_input,y_true_input,y_true_length_input],outputs=loss_out); model.compile(loss={'ctc': lambda y_true, y_pred: y_pred},optimizer="adam"); model.load_weights(DIR+"/listen_model.chk");

zhaowz avatar Mar 02 '18 09:03 zhaowz

It's because of the ctc-loss is not well integrated in Keras. To use ctc loss I have to generate output by base model, and use the output as the input of ctc loss.

liangstein avatar Mar 02 '18 10:03 liangstein