输出图层的大小与分类器中的类数不匹配?

时间:2017-11-07 15:56:34

标签: swift xcode keras coreml apple-vision

当我执行计算机视觉应用程序时,它会给我以下错误:

"The size of the output layer 'output1' in the neural network does not match the number of classes in the classifier."

我的CNN已接受过chars74K数据集的培训,并且仅接受了26个大写字母的培训。我认为这意味着我的网络中有26个类,因此我的网络的输出层由26个具有softmax功能的神经元组成。我在这做错了什么?这是控制台中的其余文本:

2017-11-07 16:47:45.465734+0100 VisionApp[4472:347620] Error: The VNCoreMLTransform request failed
Error Domain=com.apple.vis Code=3 "The VNCoreMLTransform request failed" UserInfo={NSLocalizedDescription=The VNCoreMLTransform request failed, NSUnderlyingError=0x60000064fe40 {Error Domain=com.apple.CoreML Code=0 "The size of the output layer 'output1' in the neural network does not match the number of classes in the classifier." UserInfo={NSLocalizedDescription=The size of the output layer 'output1' in the neural network does not match the number of classes in the classifier.}}}

1 个答案:

答案 0 :(得分:2)

使用coremltools转换模型时,带有类名的文件包含多于或少于26个标签。