尝试将csv加载到数据集以进行训练NN
# load a csv
CSV_PATH = './dataset.csv'
dataset = tf.data.experimental.make_csv_dataset(CSV_PATH, batch_size)
#Initializing the variables
init = tf.global_variables_initializer()
#Create a session
with tf.Session() as sess:
sess.run(init)
#Training epoch
for epoch in range(number_epochs):
#Get one batch of images
batch_x, batch_y = dataset.train.next_batch(batch_size)
#Run the optimizer feeding the network with the batch
sess.run(optimizer, feed_dict={X: batch_x, Y: batch_y})
#Display the epoch (just every 100)
if epoch % 100 == 0:
print("Epoch:", '%d' % (epoch))
在执行时,我得到以下错误
回溯(最近一次呼叫): 文件“c:/Users/afickbohm/Desktop/pyfiles/IDM/梅蒂斯.py“,第63行,英寸 批次x,批次y=dataset.train.next_批处理(批次大小) AttributeError:“DatasetV1Adapter”对象没有属性“train”
所以,dataset不是类型dataset。我该怎么做?在
目前没有回答
相关问题 更多 >
编程相关推荐