Because converting data to an image might take some time, this work is done off the main thread using DispatchQueue.DispatchAsync(() => I've made my way to the following… The process of training a model involves providing a learning algorithm with training data to learn from. Convert cgimage to data CGDataProviderRef is derived from CFTypeRef and inherits the properties that all Core Foundation types have in common.