FruitNet is a web application, implemented with Python (Flask framework), which uses a convolutional neural network on the back-end to perform fruit classification. The system is able to distinguish 6 classes of fruits: fresh/rotten apples, fresh/rotten oranges and fresh/rotten bananas. The user is able to interact with the app by uploading images or by showing the fruits to the web-camera. The app uses Web Speech API to make the experience more interactive and fun.
Warning! As there's no fallback class like "a non-fruit object", please don't take it personally when the model classifies the photo of you as a rotten banana 😅 (this also applies to any object, that doesn't belong to the mentioned classes).
The application is available at: https://fruitnet.herokuapp.com
For this project, the following tools were used:
- Tensorflow 2 for building and training the model;
- Numpy for working with arrays;
- Matplotlib for visualizing the data;
- Flask for implementing the server side;
- HTML5, CSS3, JavaScript (with Web Speech API and particles.js) on the front-end.
The dataset used for training and evaluating the model: Fruits fresh and rotten for classification by Sriram Reddy Kalluri. The obtained model has achieved 99% accuracy on the test set.
The network itself was implemented using transfer learning. The MobileNet V2 model developed at Google was used as a base model for feature extraction from our data. A custom classification layer was added on top and trained separately. You can learn more about this approach here. The notebook I used to implement the model on Google Colab can be found here.
To install and run locally in a production mode:
git clone https://github.com/AlexanderKlanovets/fruitnet
cd fruitnet
pip install -r requirements.txt
python app.py
Another way is to run the app with Docker:
git clone https://github.com/AlexanderKlanovets/fruitnet
cd fruitnet
sudo docker build -t <image_name> .
sudo docker run -p 5000:5000 <image_name>