Core ML Model & Playgrounds

Hello. I am trying to classify images using a trained image classification model I made using Create ML. However, my project cannot load the model. When I look at the error description, it says that I need to compile the model file first. After compiling the model file and adding the resources, my project still doesn't work and the Playgrounds app goes crazy as in the photo. What should I do? Thanks in advance.

Accepted Answer

Try to reimport your model within playground app. I think your model aren't being included in project's build target. I can't verify this, but I think model imported correctly show under a separate Resources section on sidebar. But I am very unsure about this.

Furthermore, in your compiled model class make sure you modified the path for urlOfModelInThisBundle class. See this tutorial: https://marquiskurt.net/post/687335457365868544/using-core-ml-in-a-swift-playgrounds-app

Core ML Model & Playgrounds
 
 
Q