我在运行应用时收到此错误消息。它在应用程序启动后几秒钟就崩溃了。
05-28 09:05:29.791 15453-15472/my.xxxxx.androidtensorflowbirdexample A/native: tensorflow_jni.cc:304 Error during inference: Invalid argument: No OpKernel was registered to support Op 'DecodeJpeg' with these attrs
[[Node: DecodeJpeg = DecodeJpeg[acceptable_fraction=1, channels=3, dct_method="", fancy_upscaling=true, ratio=1, try_recover_truncated=false](DecodeJpeg/contents)]]
05-28 09:05:29.791 15453-15472/my.xxxxx.androidtensorflowbirdexample A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 15472 (InferenceThread)
[ 05-28 09:05:29.796 15453:15503 E/ ]
[android_ws] Format: 5, Width: 1080, Height: 1620
[ 05-28 09:05:29.796 15453:15503 E/ ]
[android_ws] Format: 5, Width: 1080, Height: 1620
答案 0 :(得分:1)
您必须将输出图转换为优化图或量化图。
首先,为转换构建适当的工具:
对于优化图,
bazel build tensorflow/python/tools:optimize_for_inference
对于量化图,
bazel build tensorflow/tools/quantization:quantize_graph
然后,将再训练的图表转换为所需的格式:
再培训 - >优化
tensorflow/bazel-bin/tensorflow/python/tools/optimize_for_inference \
--input=train/output/flower_photos/retrained_graph.pb \
--output=train/output/flower_photos/optimized_graph.pb \
--input_names=Mul \
--output_names=final_result
优化 - >量化
bazel-bin/tensorflow/tools/quantization/quantize_graph \
--input=train/output/flower_photos/optimized_graph.pb \
--output=train/output/flower_photos/rounded_graph.pb \
--output_node_names=final_result \
--mode=weights_rounded
如果从头开始创建图形,则必须使用适当的图形名称,输入/输出节点名称可能不同
有关详细信息,请参阅: https://petewarden.com/2016/09/27/tensorflow-for-mobile-poets/ (它有点过时,但你可以很好地了解android实现)
答案 1 :(得分:-2)
看起来您的Android版本或移动CPU不支持Tensorflow JNI库。您可能需要检查Android版本和移动CPU。