Skip to content

AKBiradar02/iam_handwritten_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IAM Handwritten Text Recognition Model

This repository contains the source code for a handwritten text recognition model trained on the IAM Handwriting Database.

🚀 Setup Guide

Follow these steps to set up your environment and run the project locally.


1. Prerequisites

Before starting, ensure you have the following installed:

  • Git
  • Python 3.x (with pip)
  • Git LFS (Optional, but highly recommended for tracking large model files if you decide to commit them later).

2. Get the Code

Clone the repository to your local machine:

git clone [https://github.com/AKBiradar02/iam_handwritten_model.git](https://github.com/AKBiradar02/iam_handwritten_model.git)
cd iam_handwritten_model


3. Setup Dependencies
Install all required Python packages. If you don't have a requirements.txt file, you'll need to create one first.

Bash

pip install -r requirements.txt
4. Setup the Dataset Folder
The datasets/IAM_words folder, which contains the word images, is not tracked by Git due to its large size. You must download and place the necessary files to run the training or inference scripts.

A. Download the Data
Download the IAM Handwriting Database - Word Images (specifically the words dataset).

The key files needed are typically the main ground truth file (words.txt) and the compressed word images archive (words.tgz).

B. Place the Files
Create the necessary base directory structure:

Bash

mkdir -p datasets/IAM_words/words
Place the ground truth file words.txt directly inside the datasets/IAM_words/ folder.

Place the archive words.tgz inside the datasets/IAM_words/ folder.

Extract the contents of words.tgz into the datasets/IAM_words/words/ folder.

Your final structure should match this:

IAM_DATASET_PROJECT/
├── datasets/
│   └── IAM_words/
│       ├── words/  <-- Extracted word images go here
│       ├── words.tgz
│       └── words.txt
5. Setup the Models Folder
The Models directory and its contents (logs/, model.h5) are ignored by Git as they are artifacts generated during training.

A. Generating New Models
If you are training a new model, the entire structure (Models/202502280926/) will be created automatically when you run the training script:

Bash

python scripts/train.py
B. Using Pre-trained Models
If you are running inference using a pre-trained model, you must manually obtain the artifacts and place them correctly:

Create a directory for the model version:

Bash

mkdir -p Models/pretrained_model_v1/
Replace pretrained_model_v1 with a descriptive name.

Place the Artifacts: Place the following files into the folder you just created:

model.h5 (The trained model weights)

configs.yaml (The configuration used for training)

About

The goal of this project is to accurately transcribe handwritten English word images into text using a deep learning model. This is achieved through the use of: The IAM Handwriting Dataset is a labeled image corpus CNN + BLSTM + CTC architecture An end-to-end training and inference pipeline

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages