Swiftpack.co - Package - ShawonAshraf/Frutify-iOS


iOS application for Fruit Image Classifier


Binary/ Multiclass image classification of fruits. The trained model can determine whether a fruit is fresh / rotten from the given image. The app can use the camera to take images or, can load an image from the images stored on the device.

Categories Trained on so far

  • Apple(fresh + rotten)
  • Mango(fresh + rotten)
  • Orange(fresh + rotten)
  • Banana(fresh + rotten)


Correct predictions

Real : Fresh, Predicted : Fresh | Real : Fresh, Predicted: Fresh| Real : Fresh, Predicted: Fresh :------------------------------:| :------------------------------:| :------------------------------:| Imgur| Imgur| Imgur

Real : Fresh, Predicted : Fresh | Real : Rotten, Predicted : Rotten | Real : Fresh, Predicted : Fresh| :------------------------------:| :------------------------------:| :------------------------------:| Imgur| Imgur| Imgur

Wrong predcictions

Real : Fresh, Predicted : Rotten | Real : Fresh, Predicted : Rotten | :------------------------------:| :------------------------------:| Imgur | Imgur|


For training

For app

  • Swift 4
  • iOS 11.2 SDK / iOS 11.1 SDK
  • Xcode 9.2 / 9.1
  • macOS 10.13.1+

Supported devices and platforms

  • Any device running iOS 11.1+

Model evaluation details

Details regarding model evaluation (accuracy, confusion matrix) can be found here as iPython Notebook


Clone the repo or download as a zip

For training

  • If you don't want to train on a new dataset and want to use what's already available, skip to next part.
  • Save your data (images to train on) inside the folder image_data
  • Loading dataset into a dataframe
python data_to_df.py
  • Create model and train
python predict.py
  • It'll create a model and mlmodel to use with the iOS application.

For app

  • Create a Single view iOS app in Xcode with camera view.
  • Add the coreml model you got from training or if you skipped training, download the mlmodel from release section of the repo. link
  • Initiate the model inside your swift code and run inference on images captured or in the way you have defined image input on your app.
  • If you wish to use the existing app, just import the mlmodel into project directory and build.
  • Best if you can test on a device instead of an emulator.



Stars: 5
Help us keep the lights on


Used By

Total: 0


1.0.0b - Dec 10, 2017

Beta version 1 Binary image classification. Release include mlmodel file for reuse.