Я создаю CNN, используя tflearn, но сталкиваюсь с этой ошибкой:
Traceback (most recent call last):
File "/home/hassan/JPG-PNG-to-MNIST-NN-Format/CNN_network.py", line 55, in <module>
({'input' :test_images}, {'targets' :test_labels}), snapshot_step = 500,
File "/home/hassan/anaconda3/envs/object-detection/lib/python3.7/site-packages/tflearn/models/dnn.py", line 192, in fit
self.targets)
File "/home/hassan/anaconda3/envs/object-detection/lib/python3.7/site-packages/tflearn/utils.py", line 331, in feed_dict_builder
"such variable is known to exist" % key)
Exception: Feed dict asks for variable named 'targets' but no such variable is known to exist
Process finished with exit code 1
код сети выглядит следующим образом:
train_images, train_labels, test_images, test_labels = load_dataset()
convnet = input_data(shape=[None, 28, 28, 1], name='input')
convnet = conv_2d(convnet, 32, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)
convnet = conv_2d(convnet, 64, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)
convnet = fully_connected(convnet, 1024, activation='relu')
convnet = dropout(convnet, 0.4)
convnet = fully_connected(convnet, 24, activation='softmax')
convnet = regression(convnet, optimizer='adam', learning_rate=0.01, loss='categorical_crossentropy')
model = tflearn.DNN(convnet)
model.fit({'input': train_images}, {'target': train_labels}, n_epoch=30,
validation_set=({'input': test_images}, {'target': test_labels}),
snapshot_step=500, show_metric=True, run_id='characterOCR')
model.save('CNN.model')
load_dataset - это функция для загрузкинаборы данных в переменные