我正在尝试使用keras训练神经网络(分类器)并将其转换为coreml格式。但是,我收到此错误消息:The size of the output layer 'output' in the neural network does not match the number of classes in the classifier.
我用以下方法再次检查了我的训练和验证数据集:print train_generator.class_indices
print validation_generator.class_indices
输出为:
Using TensorFlow backend.
Found 2136 images belonging to 2 classes.
Found 60 images belonging to 2 classes.
{'ThumbsDown': 0, 'ThumbsUp': 1}
{'ThumbsDown': 0, 'ThumbsUp': 1}
这是我转换模型的方式:
ml_model = coremltools.converters.keras.convert(model, input_names = 'img' ,output_names= ['output'],predicted_feature_name ='classLabel',class_labels=['thumbsDown', 'thumbsUp'], image_input_names ='img')
因此具有两个类标签应该是正确的。我在做什么错了?