/Credit-card-number-detection

Detect Credit card number using Mask RCNN and make task easier for OCR to retrive number from the card

Primary LanguagePythonMIT LicenseMIT

Credit card number detection

Detect Credit card number using Mask RCNN and make task easier for OCR to retrieve number from the card

The idea is to change traditional card based transaction using computer vision, Consider if we have a credit card device uses camera (computer vision) instead of swiping, So there is no need of physical card, even we can reduce the usage of plastic cards.

Preparing the dataset

I downloaded some credit card images with variable size from https://www.moneyhero.com.hk/api/credit-card/v2/cards/all?lang=en&pageSize=1000 REST Service 1000 samples for train and test

Demo ScreenShot 1

ScreenShot_1

Then i used free Image Polygonal Annotation tool for creating annotation over the image like create a box marker around the card number on credit card image.

Demo ScreenShot 2

Tool LabelMe

ScreenShot_3 ScreenShot_2

finally run labelme2coco.py file to convert all the Image annotation json to COCO like dataset with mask image

1. Installation

Download Anaconda

Linux Mac Windows
64-bit 64-bit (bash installer) 64-bit (bash installer) 64-bit (exe installer)
32-bit 32-bit (bash installer) 32-bit (exe installer)

Install Anaconda on your machine. Detailed instructions:

2. Create and Activate the Environment

Please go though this doc before you creating an environment. After that create a environment using following command

conda create --name deep-learning

Then activate the environment using following command

activate deep-learning

Git and version control

These instructions also assume you have git installed for working with Github from a terminal window, but if you do not, you can download that first with the command:

conda install git

Now, you can create a local version of the project

  1. Clone the repository, and navigate to the downloaded folder. This may take a minute or two to clone due to the included image data.
git clone https://github.com/koushik-elite/Face-Generation.git
cd TV-Script-Generation
  1. Install PyTorch and torchvision; this should install the latest version of PyTorch.

    • Linux or Mac:
    conda install pytorch torchvision -c pytorch 
    
    • Windows:
    conda install pytorch -c pytorch
    pip install torchvision
    
  2. Install a few required pip packages, which are specified in the requirements text file (including OpenCV).

pip install -r requirements.txt

Training

Creating image dataset and training process is available in training-code.py file

python training-code.py

Prediction

predict mask image for single credit card image is available in predict.py file

python predict.py

Sample Output Image

ScreenShot_4