Git Product home page Git Product logo

signet-pytorch's Introduction

Signet-Pytorch

SigNet implementation in Pytorch

Original paper: https://arxiv.org/pdf/1707.02131.pdf

Note: I'm not the author of the paper. I'm just curious about the network and topic that I want to reimplement myself in Pytorch

Download dataset

cd data
./cedar.sh

Prepare data

This is used to split dataset to train/test partitions

python3 prepare_data.py

Train

python3 train.py

Result

Dataset Accuracy (%)
CEDAR 100

TODO

  • Init bias = 0 as paper proposed
  • Add normalization (e.g. divide by standard deviation)
  • GPDS 300 dataset
  • GPDS Synthetic Signature Corpus dataset
  • Bengali dataset
  • Hindi dataset

Reference

signet-pytorch's People

Contributors

andrew-fryer avatar vinhloiit avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

signet-pytorch's Issues

Your loss Implementation might be wrong

You implement loss = self.alpha * (1-y) * distance**2 + \ self.beta * y * (torch.max(torch.zeros_like(distance), self.margin - distance)**2) as your contrastive loss, however, in your dataset split and preprocessing script, you label (genuine, genuine) as 1 and (genuine,forged) as 0, which means when y=0, your loss = alpha * distance between pairs and it will be minimized, but hopefully they should be as far as possible.

loss = self.alpha * y * distance**2 + \ self.beta * (1-y) * (torch.max(torch.zeros_like(distance), self.margin - distance)**2) would be a correct implementation.

Network Structure fix

The last layer is 256, but the SigNet paper specifies 128.
(Note: the network trains much more quickly with 128.)

why set number_samples and running_loss to zero ?

signet-pytorch/train.py

Lines 37 to 38 in 36c5ee6

running_loss = 0
number_samples = 0

In train.py after print the result for any log_interval step why set number_samples and running_loss to zero ?

But in the eval step do not set them to 0.

signet-pytorch/train.py

Lines 58 to 59 in 36c5ee6

if (batch_idx + 1) % log_interval == 0 or batch_idx == len(dataloader) - 1:
print('{}/{}: Loss: {:.4f}'.format(batch_idx+1, len(dataloader), running_loss / number_samples))

网络实现

我看原论文中模型里所有的最大池化层大小都是33,在这个实现里都是22的,请问有没有试验过两种哪个性能好呢?

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.