Tensorflow自定义TFLitejava.lang.NullPointerException:无法为interp分配内存

2024-04-18 16:34:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经创建了一个自定义tensorflow lite模型再培训.py使用以下命令从https://github.com/tensorflow/hub/blob/master/examples/image_retraining/retrain.py开始

python retrain.py --image_dir newImageDirectory --tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/1

然后我用toco转换输出_图形.pb文件到精简文件。使用下面的命令

^{pr2}$

然后我用新的lite文件和标签.txt将它们归档并放入tensorflow for poeters 2https://github.com/googlecodelabs/tensorflow-for-poets-2,看看我是否可以让它开始分类新的类别。当应用程序启动时,我收到以下错误。在

Caused by: java.lang.NullPointerException: Can not allocate memory for the interpreter                                                                                            at org.tensorflow.lite.NativeInterpreterWrapper.createInterpreter(Native Method)
                                                                      at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:63)
                                                                                        at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:51)
                                                                                        at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:90)
                                                                                        at com.example.android.tflitecamerademo.ImageClassifier.<init>(ImageClassifier.java:97)

Tags: 文件pyhttpsorgimage命令githubcom