Python 检查目标时出错:预期激活\u final具有形状(60),但获得具有形状(4)的数组

Python 检查目标时出错:预期激活\u final具有形状(60),但获得具有形状(4)的数组,python,machine-learning,image-processing,keras,Python,Machine Learning,Image Processing,Keras,] ) 我得到了这个错误idk如何修复它我是一个新手到ML 检查目标时出错:预期激活\u final的形状为(60,)但得到的数组的形状为(4,)用测试生成器替换测试图像\u iter 验证数据 验证数据=测试生成器, 验证步骤=测试生成器。n//32 # train the model start = dt.now() show = my_model.fit_generator( # training data train_generator, # epochs steps_per_epoc

] ) 我得到了这个错误idk如何修复它我是一个新手到ML
检查目标时出错:预期激活\u final的形状为(60,)但得到的数组的形状为(4,)

用测试生成器替换测试图像\u iter 验证数据 验证数据=测试生成器, 验证步骤=测试生成器。n//32

# train the model
start = dt.now()
show = my_model.fit_generator(
# training data
train_generator,

# epochs
steps_per_epoch = train_generator.n // 32, #floor per batch size
epochs = 15, 

# validation data
validation_data = test_images_iter,
validation_steps = test_images_iter.n // 32,

#  print progress
verbose = 1,
callbacks = [
#early stopping in case the loss stops decreasing
k.callbacks.EarlyStopping(monitor='val_loss', patience=3),
# only save the model if the monitored quantity (val_loss or val_acc) has improved
k.callbacks.ModelCheckpoint("fruits_checkpoints.h5", monitor='val_loss', save_best_only = True),
# only needed for visualising with TensorBoard
k.callbacks.TensorBoard(log_dir = "logs/{:%d_%b_%Y_%H:%M:%S}".format(dt.now()) )