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



Is My Avocado Ripe or not?

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! 


Once you are happy with your model, we can export it by literary dragging and dropping as shown below




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...




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


References

  • https://developer.apple.com/videos/play/wwdc2019/430/
  • https://www.kaggle.com/moltean/fruits



Popular posts from this blog

How to make an iOS App Secure?

How to make iOS app secure from screenshot and recording?

How to transfer your App from one Xcode Simulator to another