GithubHelp home page GithubHelp logo

sonik8494 / indian-paper-currency-prediction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rowhitswami/indian-paper-currency-classification

0.0 1.0 0.0 99.5 MB

Source code of Indian Paper Currency Prediction :fire:

Home Page: https://indian-currency-prediction.herokuapp.com/

License: Apache License 2.0

Python 6.30% HTML 7.91% CSS 1.69% JavaScript 84.10%

indian-paper-currency-prediction's Introduction

Indian Paper Curreny Prediction ๐Ÿ‡ฎ๐Ÿ‡ณ

Table of Content

Demo

Link: https://indian-currency-prediction.herokuapp.com

Overview

This is a simple image classification Flask app trained on the top of Keras API. The trained model (app/model/model.h5) takes an image (Indian Paper Currency) as an input and predict the class of image from 10, 20, 50, 100, 200, 500, 2000 denomination.

Motivation

What could be a perfect way to utilize unfortunate lockdown period? Like most of you, I spend my time in cooking, Netflix, coding and reading some latest research papers on weekends. The idea of classifying indian currency struck to me when I was browsing through some research papers. I couldn't find any relevant research paper (and of course dataset!) associated with it. And that led me to collect the images of Indian currency to train a deep learning model using this amazing tool.

Technical Aspect

This project is divided into two part:

  1. Training a deep learning model using Keras. (Not covered in this repo. I'll update the link here once I make it public.)
  2. Building and hosting a Flask web app on Heroku.
    • A user can choose image from a device or capture it using a pre-built camera.
    • Used Amazon S3 Bucket to store the uploaded image and predictions.
    • Used CSRF Token to protect against CSRF attacks.
    • Used Sentry to catch the exception on the back-end.
    • After uploading the image, the predictions are displayed on a Bar Chart.

Installation

The Code is written in Python 3.7. If you don't have Python installed you can find it here. If you are using a lower version of Python you can upgrade using the pip package, ensuring you have the latest version of pip. To install the required packages and libraries, run this command in the project directory after cloning the repository:

pip install -r requirements.txt

Run

STEP 1

Linux and macOS User

Open .bashrc or .zshrc file and add the following credentials:

export AWS_ACCESS_KEY="your_aws_access_key"
export AWS_SECRET_KEY="your_aws_secret_key"
export ICP_BUCKET='your_aws_bucket_name'
export ICP_BUCKET_REGION='bucket_region'
export ICP_UPLOAD_DIR='bucket_path_to_save_images'
export ICP_PRED_DIR='bucket_path_to_save_predictions'
export ICP_FLASK_SECRET_KEY='anything_random_but_unique'
export SENTRY_INIT='URL_given_by_sentry'

Note: SENTRY_INIT is optional, only if you want to catch exceptions in the app, else comment/remove the dependencies and code associated with sentry in app/main.py

Windows User

Since, I don't have a system with Windows OS, here I collected some helpful resource on adding User Environment Variables in Windows.

Attention: Please perform the steps given in these tutorials at your own risk. Please don't mess up with the System Variables. It can potentially damage your PC. You should know what you're doing.

STEP 2

To run the app in a local machine, shoot this command in the project directory:

gunicorn wsgi:app

Deployement on Heroku

Set the environment variable on Heroku as mentioned in STEP 1 in the Run section. [Reference]

Our next step would be to follow the instruction given on Heroku Documentation to deploy a web app.

Directory Tree

โ”œโ”€โ”€ app 
โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย  โ”œโ”€โ”€ main.py
โ”‚ย ย  โ”œโ”€โ”€ model
โ”‚ย ย  โ”œโ”€โ”€ static
โ”‚ย ย  โ””โ”€โ”€ templates
โ”œโ”€โ”€ config
โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ processing
โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ runtime.txt
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ Procfile
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ wsgi.py

To Do

  1. Convert the app to run without any internet connection, i.e. PWA.
  2. Add a better vizualization chart to display the predictions.

Bug / Feature Request

If you find a bug (the website couldn't handle the query and / or gave undesired results), kindly open an issue here by including your search query and the expected result.

If you'd like to request a new function, feel free to do so by opening an issue here. Please include sample queries and their corresponding results.

Technologies Used

Team

Rohit Swami
Rohit Swami

License

Apache license

Copyright 2020 Rohit Swami

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Credits

  • Google Images Download - This project wouldn't have been possible without this tool. It saved my enormous amount of time while collecting the data. A huge shout-out to its creator Hardik Vasa.

indian-paper-currency-prediction's People

Contributors

rowhitswami avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.