Fast AI Library for iOS

Is it possible to use the Fast AI library for an iOS app? If not, are there any resources I could use to make an image classifier for mobile?


You can write your model in pytorch and export it to CoreML (which is Apple’s Machine Learning framework which only supports iOS 11). This might get you started:


Thanks! So I would not be using the fastai library but rather pytorch?

Here is an official demo app by Apple which might come in handy :grinning:


Understood! Thanks a lot for the reference, Nishant :slight_smile:

Showbox Tutuapp

fastai is mainly for training, not inference. Once you’ve trained, you’ve got a fairly standard pytorch model, which you can export to onnx / coreml.


I’m curious; I’ve managed to train an adapted Tiramisu ( for my data, and it seems to be working quite well. But I’d like to get it over to coreml, to try it in a real-world context. I converted to ONNX successfully (afaik), but onnx-coreml fails on: “TypeError: Error while converting op of type: Slice. Error message: Only single axis Slice is supported now”. I’ve opened an issue, but no responses, so far (it sounds like it’s on the roadmap, but no idea when). Do you know of any workarounds?

It appears to me that its just a porting issue.

You can try training in Tensorflow. You can also use ONNX model to get a tensorflow model. Then apply tf-coreml to get a core-ml model.

I am not aware if Slice is limited to single axis Slice in core-ml. But I am sure that core-ml 2.0 coming this fall, will be supporting all kind of slicing.

You can also get port your model to Keras/Caffe. Then you can use coremltools to get it run on iOS

Okay, thanks. Yes, I saw the keras version, so I’m going to give that a try with my data.


I also tried to export model to iOS. Then I’ve written a tutorial for it. Check it out here