coreml Failed to get the home directory when checking model path

2.7k Views Asked by At

I wanted to create an image classifier with create ML. However, when I build, I get this error.

The target and path are correct, but I don't know why I'm getting this error.

Tried to set the path correctly. But even if I set it to the correct path, I get this error.

Does anyone know anything about this?

2

There are 2 best solutions below

0
On

What worked for me was making sure that I was testing the model on an actual device, not the simulator.(Make sure the path to the model is also correct)

0
On

Check file extension, it must be in your filepath string. Something like this: /var/.../classifier.mlmodelc not /var/.../classifier.

Also check that you're using this init method: init(fileURLWithPath path: String) for URL class not this init?(string: String).