I get following error occur after using predict.
Image classifier mlmodel created from CreateML and loaded to python 3.8
RuntimeError: {
NSLocalizedDescription = "Predicted feature named 'classLabel' was not output by pipeline";
}
This is the spec of my mlmodel
specificationVersion: 3
description {
input {
name: "image"
shortDescription: "Input image to be classified"
type {
imageType {
width: 299
height: 299
colorSpace: BGR
imageSizeRange {
widthRange {
lowerBound: 299
upperBound: -1
}
heightRange {
lowerBound: 299
upperBound: -1
}
}
}
}
}
output {
name: "classLabelProbs"
shortDescription: "Probability of each category"
type {
dictionaryType {
stringKeyType {
}
}
}
}
output {
name: "classLabel"
shortDescription: "Most likely image category"
type {
stringType {
}
}
}
predictedFeatureName: "classLabel"
predictedProbabilitiesName: "classLabelProbs"
metadata {
author: "xxx"
userDefined {
key: "com.apple.coreml.model.preview.type"
value: "imageClassifier"
}
userDefined {
key: "com.apple.createml.app.tag"
value: "53.6"
}
userDefined {
key: "com.apple.createml.app.version"
value: "2.0"
}
userDefined {
key: "com.apple.createml.version"
value: "11.2.3"
}
}
Image classifier mlmodel created from CreateML and loaded to python 3.8
Code Block _, img = load_image('0.png', resize_to=(Width, Height)) out_dict = model.predict({'image': img})
RuntimeError: {
NSLocalizedDescription = "Predicted feature named 'classLabel' was not output by pipeline";
}
This is the spec of my mlmodel
specificationVersion: 3
description {
input {
name: "image"
shortDescription: "Input image to be classified"
type {
imageType {
width: 299
height: 299
colorSpace: BGR
imageSizeRange {
widthRange {
lowerBound: 299
upperBound: -1
}
heightRange {
lowerBound: 299
upperBound: -1
}
}
}
}
}
output {
name: "classLabelProbs"
shortDescription: "Probability of each category"
type {
dictionaryType {
stringKeyType {
}
}
}
}
output {
name: "classLabel"
shortDescription: "Most likely image category"
type {
stringType {
}
}
}
predictedFeatureName: "classLabel"
predictedProbabilitiesName: "classLabelProbs"
metadata {
author: "xxx"
userDefined {
key: "com.apple.coreml.model.preview.type"
value: "imageClassifier"
}
userDefined {
key: "com.apple.createml.app.tag"
value: "53.6"
}
userDefined {
key: "com.apple.createml.app.version"
value: "2.0"
}
userDefined {
key: "com.apple.createml.version"
value: "11.2.3"
}
}