Indian Currency Classifier

Original article was published on Deep Learning on Medium


Indian Currency Classifier

Web and Android app

Our goal is to classify Indian currency notes of 10,20,50,100,500 and 1000(So yes the old one- before the demonetization).

Lets not get much into theory Lets get into implementation. If you want to read theory first you can visit this research paper :- Research paper link

All the code and related documents you can find here:- Github Link

Environment:

For Model Creation:-

Language:- Python

Libraries :- Tensorflow, Keras, Pillow, Matplotlotlib, Numpy

IDE:- Jupyter Notebook, Google Colab, Pycharm

For Model Deployment:-

Web-app:

Language:- Python

Libraries:- Streamlit

IDE:- Visual Studio Code

Browser(For Testing):- Chrome

Android App:

Language:- Dart

Framework:- Flutter

Package(Flutter Plugin):- tflite

IDE:- Android Studio

Android Device(For Testing):- Nexus 6(Emulator)

Lets get into it

So first we have gone through dataset.

you can find dataset here:- Dataset link

We divided datasets in two parts like training and testing. we kept 85% in training and 15% for the testing part.

Now the actual coding comes so this all are images so CNN is better for images and so we go with CNN.

In CNN if we wanted to use pre-trained model we have to use approach called transfer learning.

There are many models we can use for transfer learning like vgg16, vgg19, resnet, efficientnet, mobilenet, inception, xception, etc.

We tried all the models with different hyper-parameters in that the mobilenet is giving most accuracy so we choose that.(Codes of all the pre-trained model is given in github repo which we have mentioned above)

So we take hyper-parameters which are giving us best accuracy for our dataset.

So here are that hyper-parameters.

Epochs:- 100

Batch Size:- 16

Learning Rate:- 0.0001

Here is the graph of accuracy and loss.

Image of accuracy and loss

so now our model is trained and we have to deploy that model to make it usable for the end user.

So for deployment we made web-app and android app both.

Deployment With web-app

So for the web app we used library called streamlit in python.

How you can use the streamlit and what is streamlit.

Streamlit is an open-source Python library that makes it easy to build beautiful custom web-apps for machine learning and data science.

To use it, just pip install streamlit , then import it, write a couple lines of code, and run your script with streamlit run [filename] .

you can get more about streamlit here:- Streamlit Documentation

The backend code for our app is here:- link

So now its the time to see the web-app.

here you can upload image of Indian currency note and it will tell you what that note is like this.

So first click on Browse files.

Then It will open a window for selecting the image like this.

Then go to the location where your image is located,

Then click on open at bottom-left corner of window.

Now you can see the screen like this

You can see that its showing the image that you uploaded and saying that just a minute( in the back-end the model is doing classification of that image).

So after 30–40 seconds you will get output like this.

You can see that it classified image successfully.

Now its the time for android app.

Deployment With Android-app

For android app we used framework called flutter which was developed by google and its running on language called dart.

What is flutter?

Flutter is an app SDK for building high-performance, high-fidelity apps for iOS, Android, web , and desktop from a single codebase. The goal is to enable developers to deliver high-performance apps that feel natural on different platforms.

Now you wondered that it is for web and desktop also so why we haven’t used for web-app.

So flutter for web is currently on beta version and for desktop its still in technical preview phase that’s why We haven’t use flutter for that.

So know more about flutter here:- Flutter Documentation

The code for our flutter app is here:- Github