Garbage Classifier using Transfer Learning: ML-powered REST API for classifying waste. Built with FastAPI, TensorFlow, and Transfer Learning on NASNet.
Use the live web version here : Garbage Classifier - Web App
To reimplement this on your own and get the models, I have made a complete end-to-end guide & instructions here: CNN & Transfer Learning
- Clone the repository to your local machine (or) download as a .zip file and extract it :
git clone https://github.com/g-wtham/garbage-classifier-fastapi/
cd garbage-classifier-fastapi
-
Install the required dependencies using :
pip install -r requirements.txt
-
Change the fetch url in
/static/script.js
file to127.0.0.1:8000/predict
to start the FastAPI local development server. Open themain.py
file in your code editor, runuvicorn main:app --reload
in the terminal. -
Run the local dev server
localhost:8000
orlocalhost:8000/static/index.html
. Done :)
And right there is your web interface!
Now you can upload your images and get the predictions! Colab file is also given which is used for training the model.
- NasNet Mobile - Last 15 layers are trained on the
TrashNet dataset
and obtained 99.88% accuracy after 30 epochs!