I am making an attempt to colorize picture utilizing coreML, and the mannequin all the time returns (1, 3, 256, 256) as end result. I am reshaping to transform it to (3, 256, 256) however unsure if it is right approach. Is there no approach to choose solely first component in array?
let enter = attempt colorizer_coreInput(image_smallWith: resized)
let predicted = attempt colorizer_core(configuration: MLModelConfiguration()).prediction(enter: enter)
let array = predicted.colorized_small_image
var colori: UIImage?
attempt withExtendedLifetime(array) {
if let reshapedArray = attempt? array.reshaped(to: [3, 256, 256]) {
colori = createUIImage(fromFloatArray: reshapedArray, min: 0, max: 255)
}
}