我是张量流的新手。我正在使用 Tflearn 来训练我的图像以对眼睛状态进行分类。对于初始阶段,现在,我有 400 张训练图像和 200 张验证图像。我正在使用 image_preloader 在我的脚本中输入自定义图像。我认为它成功加载图像显示:
tflearn.data_utils.ImagePreloader 对象在 0x7fa28f3a5310
但是在训练时划分和获取批次时会导致问题,
给出一个回溯错误作为
Traceback (most recent call last):
File "tflearn_custom.py", line 181, in <module>
model.fit(x,y,validation_set=({'input':test_x},{'targets':test_y}),n_epoch=10,batch_size=10)
File "/usr/local/lib/python2.7/dist-packages/tflearn/models/dnn.py", line 215, in fit
callbacks=callbacks)
File "/usr/local/lib/python2.7/dist-packages/tflearn/helpers/trainer.py", line 285, in fit
self.summ_writer, self.coord)
File "/usr/local/lib/python2.7/dist-packages/tflearn/helpers/trainer.py", line 709, in initialize_fit
self.n_train_samples = len(get_dict_first_element(feed_dict))
TypeError: object of type 'Tensor' has no len()
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout,fully_connected
from tflearn.layers.estimator import regression
import tensorflow as tf
from …Run Code Online (Sandbox Code Playgroud)