Skip to content

Binarizing Documents by Leveraging both Space and Frequency. (ICDAR 2024)

Notifications You must be signed in to change notification settings

aimagelab/FourBi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FourBi

This repository contains the official implementation for our paper Binarizing Documents by Leveraging both Space and Frequency. If you find it useful, please cite it as:

@inproceedings{pippi2023handwritten,
  title={{Binarizing Documents by Leveraging both Space and Frequency}},
  author={Quattrini, Fabio and Pippi, Vittorio and Cascianelli, Silvia and Cucchiara, Rita},
  booktitle={International Conference on Document Analysis and Recognition},
  year={2024},
  organization={Springer}
}

Setup

To run this project, we used python 3.11.7 and pytorch 2.2.0

conda create -n fourbi python=3.11.7
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
pip3 install opencv-python wandb pytorch-ignite

Inference

To run the model on a folder with images, run with the following command

python binarize.py <path to checkpoint> --src <path to the test images folder> 
--dst <path to the output folder>

Training

The model is trained on patches, then evaluated and tested on complete documents. We provide the code to create the patches and train the model. For example, to train on H-DIBCO12, first download the dataset from http://utopia.duth.gr/~ipratika/HDIBCO2012/benchmark/. Create a folder, then place the images in a sub-folder named "imgs" and the ground truth in a sub-folder named "gt_imgs". Then run the following command:

python create_patches.py --path_src <path to the dataset folder> 
--path_dst <path to the folder where the patches will be saved> 
--patch_size <size of the patches> --overlap_size <size of the overlap>

To launch the training, run the following command:

python train.py --datasets_paths <all datasets paths> 
--eval_dataset_name <name of the validation dataset> 
--test_dataset_name <name of the validation dataset>

Models

We release the pre-trained weights for the FourBi variants trained on DIBCO benchmarks.

Testing data URL PSNR
0 H-DIBCO 2010 model 23.37
1 DIBCO 2011 model 22.26
2 H-DIBCO 2012 model 24.29
3 DIBCO 2013 model 24.17
4 H-DIBCO 2014 model 25.18
5 H-DIBCO 2016 model 19.74
6 DIBCO 2017 model 19.66
7 H-DIBCO 2018 model 20.92

About

Binarizing Documents by Leveraging both Space and Frequency. (ICDAR 2024)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages