Running a fastai model in iOS using CoreML

I recently wrote an article about running a fastai model in the browser. Today, I am sharing my next end-to-end example that trains a fastai vision classifier model, exports to CoreML (via ONNX) and build a react-native app around it. I hope you enjoy!

See my article about it here.

The code and notebook can be found in this repo: https://github.com/davidpfahler/react-native-ml-app

I’m looking forward to your feedback and suggestions.

20 Likes

This is super useful.

Just one question. Why react native. Why not native iOS app?

1 Like

This is amazing work! I am also planning to use my fastai unet model on the server. Any thoughts on how run them on Java based servers? ONNX looks like only supports CLang based runtimes.

Hi

davidpfahler
Great work!

mrfabulous1 :grinning::grinning:

Works great @davidpfahler. Thank you for sharing this.
I tried the conversion with a ResNet-50 and a MobileNetV2.

I prepared a Colab to convert fastai models to CoreML. I used it for exporting CycleGan generator.
First we convert to Onnx and then to CoreML.
Link to Github

4 Likes

Thank you. I am coming from a web development background, so anything based on JavaScript is just more natural for me, but this would work with native iOS (Swift or Objective-C).

Thank you, I am glad you like it. Unfortunately, Java is not my strong suit. I hope you found a way to make it work.

Thanks, much appreciated.

Thank you. I hope you found it useful.