Skip to content

ektavats/strikethrough-removal-cyclegans

 
 

Repository files navigation

Strikethrough Removal From Handwritten Words Using CycleGANs

License

Code and related resources for the ICDAR 2021 paper Strikethrough Removal From Handwritten Words Using CycleGANs

Table of Contents

  1. Code
    1. Strikethrough Removal
    2. Strikethrough Classification
    3. Strikethrough Identification
    4. Running the Code
  2. Data
  3. Citation
  4. Acknowledgements

Code

Each of the following subdirectories contains the code that was used in the context of this paper. Additionally, Python requirements and the original configuration(s) are included for each. Configuration files have to be modified with local paths to input and output directories before running.

Model checkpoints are attached in the release of this repository.

Strikethrough Removal

  • code for training various forms of CycleGANs to remove strikethrough from handwritten words
  • the CycleGAN code is based on https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix

    @inproceedings{CycleGAN2017, title={Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networkss}, author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A}, booktitle={Computer Vision (ICCV), 2017 IEEE International Conference on}, year={2017} }

Strikethrough Classification

  • code to train a DenseNet121 to classify a struck-through word image into one of seven types of strikethrough

Strikethrough Identification

  • code to train a DenseNet121 to identify whether a given word image is struck-through or not (i.e. 'clean')

Running the Code

Train

In order to train any of the three models, run:

python src/train.py -configfile <path to config file> -config <name of section from config file>

If no configfile is defined, the script will assume config.cfg in the current working directory. If no config is defined, the script will assume DEFAULT.

Test

For testing, run:

python src/train.py -configfile <path to config file> -data <path to data dir>
  • configfile should point to the config file in an output directory of a train run (or one of the checkpoint config files)
  • data should point to a directory containing struck and struck_gt sub-directories, e.g. one of the datasets presented in Data
  • an additional flag -save can be specified to save the cleaned images, otherwise only performance metrics (F1 score and RMSE) will be logged

Data

Citation

ICDAR 2021

@INPROCEEDINGS{heil2021strikethrough,
  author={Heil, Raphaela and Vats, Ekta and Hast, Anders},
  booktitle={2021 International Conference on Document Analysis and Recognition (ICDAR)},
  title={{Strikethrough Removal from Handwritten Words Using CycleGANs}},
  year={2021},
  pubstate={to appear}}

Acknowledgements

  • R.Heil would like to thank Nicolas Pielawski, Håkan Wieslander, Johan Öfverstedt and Anders Brun for their helpful comments and fruitful discussions.
  • The computations were enabled by resources provided by the Swedish National Infrastructure for Computing (SNIC) at the High Performance Computing Center North (HPC2N) partially funded by the Swedish Research Council through grant agreement no. 2018-05973.

About

Strikethrough Removal From Handwritten Words Using CycleGANs

Resources

License

Stars

Watchers

Forks

Languages

  • Python 100.0%