Code Monkey home page Code Monkey logo

defus3r / automatic-signature-verification Goto Github PK

View Code? Open in Web Editor NEW
22.0 3.0 7.0 1.43 GB

Python implementation of Automatic Signature Stability Analysis And Verification Using Local Features by Muhammad Imran Malik, Marcus Liwicki, Andreas Dengel, Seiichi Uchida, Volkmar Frinken published in 2014 at14th International Conference on Frontiers in Handwriting Recognition and some experiments in Keras-Tensorflow on Automatic Signature Verification using CNNs in vanilla and Siamese architecture

Jupyter Notebook 99.98% Python 0.02%
digital-image-processing computer-vision deep-learning siamese-cnn signature-verification machine-learning

automatic-signature-verification's Introduction

Automatic Signature Stability Analysis And Verification Using Local Features

This repository contains the Python implementation of Automatic Signature Stability Analysis And Verification Using Local Features by Muhammad Imran Malik, Marcus Liwicki, Andreas Dengel, Seiichi Uchida, Volkmar Frinken published in 2014 at 14th International Conference on Frontiers in Handwriting Recognition:

@inproceedings{inproceedings,
author = {Malik, Muhammad Imran and Liwicki, Marcus and Dengel, Andreas and Uchida, Seiichi and Frinken, Volkmar},
year = {2014},
month = {09},
pages = {621-626},
title = {Automatic Signature Stability Analysis and Verification Using Local Features},
volume = {2014},
journal = {Proceedings of International Conference on Frontiers in Handwriting Recognition, ICFHR},
doi = {10.1109/ICFHR.2014.109}
}

In addition to this we performed some experiments on using custom hand-crafted features of images to train simple classifiers to recognise a Genuine or Forged Signature in a database.

Also additionally we have implemented a Keras-Tensorflow implementation of SigNet: Convolutional Siamese Network for Writer Independent Offline Signature Verification by Sounak Dey, Anjan Dutta, J. Ignacio Toledo, Suman K.Ghosh, Josep Llados, Umapada Pal published in Pattern Recognition Letters

@article{article,
author = {Dey, Sounak and Dutta, Anjan and Toledo, J. and Ghosh, Suman and Lladós, Josep and Pal, Umapada},
year = {2017},
month = {07},
pages = {},
title = {SigNet: Convolutional Siamese Network for Writer Independent Offline Signature Verification}
}
  • Note : The paper linked here is from IEEEExplore. Make sure you have a valid subscription.

Dependencies

The following libraries are needed:

✔️ OpenCV

In pip3, you can install with: pip3 install opencv-contrib-python==3.4.2.16

✔️ Tensorflow-GPU and Keras

In pip3 you can use : pip3 install tensorflow-gpu keras

🚨 (Proceed with caution) Ensure that you have a CUDA enabled GPU (the more, the merrier 😜)

Please check dependencies and proceed.

✔️ Python 3.6

✔️ Python packages (newer packages will likely work, though these are the exact versions that we used):

      Pillow==6.2.1
      numpy==1.17.3
      scipy==1.3.2
      scikit-image==0.15.0
      scikit-learn==0.21.3
      ImageHash==4.0.0

✔️

Setting up a virtual environment like virtualenv will help keep your Python environment safe. We recommend installing all dependencies using this.

Codes

Kernel Based Classifier.ipynb : Contains experiments using PHash, aspect ratio, (convex hull area/ bounding box area), (contour area /bounding box area) as features and lineraly stacking them and sending them to standard Classifiers like SVMs, Decision Trees etc.

CNN_BHSig260.ipynb : Contains experiments on using a vanilla CNN for learning to classify genuine and forged signatures end-to-end

Siamese_BHSig260.ipynb : The Implementation of SigNet, a revolutionary siamese architecture using CNNs to learn to differentiate between genuine and forged signatures on BHSig260 dataset.

Siamese_CEDAR.ipynb : The Implementation of SigNet, a revolutionary siamese architecture using CNNs to learn to differentiate between genuine and forged signatures on CEDAR dataset.

We have included visualisations of what the models are learning by plotting Activations. Feel free to enlighten us beyond out intuitions 😃

Running

✔️ Please install the BHSig260 and CEDAR dataset from the following links: BHSig260 : link

CEDAR : link

Download both datasets manually or using wget and extract from compressed version. Run the scripts CEDAR_Modif.py & modifyBHSig260.py to prepare datasets in the correct format.

GPU Usage and Recommended Compute

For training the deep learning models, we have used 4 Nvidia GeForce GTX 1080 Ti GPU with 10 GiB memory with Intel Xeon E5-2640 v4 processors having 40 cores giving 128 GB of 2400MT/s DDR4 ECC RAM. It is recommended to use around this level of compute capability, though the CNN architecture has been tested on an Intel i7-6700HQ CPU @2.60Ghz and Nvidia GeForce GTX 960M giving 640 CUDA cores.

Some results from the Siamese Network Implementation

✔️ On a bengali signature: Bengali

✔️ On a hindi signature: Hindi

✔️ On an English Signature: English

Adding Issues

We welcome people to try our code and suggest improvements. The way to grow is to share and learn 😃

automatic-signature-verification's People

Contributors

defus3r avatar gowrijsuria avatar shivaniraochepuri21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

automatic-signature-verification's Issues

Getting ValueError: New layer sequential_1 expects 20 weights, but the saved weights have 12 elements.

I have tried the example on Google Colab to generate the model. I then tried to run the test using a saved file (.h5) on my local machine.

However I keep getting the following error:

ValueError: Layer #0 (named "sequential_1" in the current model) was found to correspond to layer sequential_1 in the save file. However the new layer sequential_1 expects 20 weights, but the saved weights have 12 elements.

I tried to run through the related portion of the codes but really failed to identify where the error was generating from.

The full traceback is:

Traceback (most recent call last):
File "./run_cedar.py", line 545, in
acc_thresh.append(load_and_check_model('./Weights/signet-cedar-full-xavier-001.h5'))
File "./run_cedar.py", line 518, in load_and_check_model
model.load_weights(weight)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/engine/topology.py", line 1107, in load_weights
load_weights_from_hdf5_group(f, self.layers)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/engine/topology.py", line 1514, in load_weights_from_hdf5_group
str(len(weight_values)) + ' elements.')
ValueError: Layer #0 (named "sequential_1" in the current model) was found to correspond to layer sequential_1 in the save file. However the new layer sequential_1 expects 20 weights, but the saved weights have 12 elements.

Could you guide me as to where the error might be coming from?

PS. Another thing that I came across was that after the end of the epoch 6 (run on Colab), the loss was coming to nan.

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.