Im working on CoreML project. I have an image that needs to be stylized using a mlmodel. I'm using CoreMLHelpers for this. Im having an issue getting the output.
func prediction(input: MLModelProviderInput) throws -> MLModelProviderOutput {
let outFeatures = try model.prediction(from: input)
let multiArray = outFeatures.featureValue(for: outputName)!.multiArrayValue!
let outputImage = multiArray.image(min: 0, max: 255, axes: (4, 2, 3)) // does not work
let result = MLModelProviderOutput(outputImage: outputImage!.pixelBuffer()!, outputName: outputName)
return result
}
MultiArray has shape of [1, 256, 256, 3]. Am I using the correct axes for this? (4, 2, 3).
CoreMLHelpers on github. My code breaks at line 146 with the console log- "Invalid axes (4, 2, 3) for shape [1, 256, 256, 3]"
TIA