attr 'explicit_paddings',tensorflow迁移到安卓报错不能载入模型

attr ‘explicit_paddings’,tensorflow迁移到安卓报错不能载入模型

Android Stdio中报错:

Caused by: java.io.IOException: Not a valid TensorFlow Graph serialization: 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 conv2d_1/convolution}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

安卓不能加载自己训练的pb模型

解决办法如下:

将tensorflow降级到1.13.1或以下。因为安卓端目前只能
也就是安卓最高智能识别1.13.1版本tensorflow生成的模型,若tensorflow版本大于此则,无法载入模型!
在gradle中:
implementation ‘org.tensorflow:tensorflow-android:1.13.1’

降级方法:在pycharm中打开setting->选择project interpreter点击右边的“+”号,输入tensorflow,在specical version中选择版本号即可。

在这里插入图片描述OK!大功告成

发布了2 篇原创文章 · 获赞 2 · 访问量 389

猜你喜欢

转载自blog.csdn.net/qq_44237926/article/details/102307078