I have created an ML Model using Create ML, which is about emotion recognition.
As an input file, I have uploaded a CSV file. The data consists of 48x48 pixel grayscale images of faces. The faces have been automatically registered so that the face is more or less centered and occupies about the same amount of space in each image. The task is to categorize each face based on the emotion shown in the facial expression into one of seven categories (0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral).
The model which I got has more than 87% accuracy, but when I use it in my Xcode project I get the following error:
func setup() {
do {
// Gender request
requests.append(VNCoreMLRequest(
model: try VNCoreMLModel(for: GenderNet().model),
completionHandler: handleGenderClassification
))
// Age request
requests.append(VNCoreMLRequest(
model: try VNCoreMLModel(for: AgeNet().model),
completionHandler: handleAgeClassification
))
// Emotions request
requests.append(VNCoreMLRequest(
model: try VNCoreMLModel(for: test().model),
completionHandler: handleEmotionClassification
))
} catch {
assertionFailure("Can't load Vision ML model: \(error)")
}
}
Fatal error: Can't load Vision ML model: Error Domain=com.apple.vis Code=15
"The model does not have a valid input feature of type image"
UserInfo={NSLocalizedDescription=The model does not have a valid input feature of type image}:
file /Users/ivandimitrov/Desktop/Faces/Faces/ClassificationService.swift, line 38
Do you have any ideas on how to fix that?