In Objective-C or Swift code is it possible to run CoreML models directly on GPU based MTLTexture objects? I know that it is possible to run CoreML models on CGImage, is it possible to create CGImage objects from MTLTexture?
Is it possible to run CoreML models directly on GPU based MTLTexture objects?
Hi! CoreML does not support inference with MTLTexture natively. You could convert it to a CVPixelBuffer and then feed that into CoreML for inference.
https://developer.apple.com/documentation/coreml/mlfeaturevalue/2879346-init
I'd also encourage you to file a feature request on http://feedbackassistant.apple.com/ so, we could prioritize supporting MTLTexture natively.
For medical applications I also would like to be able to directly work in Core ML with data loaded in 3D Metal textures. The data is possible quite large (CT, MRI) hence an efficient path to Core ML would be most beneficial. Thanks
I filed FB9814339 for this.