Learn Courses My Dashboard

Core ML Module - own model does not work

Dear all,
I am in the process of doing the Core ML module by Micah.
When I made my own trained model using the sample data in lesson 5, it did not work once loaded into Xcode, the debugger just reports the catch blocks:
Could not classify animal
Invalid image

The App then crashes as it is stuck in the while loop that is waiting for results in the results array.

I downloaded the completed Xcode project file from the resources page and switched the ML model from MobileNetV2 to CatOrDog 1 and even this doesn’t work.

Not sure what’s gone wrong.
I’m using Xcode 14.0.1, iPhone 14 simulator using iOS 16.0, not sure if that’s relevant.

Thanks very much in advance,

Tim

I just downloaded and checked the project created by Micah Beech. It works fine with his model so you need to find out what is wrong with your own model.

Hi Chris, thanks for answering but I tried this - i.e. using Micah’s own model in the downloaded file and it still does not work for me.
It says this error in the console:
[coreml] Failed to get the home directory when checking model path.

The path is correct however - I am using the name of the file (i.e. CatOrDog_1) just as Micah does. The project builds fine as well.

I have seen that others on stack overflow also have a similar problem

Any thoughts? Could it be related to my Xcode/swift setup if it works for you?
Many thanks
Tim

Hi Tim,

Yes I see that error now having changed to the CatOrDog model. Weird.