无法使用 TensorFlow 和 TFLEARN 保存或加载模型
Cannot Save or Load Models With TensorFlow & TFLEARN
我正在阅读 here 中的泰坦尼克号教程。完成后我想保存模型,然后再加载它。保存后我收到一条警告:
TensorFlow's V1 checkpoint format has been deprecated.
WARNING:tensorflow:Consider switching to the more efficient V2 format:
当我加载它时,我收到一条错误消息
NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for model.tflearn
[[Node: save_1/RestoreV2_2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_2/tensor_names, save_1/RestoreV2_2/shape_and_slices)]]
这就是我 saved/loaded 模型的方式。
net = tflearn.input_data(shape=[None, 6])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net)
model.fit(data, labels, n_epoch=10, batch_size=16, show_metric=True)
model.save('model.tflearn')
然后当我加载它时,我只是做一个...
model.load('model.tflearn')
如果有这方面经验的人可以帮助我,我将不胜感激。
使用model.load('./model.tflearn')
我正在阅读 here 中的泰坦尼克号教程。完成后我想保存模型,然后再加载它。保存后我收到一条警告:
TensorFlow's V1 checkpoint format has been deprecated.
WARNING:tensorflow:Consider switching to the more efficient V2 format:
当我加载它时,我收到一条错误消息
NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for model.tflearn
[[Node: save_1/RestoreV2_2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_2/tensor_names, save_1/RestoreV2_2/shape_and_slices)]]
这就是我 saved/loaded 模型的方式。
net = tflearn.input_data(shape=[None, 6])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net)
model.fit(data, labels, n_epoch=10, batch_size=16, show_metric=True)
model.save('model.tflearn')
然后当我加载它时,我只是做一个...
model.load('model.tflearn')
如果有这方面经验的人可以帮助我,我将不胜感激。
使用model.load('./model.tflearn')