使用标准代码 导入张量流为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行,在_do_run中 run_metadata)
文件" C:\ Program Files \ python36 \ lib \ site-packages \ tensorflow \ python \ client \ session.py",第1340行,在_do_call 提升类型(e)(node_def,op,message)
FailedPreconditionError:尝试使用未初始化的值conv2d_98 / kernel [[Node:_retval_conv2d_98 / kernel_0_0 = _RetvalT = DT_FLOAT,index = 0,_device =" / job:localhost / replica:0 / task:0 / device:CPU:0"]]
答案 0 :(得分:0)
您是否尝试过提供输入形状?
e.g。
if K.image_data_format() == 'channels_first':
input_shape = (3, img_height, img_width)
else:
input_shape = (img_height, img_width, 3)
img_height / width是您要预测的图片的大小