Skip to main content

A package for signature classification with HOG features and KNN classifier, also for forg signatures detection

Reason this release was yanked:

import does not work

Project description

Signature-Classifier

A module for quick learning and using the signature classification model

Static Badge GitHub top language GitHub GitHub Repo stars

icon

Usage (Linux)

  1. Create a virtual environment
python -m venv venv
  1. Activate the virtual environment
source venv/bin/activate
  1. Install dependencies
pip install Signature-Classifier
  1. Run the script to demonstrate the capabilities of the library

Check out the usage examples to learn how to properly use the library. Ensure that your dataset is in the same format and has the same class names. Use the built-in or online documentation.

Training

Training the final model can be done either after optimizing hyperparameters or directly by adding custom values in the following format:

custom_params = {
    'resize_shape': (128, 256),
    'nns': 3,
    'orientations': 12,
    'cells_per_block': 3,
    'pixels_per_cell': 16,
}

You can also save plots that visualize the heatmap and confusion matrix. Example:

classification_report_heatmap confusion_matrix_heatmap


After training, all parameters, including custom ones, and the trained model are saved. You can then use only the predict method.

Prediction

The predict method allows you to select the number of nearest neighbors to return and whether to return the forgery probability (use only if there are such data in the training set). It returns a list of tuples, where each tuple consists of:

[('003', 1.0, 0.5347718688045583)]
  1. Class number.
  2. Probability of belonging to this class.
  3. Probability of forgery from 0 to 1, where 0 is a forgery and 1 is a genuine signature.

Why these methods?

HOG (Histogram of Oriented Gradients) - is a feature extraction method that transforms an image into a set of histograms of gradients, allowing the capture of shape and structure.

  • Robustness to Scale and Rotation: Signatures can be written at different angles and sizes, but HOG retains the essential characteristics of the image regardless of these changes.
  • Focus on Edge Features: Signatures consist of lines and curves, which are well represented by gradients. HOG effectively captures these edge features, crucial for accurate recognition.

hog example

KNN (k-Nearest Neighbors) - is a simple and efficient machine learning algorithm for classification tasks. It is based on the idea that objects close to each other in feature space are likely to belong to the same class. Since there is likely a small amount of data and signatures are relatively easy to distinguish, KNN is well-suited for this task.

Thank you for using Signature Classifier and star this project!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

signature_classifier-1.0.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Signature_Classifier-1.0.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file signature_classifier-1.0.0.tar.gz.

File metadata

  • Download URL: signature_classifier-1.0.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.19

File hashes

Hashes for signature_classifier-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f6351e371a33330fa6ed49692e3edde5fb45e41daf6e6cb4360211ded1516093
MD5 8ba825b6ba94bf567bed8133b65778db
BLAKE2b-256 60e7e1f05b56ff6dc52ef0939fdc6dc18c08e7c2efacb5d529723437d6a70b26

See more details on using hashes here.

File details

Details for the file Signature_Classifier-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for Signature_Classifier-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d23abea6595446fd114cbabedda75ae67bc9d2d0ef25b88caf60896949b202f
MD5 f860d61c8ea3e93c5dd0608c7a3a07cf
BLAKE2b-256 5213e93f39a7291514b3a8e49a124d1599cb13308a9d1fe407486a3fdef49f0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page