Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tensorflow的Tensorflow转换keras模型_Python_Tensorflow_Tensorflow.js - Fatal编程技术网

Python Tensorflow的Tensorflow转换keras模型

Python Tensorflow的Tensorflow转换keras模型,python,tensorflow,tensorflow.js,Python,Tensorflow,Tensorflow.js,使用标准代码 导入tensorflow作为tf 将tensorflowjs导入为tfjs tfjs_target_dir = 'c:/files' model = tf.keras.applications.InceptionV3( include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000

使用标准代码 导入tensorflow作为tf 将tensorflowjs导入为tfjs

 tfjs_target_dir = 'c:/files'
 model = tf.keras.applications.InceptionV3(
     include_top=True,
     weights='imagenet',
     input_tensor=None,
     input_shape=None,
     pooling=None,
     classes=1000
 )
 tfjs.converters.save_keras_model(model, tfjs_target_dir)
我得到以下错误

文件“C:\Program Files\python36\lib\site packages\tensorflow\python\client\session.py”,第1321行,运行 运行(元数据)

文件“C:\Program Files\python36\lib\site packages\tensorflow\python\client\session.py”,第1340行,在调用中 提升类型(e)(节点定义、操作、消息)

FailedPremissionError:尝试使用未初始化的值conv2d_98/内核
[[Node:_retval\u conv2d\u 98/kernel\u 0\u 0=_RetvalT=DT\u FLOAT,index=0,_device=“/job:localhost/replica:0/task:0/device:CPU:0”]

是否尝试提供输入形状

e、 g

使用img_,高度/宽度是您想要预测的图片大小

if K.image_data_format() == 'channels_first':
    input_shape = (3, img_height, img_width)
else:
    input_shape = (img_height, img_width, 3)