A package for signature classification with HOG features and KNN classifier, also for forg signatures detection
Project description
Signature-Classifier
A module for quick learning and using the signature classification model
Usage (Linux)
- Create a virtual environment
python -m venv venv
- Activate the virtual environment
source venv/bin/activate
- Install dependencies
pip install Signature-Classifier
- 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:
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)]
- Class number.
- Probability of belonging to this class.
- 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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file signature_classifier-1.0.1.tar.gz.
File metadata
- Download URL: signature_classifier-1.0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd284e0b1c3a6fc0ae809ef7b4ca8ec338614ba177625ee0373c82efe7a954c9
|
|
| MD5 |
3a633efa9818c507539d5a2a95131125
|
|
| BLAKE2b-256 |
e334857c85807132eda1e0fbd053ab70f5b1346d80567683026f452dc135db39
|
File details
Details for the file Signature_Classifier-1.0.1-py3-none-any.whl.
File metadata
- Download URL: Signature_Classifier-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80f8cc35db048057fef655f1dfd0ddbf86a8710d21b9fb5baca31e3fdb40a327
|
|
| MD5 |
d8569bf040d21f9f36d389b6b414a7c6
|
|
| BLAKE2b-256 |
65f221efd6291d33c752015ac213dcae92a986381be2028b0aa2ae883befcd2d
|