Writer Identification System

Considered Research Papers

Dataset Exploration

Pre-Processing Stage

  • Remove document noise.
  • Extract written part only.
  • Segment out lines.

Feature Extraction

  • LBP Texture Descriptors.
  • GLCM Texture Descriptors.
  • GLCM (CSLBCoP) Texture Descriptors.
  • LPQ Texture Descriptors.
  • PCA (or Truncated SVD) on extracted features.

Classifiers

  • SVM.
  • KNN.
  • RF.
  • LR.
  • NB.

Folder Structure

  • idlib/classifier : contains code for different classifiers.
  • idlib/dataset : contains code for train and test dataloaders.
  • idlib/feature_extractor : contains code for different feature extractors.
  • idlib/preprocessor : contains code for form preparation.
  • idlib/trainer : contains code for training functions.
  • idlib/test.py : contains main test pipeline.
  • idlib/train.py : contains main train pipeline.
  • run.py : contains main driver function for system.

Installation

  • Install dependencies from requirements.txt:
    pip3 install -r requirements.txt

Usage

Complete Train

  • Run run.py :
    python run.py -dir /path/to/data/root/directory -mode complete-train

/path/to/data/root/directory should contain formsA-D, formsE-H, formsI-Z and ascii folders from IAM Handwriting Database.

Sampled Train

  • Run run.py :
    python run.py -dir /path/to/data/root/directory -mode sampled-train

/path/to/data/root/directory should contain formsA-D, formsE-H, formsI-Z and ascii folders from IAM Handwriting Database.

Test

  • Run run.py :
    python run.py -dir /path/to/test/data/root/directory -mode test

/path/to/test/data/root/directory should contain data folder containing test cases and should be of the following structure :

.
└── data
    ├── 01
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 02
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 03
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 04
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 05
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 06
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 07
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 08
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    ├── 09
    │   ├── 1
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 2
    │   │   ├── 1.png
    │   │   └── 2.png
    │   ├── 3
    │   │   ├── 1.png
    │   │   └── 2.png
    │   └── test.png
    └── 10
        ├── 1
        │   ├── 1.png
        │   └── 2.png
        ├── 2
        │   ├── 1.png
        │   └── 2.png
        ├── 3
        │   ├── 1.png
        │   └── 2.png
        └── test.png

After running the previous command, the code generates two text files results.txt and time.txt in the root directory next to data folder.