4
私はこのtutorialで説明されているように自分のデータセットでTensorFlow Inception v3モデルを再学習しました。TensorFlowの慣れ親しみ慣れたv3モデルがAndroidでクラッシュする
私は、再トレーニングモデルを使用してTensorFlow Android exampleをビルドして実行しようとしています。私があるとして、例からネイティブコードを建て資産のディレクトリにモデル(.pb)とラベル(.TXT)ファイルをコピーし、TensorFlowImageListener.java
でモデルパラメータを変更:
private static final int NUM_CLASSES = 5; // number of categories
private static final int INPUT_SIZE = 299;
private static final int IMAGE_MEAN = 128;
private static final float IMAGE_STD = 128;
private static final String INPUT_NAME = "Mul:0";
private static final String OUTPUT_NAME = "final_result:0";
しかし、アプリがクラッシュ解析するときアセットからロードされたモデルファイル:
08-12 16:02:08.258 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:115 Loading TensorFlow.
08-12 16:02:08.258 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:117 Making new SessionOptions.
08-12 16:02:08.259 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:120 Got config, 0 devices
08-12 16:02:08.264 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:123 Session created.
08-12 16:02:08.264 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:126 Graph created.
08-12 16:02:08.265 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:130 Acquired AssetManager.
08-12 16:02:08.265 25253-25253/com.iliakplv.tensorflow I/native: tensorflow_jni.cc:132 Reading file to proto: file:///android_asset/tensorflow_inception_graph.pb
08-12 16:02:08.265 25253-25253/com.iliakplv.tensorflow I/native: jni_utils.cc:120 Opening asset tensorflow_inception_graph.pb from disk with copy.
08-12 16:02:09.382 25253-25253/com.iliakplv.tensorflow A/native: jni_utils.cc:123 Check failed: message->ParseFromArray(memory, data_size)
08-12 16:02:09.382 25253-25253/com.iliakplv.tensorflow A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 25253 (tech.tensorflow)
PS
bazel build tensorflow/python/tools:strip_unused && \
bazel-bin/tensorflow/python/tools/strip_unused \
--input_graph=some_graph_def.pb \
--output_graph=/tmp/stripped_graph.pb \
--input_node_names=Mul
--output_node_names=final_result
助けにはならなかった。(それはhereを示唆したように)私はまた、このようtensorflow/python/tools/strip_unused.py
を使用してみました。
私はこのファイルを自分のgradleファイルに追加しましたが、問題は解決されません。
.pb
ファイルの圧縮を無効にしました。 –@MuhammadHannan TensorFlowとAndroidアプリで特定のバージョンのモデルを再学習したモデルを、別のバージョンで構築されたネイティブライブラリで使用した場合、類似したモデル解析の問題が発生しました。 TensorFlowは集中的に開発されているため、特定のリリースブランチをチェックして、すべての実験を行うことをお勧めします。 –
https://github.com/tensorflow/tensorflow/issues/5111 – mesutpiskin