Прежде чем перейти к фактическим ошибкам и кодовым комбинациям, вот элементы моего кода:
def preprocess_image(data, img_shape, num_classes):
image = X_tiny
#image = resize(image, img_shape[0], img_shape[1])
image = normalize(image)
#label = convert_onehot(data['label'], num_classes)
label=y_labels_one_hot
return image, label
Это этап предварительной обработки.
Это функция карты, которую я пытаюсь использовать
img_shape=(32,32,3)
num_classes=10
train_data=X_train
mapper = lambda t: preprocess_image(t,img_shape,num_classes)
train_dataset = np.array([mapper(xi) for xi in train_data])
Есть два варианта обучения l oop, с которыми я сейчас пытаюсь работать
length=len(train_dataset)
for i in range(0,length):
images=X_tiny[i]
labels=y_labels_one_hot[i]
gen_loss, disc_loss=train_step(images,labels)
total_gen_loss +=gen_loss
total_disc_loss +=disc_loss
И
for images, labels in train_dataset:
gen_loss, disc_loss = train_step(images, labels)
total_gen_loss += gen_loss
total_disc_loss += disc_loss
Когда я пытаюсь использовать функцию карты, я получаю сообщение об ошибке:
could not broadcast input array from shape (40,4,2) into shape (40)
Где (40,4,2) - это форма моего один массив numpy с горячим кодированием.
Первое обучение l oop возвращает сообщение об ошибке:
Dimension 0 in both shapes must be equal, but are 200 and 4. Shapes are [200] and [4]. for 'generator_19/concat' (op: 'ConcatV2') with input shapes: [200,256], [4,256], [] and with computed input tensors: input[2] = <-1>.
256 приходит из слоев в мою сеть 200, и я предполагаю, что они из Мои numpy массивы
Вторая тренировка l oop дает мне ошибку:
too many values to unpack (expected 2)
Это указывает на для l oop