모델을 만들려고합니다. 얼굴을 알아 보자. 하지만이 오류가 계속 실행되고 비슷한 질문에 대한 다른 대답은이 특정 문제를 해결하지 못했습니다. 코드는 다음과 같다 :python tflearn - ValueError : '(?, 2)'모양을 가진 Tensor 'TargetsData/Y : 0 : 0'의 모양 값 (10, 250, 250, 3)을 입력 할 수 없습니다.
X = pickle.load(open('dataset.pkl', 'rb')).astype('float32')
Y = pickle.load(open('dataset.pkl', 'rb')).astype('float32')
X_test = pickle.load(open('dataset.pkl', 'rb')).astype('float32')
Y_test = pickle.load(open('dataset.pkl', 'rb')).astype('float32')
# Input is a 250x250 image with 3 color channels (red, green and blue)
network = input_data(shape=[None, 250, 250, 3],
data_preprocessing=img_prep,
data_augmentation=img_aug)
# Step 1: Convolution
network = conv_2d(network, 32, 3, activation='relu')
# Step 2: Max pooling
network = max_pool_2d(network, 2)
# Step 3: Convolution again
network = conv_2d(network, 64, 3, activation='relu')
# Step 4: Convolution yet again
network = conv_2d(network, 64, 3, activation='relu')
# Step 5: Max pooling again
network = max_pool_2d(network, 2)
# Step 6: Fully-connected 512 node neural network
network = fully_connected(network, 512, activation='relu')
# Step 7: Dropout - throw away some data randomly during training to prevent over-fitting
network = dropout(network, 0.5)
# Step 8: Fully-connected neural network with two outputs to make the final prediction
network = fully_connected(network, 2, activation='softmax')
# Tell tflearn how we want to train the network
network = regression(network, optimizer='adam',
loss='categorical_crossentropy',
learning_rate=0.001)
# Wrap the network in a model object
model = tflearn.DNN(network, tensorboard_verbose=0, checkpoint_path='faceRecog.tfl.ckpt')
# Train it! We'll do 100 training passes and monitor it as it goes.
model.fit(X, Y, n_epoch=10, shuffle=True, validation_set=(X_test, Y_test),
show_metric=True, batch_size=10,
snapshot_epoch=True,
run_id='faceRecog')
나는이 시점에서 모든 것을 시도
ValueError: Cannot feed value of shape (10, 250, 250, 3) for Tensor 'TargetsData/Y:0', which has shape '(?, 2)'.
을 받고 유지하고 정확하게 문제를 해결 대해 이동하는 방법을 이해할 수 없습니다.
이것은 너무 많은 코드입니다. 어느 누구도 데이터 셋을 다운로드하고, 전체 네트워크를 구성하고, "ValueError"를 디버그하려고하지 않습니다. [최소, 완전하고 검증 가능한] (http://stackoverflow.com/help/mcve) 예제를 만드는 방법을 참조하십시오. – gobrewers14