Is my avocado ripe? Let’s find out with Machine Learning!

Is my avocado ripe? Let’s find out with Machine Learning!

How to use machine learning in iOS App

How to use machine learning in iOS App

Is my avocado ripe? Let’s find out with Machine Learning!

So today I set out to find solution for this huge problem, is my 🥑 ripe or not? I thought being an Engineer why not put Machine Learning to better use! I began with this daunting task and here is how I achieved it.

1. Gather Data — As you all know for any machine learning you need have a data and it needs to be properly labeled. For my ML model I was looking for proper labeled images for ripe and non ripe avocados. I ended up finding that a set of images here on Kaggle. Following best practices for training a model, I divided data set into two categories

  • Training Data — Data that you use to train your model. In our case these are list of labeled images of ripe and non ripe avocados.
  • Testing Data — Data that will be testing the accuracy of trained model. In our case this is just a subset of all the images.

2. Train & Testing Data Now I have the data ready for training, how do I actually train the model. Being an iOS Mobile Engineer I used Create ML tool which ships as part of Xcode developer tools as mentioned in WWDC 2019 video. This is a quick walkthrough of how I this works!

Image for post

Image for post

3. Consume Trained Model — Now that we have the trained model exported all we need to do is consume it in our app. So, I created an app to see the process through…

Image for post

Image for post

Want to try the code for yourself — checkout the gist here.

References

Originally published at shashankthakur.dev.