TensorFlowSharp icon indicating copy to clipboard operation
TensorFlowSharp copied to clipboard

Error:NodeDef mentions attr 'explicit_paddings' not in Op<name=Conv2D....

Open karqical2016 opened this issue 5 years ago • 3 comments

when i used the tensorflow model exported from azure custom vision service, i found error as blow,( TensorflowSharp 1.13 ), could any idea to solve this question:

TensorFlow.TFException HResult=0x80131500 Message=NodeDef mentions attr 'explicit_paddings' not in Op<name=Conv2D; signature=input:T, filter:T -> 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: {{node 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.). Source=TensorFlowSharp StackTrace: at TensorFlow.TFStatus.CheckMaybeRaise(TFStatus incomingStatus, Boolean last) in C:\Users\Administrator\Desktop\TensorFlowSharp-master\TensorFlowSharp\Tensorflow.cs:line 442 at TensorFlow.TFGraph.Import(TFBuffer graphDef, TFImportGraphDefOptions options, TFStatus status) in C:\Users\Administrator\Desktop\TensorFlowSharp-master\TensorFlowSharp\Tensorflow.cs:line 723 at TensorFlow.TFGraph.Import(Byte[] buffer, TFImportGraphDefOptions options, TFStatus status) in C:\Users\Administrator\Desktop\TensorFlowSharp-master\TensorFlowSharp\Tensorflow.cs:line 767 at TensorFlow.TFGraph.Import(Byte[] buffer, String prefix, TFStatus status) in C:\Users\Administrator\Desktop\TensorFlowSharp-master\TensorFlowSharp\Tensorflow.cs:line 743 at CustomVisionCLI.CustomVision.Main() in C:\Users\Administrator\Desktop\CustomVision-TensorFlow-CSharp-master\CustomVision.cs:line 42

karqical2016 avatar Sep 12 '19 05:09 karqical2016

I get error again after try to do this:

py -m pip install tensorflow==1.13.1

karqical2016 avatar Sep 12 '19 05:09 karqical2016

Problem is the graph has been compiled for a different version of Tensorflow, probably 1.14 or above.

You need to replace libtensorflow.dll from packages\TensorFlowSharp.1.13.0\runtimes\win7-x64\native with a newer version.

The easiest way for me was:

  1. Install the SciSharp.TensorFlow.Redist package for the tensorflow version you need.
  2. Copy the tensorflow.dll from there into the root directory of the project and rename to libtensorflow.dll
  3. Add this file to your project in VS and set its build properties to "Content" and "Copy if newer"

geometrikal avatar Oct 23 '19 07:10 geometrikal

I am using tensorflow == 1.14 I trained the model using this version and converted it to .pb format using the same version (tensorflow==1.14) and facing the error

ValueError: NodeDef mentions attr 'explicit_paddings' not in Op<name=DepthwiseConv2dNative; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); 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: {{node import/MobilenetV1/MobilenetV1/Conv2d_1_depthwise/depthwise}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

image

I am using anocanda and running the code on py charm active environment : base active env location : C:\Users\HP\anaconda3 shell level : 1 user config file : C:\Users\HP.condarc populated config files : C:\Users\HP.condarc conda version : 4.12.0 conda-build version : 3.21.8 python version : 3.9.12.final.0 virtual packages : __win=0=0 __archspec=1=x86_64 base environment : C:\Users\HP\anaconda3 (writable) conda av data dir : C:\Users\HP\anaconda3\etc\conda conda av metadata url : None channel URLs : package cache : C:\Users\HP\anaconda3\pkgs C:\Users\HP.conda\pkgs C:\Users\HP\AppData\Local\conda\conda\pkgs envs directories : C:\Users\HP\anaconda3\envs C:\Users\HP.conda\envs C:\Users\HP\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.19044 administrator : False netrc file : None offline mode : False

I am beginner at anaconda. Could you please help me with this

HajraAbid avatar Jun 02 '22 18:06 HajraAbid