1. 报错:ValueError: Errorwhencheckingtarget:expecteddense_2tohave 4dimensions,butgot array with shape (32,6)
base_model = mobilenet_v2.MobileNetV2(
include_top=False,
weights='imagenet',
input_tensor=None,
input_shape=input_shape)
# train only the top layers, i.e. freeze all convolutional layers
for layer in base_model.layers:
layer.trainable = False
# add fc layers
x = base_model.output
x = Dense(256, activation="elu", kernel_regularizer=regularizers.l2(0.01))(x)
x = Dropout(0.6)(x)
x = BatchNormalization()(x)
#######################################
predictions = Dense(num_classes, activation="softmax")(x)
# this is the model we will train
model = Mod