jimbobbennett / jimbobbennett/blog-samples
Java.IO.IOException: Not a valid TensorFlow Graph serialization
- Dominant language
- C#
- Stars
- 15
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
I was try with my pdb and get this error:
`{Java.Lang.RuntimeException: Failed to load model from 'model.pb' ---> Java.IO.IOException: Not a valid TensorFlow Graph serialization: NodeDef mentions attr 'explicit_paddings' not in Op output:T; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]; attr=dilations:list(int),default=[1, 1, 1, 1]>; NodeDef: conv0/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](conv0/pad_size, conv0/weights). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
--- End of inner exception stack trace ---
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <286213b9e14c442ba8d8d94cc9dbec8e>:0
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (System.IntPtr jobject, System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00015] in <95d915721ad748108ff096dce8f8f32c>:0
at Android.Runtime.JNIEnv.FinishCreateInstance (System.IntPtr instance, System.IntPtr jclass, System.IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x00008] in <95d915721ad748108ff096dce8f8f32c>:0
at Org.Tensorflow.Contrib.Android.TensorFlowInferenceInterface..ctor (Android.Content.Res.AssetManager assetManager, System.String model) [0x000d4] in /Users/jimbennett/GitHub/TensorFlow.Xamarin.Android/TensorFlowXamarin/obj/Release/generated/src/Org.Tensorflow.Contrib.Android.TensorFlowInferenceInterface.cs:55
at CustomVision.ImageClassifier..ctor () [0x00014] in C:\Temp\UsingTensorFlowAndAzureInAndroid\CustomVision\ImageClassifier.cs:21
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: Failed to load model from 'model.pb'
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.(TensorFlowInferenceInterface.java:113)
at mono.android.TypeManager.n_activate(Native Method)
at mono.android.TypeManager.Activate(TypeManager.java:7)
at md5784075f5b76665e2a0849cb69ccc4ca2.MainActivity.(MainActivity.java:24)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.io.IOException: Not a valid TensorFlow Graph serialization: NodeDef mentions attr 'explicit_paddings' not in Op output:T; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]; attr=dilations:list(int),default=[1, 1, 1, 1]>; NodeDef: conv0/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](conv0/pad_size, conv0/weights). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.loadGraph(TensorFlowInferenceInterface.java:561)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.(TensorFlowInferenceInterface.java:105)
... 18 more
}`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at CustomVision/ImageClassifier.cs:21 and inspect the TensorFlowInferenceInterface constructor, generated binding at TensorFlowXamarin/obj/Release/generated/src/Org.Tensorflow.Contrib.Android.TensorFlowInferenceInterface.cs:55, and loadGraph at TensorFlowInferenceInterface.java:561. Compare the model.pb graph and the TensorFlow runtime's supported Conv2D attributes; done means the sample loads the model without the reported serialization exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp, tensorflow
- Domain
- machine-learning, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100