Code Monkey home page Code Monkey logo

worddetectornn's Introduction

Handwritten Word Detector

A neural network based detector for handwritten words.

Run demo

  • Download trained model, and place the unzipped files into the model directory
  • Go to the src directory and execute python infer.py
  • This opens a window showing the words detected in the test images (located in data/test)
  • Required libs: torch, numpy, sklearn, cv2, path, matplotlib

aabbs

Train model

Data

  • The model is trained with the IAM dataset
  • Download the forms and the xml files
  • Create a dataset directory on your disk with two subdirectories: gt and img
  • Put all form images into the img directory
  • Put all xml files into the gt directory

Start training

  • Go to src and execute python train.py with the following parameters specified (only the first one is required):
    • --data_dir: dataset directory containing a gt and an img directory
    • --batch_size: 27 images per batch are possible on a 8GB GPU
    • --caching: cache the dataset to avoid loading and decoding the png images, cache file is stored in the dataset directory
    • --pretrained: initialize with saved model weights
    • --val_freq: speed up training by only validating each n-th epoch
    • --early_stopping: stop training after n validation steps without improvement
  • The model weights are saved every time the f1 score on the validation set increases
  • A log is written into the log directory, which can be opened with tensorboard
  • Executing python eval.py evaluates the trained model

Information about model

  • The model classifies each pixel into one of three classes (see plot below):
    • Inner part of a word (plot: red)
    • Outer part of a word (plot: green)
    • Background (plot: blue)
  • An axis-aligned bounding box is predicted for each inner-word pixel
  • DBSCAN clusters the predicted bounding boxes
  • The backbone of the neural network is based on the ResNet18 model (taken from torchvision, with modifications)
  • The model is inspired by the ideas of Zhou and Axler
  • See this article for more details

seg

worddetectornn's People

Contributors

pankajs99 avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

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.