TensorFlowAndroidMNIST
TensorFlowAndroidMNIST copied to clipboard
Error on building for expert.py
I succeeded on building beginner.py and expert.py to beginner-graph.pb and expert-graph.pb files to be used in the Android project. But when I replaced these files in the app/src/main/assets/ only beginner-graph.pb works, expert-graph.pb does not work. Do you have any idea? (I have modified file DigitDetector.java in lines 43 and 46 to use beginner-graph.pb and expert-graph.pb, respectively).
I copy the error log as follows: 10-21 10:43:13.357 28693-28693/jp.narr.tensorflowmnist W/linker: libtensorflow_mnist.so: unused DT entry: type 0x6ffffffe arg 0x1e9c 10-21 10:43:13.357 28693-28693/jp.narr.tensorflowmnist W/linker: libtensorflow_mnist.so: unused DT entry: type 0x6fffffff arg 0x3 10-21 10:43:13.739 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:62 Loading Tensorflow. 10-21 10:43:13.739 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:63 Making new SessionOptions. 10-21 10:43:13.739 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:67 Got config, 0 devices 10-21 10:43:13.744 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:69 Session created. 10-21 10:43:13.744 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:73 Graph created. 10-21 10:43:13.744 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:78 Acquired AssetManager. 10-21 10:43:13.744 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:80 Reading file to proto: file:///android_asset/expert-graph.pb 10-21 10:43:13.744 28693-28693/jp.narr.tensorflowmnist I/native: jni_utils.cc:120 Opening asset expert-graph.pb from disk with zero-copy. 10-21 10:43:13.764 28693-28693/jp.narr.tensorflowmnist I/native: tensorflow_jni.cc:84 Creating session. 10-21 10:43:13.779 28693-28693/jp.narr.tensorflowmnist E/native: tensorflow_jni.cc:89 Could not create Tensorflow Graph: Invalid argument: NodeDef mentions attr 'Tshape' not in Op<name=Reshape; signature=tensor:T, shape:int32 -> output:T; attr=T:type>; NodeDef: Reshape = Reshape[T=DT_FLOAT, Tshape=DT_INT32](input, Reshape/shape) 10-21 10:43:13.782 28693-28693/jp.narr.tensorflowmnist I/MainActivity: Detector setup failed 10-21 10:43:13.883 28693-28693/jp.narr.tensorflowmnist D/AndroidRuntime: Shutting down VM
--------- beginning of crash
10-21 10:43:13.884 28693-28693/jp.narr.tensorflowmnist E/AndroidRuntime: FATAL EXCEPTION: main Process: jp.narr.tensorflowmnist, PID: 28693 java.lang.RuntimeException: Unable to resume activity {jp.narr.tensorflowmnist/jp.narr.tensorflowmnist.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void jp.narr.tensorflowmnist.DrawView.onResume()' on a null object reference at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3050) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3081) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2447) at android.app.ActivityThread.access$800(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5373) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void jp.narr.tensorflowmnist.DrawView.onResume()' on a null object reference at jp.narr.tensorflowmnist.MainActivity.onResume(MainActivity.java:84) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1262) at android.app.Activity.performResume(Activity.java:6120) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3039) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3081) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2447) at android.app.ActivityThread.access$800(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5373) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815) 10-21 10:43:35.680 28693-28693/jp.narr.tensorflowmnist I/Process: Sending signal. PID: 28693 SIG: 9
Did you manage to figure out how to fix Could not create Tensorflow Graph: Invalid argument: NodeDef mentions attr 'Tshape' not in Op<name=Reshape; signature=tensor:T, shape:int32 -> output:T; attr=T:type>; NodeDef: Reshape = Reshape[T=DT_FLOAT, Tshape=DT_INT32](input, Reshape/shape) by any chance?
I tried copy and pasting the the tensorflow/tensorflow folder in the include/tensorflow folder and regenerated the .so file but I still get the same error. I also tried manually editing array_ops.cc with the "Reshape" op from Tensorflow 0.11.0 but I still get the same error.
I didn’t manage that problem. But it seems that we need to use freeze_graph.py from Tensorflow tools to create graph.pb file. I am trying to do in that way, if I succeed, I will feedback you.
On 2016/11/14, at 6:55, leslietso [email protected] wrote:
Did you manage to figure out how to fix Could not create Tensorflow Graph: Invalid argument: NodeDef mentions attr 'Tshape' not in Op<name=Reshape; signature=tensor:T, shape:int32 -> output:T; attr=T:type>; NodeDef: Reshape = Reshape[T=DT_FLOAT, Tshape=DT_INT32](input, Reshape/shape) by any chance?
I tried copy and pasting the the tensorflow/tensorflow folder in the include/tensorflow folder and regenerated the .so file but I still get the same error. I also tried manually editing array_ops.cc with the "Reshape" op from Tensorflow 0.11.0 but I still get the same error.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/miyosuda/TensorFlowAndroidMNIST/issues/6#issuecomment-260215854, or mute the thread https://github.com/notifications/unsubscribe-auth/AKixHUvjfU9AZhLxjsUpjvo6dW9xkh3Gks5q94dngaJpZM4KcyH_.
From the the replies from my issue at https://github.com/tensorflow/tensorflow/issues/5585 at the Tensorflow GitHub, it seems like that the problem comes up because the Tensorflow used to generate the .PB-file is 0.11.0 whereas the Tensorflow version on Android is at 0.10.0.
EDIT: I managed to fix the error. How I did it can be found at https://github.com/tensorflow/tensorflow/issues/5585.
if possible, could you send me a sample of your project? I am still working on TensorflowAndroidMNIST but it does not work.
My internet is very slow (16kb/s upload) but I will upload my jni-build folder to Google Drive sometime next week.
Here you can find my jni-build file. It is quite large (800MB+) because I was not sure what I could delete.
Thank you very much, I will try it.
On 2016/11/22, at 7:48, leslietso [email protected] wrote:
Here https://drive.google.com/open?id=0B-1e31Yg8G1RWklDRzJsMS14X28 you can find my jni-build file. It is quite large (800MB+) because I was not sure what I could delete.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/miyosuda/TensorFlowAndroidMNIST/issues/6#issuecomment-262092420, or mute the thread https://github.com/notifications/unsubscribe-auth/AKixHXw12pi7uI516PYjna9GqGJcFcqgks5rAh_AgaJpZM4KcyH_.
@leslietso May I ask you for a quick review on the steps you've performed to get the app built? I would also like to integrate a newer version of Tensorflow into my Android-Studio system. But I have absolutely no clue how I should proceed with building the new binaries and include directories..
Building the Demo-App and copying the .lo .o files is ok, but the files in the /include folder are still the old ones, right? Where can I find the new ones? Thanks :)
Sorry for the late reply. I simply downloaded the newest repo from Tensorflow, built it, then copied the contents of "tensorflow/tensorflow" folder to the "jni/include/tensorflow" folder and the contents of "tensorflow/third_party" to "jni/include/tensorflow". I have little experience with Tensorflow and am in no way an expert so the "jni_build" file does end up very big (over 800MB) as it is not optimized and includes all files whether I need it or not.
Ah. Great. Thanks! You built it using bazel, right? Because there is also a CMAKE version nowadays. So, in case I get any errors which says something like function not implemented or so, I "just" edit the bazel build file and include the headers in the new build? Do I also need new jni-header-files then? I think in one of my experiments the dropout was not implemented..maybe in 0.12 it changed already..
@leslietso @huythach Hi all,I also have this issues--" Could not create Tensorflow Graph: Invalid argument: NodeDef mentions attr 'Tshape' not in Op<name=Reshape; signature=tensor:T, shape:int32 -> output:T; attr=T:type>; "
Now tensorflow update to r1.0.I don't know how to build it to fit this issues.Can you help me?
@leslietso Thanks for your share "jni-build".My app can run now.But I want to know that how to fix it.How to build tensorflow can get genfiles's file?
Any solution so far?