2017-09-06 8 views
1

私はKerasでモデルを訓練し、アンドロイドで実行しようとします。Android用TensorFlowで動作するKerasモデルの問題

(.pb拡張子を持つ)私のモデルが正しくロードされ、解析され、それは私がこれを呼び出した後にした

tensorFlowInferenceInterface.run(outputNames, true); 

そして、それの後に、私はこの問題を持っている:

E/TensorFlowInferenceInterface: Failed to run TensorFlow inference with inputs:[main_input], outputs:[action_sm/Relu] 
E/TensorflowAndroid: java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'NotEqual' with these attrs. Registered devices: [CPU], Registered kernels: 
        <no registered kernels> 

        [[Node: NotEqual = NotEqual[T=DT_FLOAT](action_sm_sample_weights, NotEqual/y)]] 

私が使用してみましたライブラリ(1.3.1-alpha)の最新版ですが、それは役に立ちませんでした。

答えて

0

このコードは、Android上で動作する、モデルを保存するために私を助け:

from keras import backend as K 
from tensorflow.python.framework import graph_util 

sess = K.get_session() 
K.set_learning_phase(0) 
constant_graph = graph_util.convert_variables_to_constants(sess, 
    sess.graph.as_graph_def(), outputs) 

tf.train.write_graph(constant_graph, out_dir, "model.pb", False) 
関連する問題