Convert a FastAI model to ONNX and CoreML

Hello there 👋, In this post, I will show you how to convert a FastAI model to ONNX and CoreML. Convert a FastAI model to Pytorch Before we can convert the model to ONNX format or CoreML, we need to convert it to Pytorch first. This is a simple process. Assuming that the model is trained, we need to call torch.save to export the model: from fastai.vision.all import * # learn is your FastAI Learner torch.save(learn.model, "/models/model.pth") Convert a FastAI model to ONNX ONNX is a standard for machine learning models. It allows you to convert a model from a framework like PyTorch or TensorFlow to its format in order to be used in different runtimes, for exampl Windows, Android, Linux, MacOS and iOS and from various programming languages like C#, C++, Java, JavaScript and Python. ...

August 20, 2023 · 3 min · Denis Nutiu

Using an ONNX Resnet model in Java

Hello everyone! 👋 This is a follow-up post to the previous one, long story short I started taking the course from fast.ai to learn more about Deep Learning. I’ve built a simple Image Tagging model using the Resnet architecture (don’t worry about the paper I did not read it, GitHub Copilot suggested it while writing this blog post). FastAI is a high-level Python library that allows you to train complex ML models really fast and efficiently. After training my model, I’ve exported it into the ONNX format and in this post we’re using the model in a Java application. ...

July 4, 2023 · 7 min · Denis Nutiu

Image tagging with Deep Learning

Hello everyone 👋, I’ve been playing with FastAI and deep learning for a week or so and I’ve decided to combine my passion for software with my passion for photography. I’m working on an app or maybe a library that allows you to generate tags for a photo. For an amateur photographer like me it’s quite useful as I don’t always have inspiration to write tags for my photos and sometimes the tags I write are inconsistent. ...

July 2, 2023 · 3 min · Denis Nutiu