← Open Source
wenwenyu

PICK-pytorch

Code for the paper "PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks" (ICPR 2020).

ModelsDomain-specific modelsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
570
Stars
189
Forks
+0
This week
5
Contributors
Created 2020-07-15 · Updated 2026-10-06 · #16839 today
Top developers
tengeryewenwenyudbobrenko

wenwenyu/PICK-pytorch is ranked 16,839 with 570 stars.

Same-category comparison

wenwenyu/PICK-pytorch is ranked 16,839 among these 8 peers; Robert-gyj/Ctrl-World is ranked 16,845.

Same-category comparison
NameRankMetrics
SUDO-AI-3D/One2345plus16,776
Stars:
572
Forks:
10
philgras/neural-head-avatars16,796
Language:
Python
Stars:
572
Forks:
77
Description:
Official PyTorch implementation of "Neural Head Avatars from Monocular RGB Videos".
cambrian-mllm/cambrian-s16,810
Language:
Python
Stars:
571
Forks:
24
Description:
Cambrian-S: Towards Spatial Supersensing in Video.
nv-tlabs/Gamma-World16,832
Language:
Python
Stars:
570
Forks:
14
Description:
Implementation of Gamma-World: Generative Multi-Agent World Modeling Beyond Two Players.
Robert-gyj/Ctrl-World16,845
Language:
Python
Stars:
569
Forks:
59
Description:
ICLR 2026 Paper: Ctrl-World.
Ethan-yt/guwenbert16,859
Stars:
568
Forks:
41
ShannonAI/ChineseBert16,861
Language:
Python
Stars:
568
Forks:
91
Description:
Code for ACL 2021 paper "ChineseBERT: Chinese Pretraining Enhanced by Glyph and Pinyin Information".
chaoyi-wu/RadFM16,863
Language:
Python
Stars:
568
Forks:
66
Description:
The official code for "Towards Generalist Foundation Model for Radiology by Leveraging Web-scale 2D&3D Medical Data".
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModels
SubcategoryDomain-specific models
KeywordsDocument understanding, OCR, Unstructured data extraction
Stars570
Forks189
Contributors5
Created date2020-07-15
Updated date2026-10-06
Stars in 1 day0
Stars in 7 days0
Rank16,839
Previous rank16,631
Rank change-208
7-day stars rank15,756
Previous 7-day stars rank15,765
7-day stars rank change9
Total stars rank17,496
Previous total stars rank17,466
Total stars rank change-30
README summary

PICK-PyTorch **\*\*\*\*\* Updated on Feb 6th, 2021: Train Ticket dataset is now available for academic research. You can download from Google Drive or OneDrive. It contains 1,530 synthetic images and 320 real images for training, and 80 real images for testing. Please refer to our paper for more details about how to sample training/testing set from EATEN and generate the corresponding annotations. \*\*\*\*\*** **\*\*\*\*\* Updated on Sep 17th, 2020: A training example on the large-scale document understanding dataset, DocBank

, is now available. Please refer to examples/DocBank/README. \*\*\*\*\*** PyTorch reimplementation of "PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks" (ICPR 2020). This project is different from our original implementation. Contents Introduction PICK is a framework that is effective and robust in handling complex documents layout for Key Information Extraction (KIE) by combining graph learning with graph convolution operation, yielding a richer semantic representation containing the textual and visual features and global layout without ambiguity

. 1 Usage Distributed training with config files Modify the configurations in and files, then run: The application will be launched via on a 4 GPU node with one process per GPU (recommend). This is equivalent to and is equivalent to specify indices of available GPUs by instead of args Similarly, it can be launched with a single process that spans all 4 GPUs (if node has 4 available GPUs) using (don't recommend): Using Multiple Node You can enable multi-node

multi-GPU training by setting and args of the commandline line on every node. , 2 nodes 4 gpus run as follows Node 1, ip: 192. 10, then run on node 1 as follows Node 2, ip: 192. 15, then run on node 2 as follows Resuming from checkpoints You can resume from a previously saved checkpoint by: Debug mode on one GPU/CPU training with config files This option of training mode can debug code without distributed way. must set

to to turn off distributed mode. Testing from checkpoints You can test from a previously saved checkpoint by: Customization Training custom datasets You can train your own datasets following the steps outlined below. Prepare the correct format of files as provided in folder. md an instruction how to prepare the data in required format for PICK. Modify and args in file, including , , , , and . Modify in file according to the entity type of your dataset. Modify in file if needed according

to the vocabulary of your dataset. **Note**: The self-build datasets our paper used cannot be shared for patient privacy and proprietary issues. Checkpoints You can specify the name of the training session in files: The checkpoints will be saved in , with timestamp in mmdd_HHMMSS format. A copy of file will be saved in the same folder. **Note**: checkpoints contain: Tensorboard Visualization This project supports Tensorboard visualization by using either or TensorboardX. **Open Tensorboard server** By default, values of

loss will be logged. If you need more visualizations, use , , etc in the method. methods in this project are basically

Frequently asked questions

How many stars and forks are recorded?

wenwenyu/PICK-pytorch has 570 stars and 189 forks.

What is the repository rank?

wenwenyu/PICK-pytorch is ranked 16,839.

What language and category are recorded?

wenwenyu/PICK-pytorch has 570 stars, uses Python and belongs to Models.

Which repository is closest in rank?

wenwenyu/PICK-pytorch is compared with Robert-gyj/Ctrl-World, ranked 16,845 with 569 stars.

README

PICK-PyTorch

***** Updated on Feb 6th, 2021: Train Ticket dataset is now available for academic research. You can download from Google Drive or OneDrive. It contains 1,530 synthetic images and 320 real images for training, and 80 real images for testing. Please refer to our paper for more details about how to sample training/testing set from EATEN and generate the corresponding annotations.*****

***** Updated on Sep 17th, 2020: A training example on the large-scale document understanding dataset, DocBank, is now available. Please refer to examples/DocBank/README.md for more details. Thanks TengQi Ye for this contribution.*****

PyTorch reimplementation of "PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks" (ICPR 2020). This project is different from our original implementation.

Introduction

PICK is a framework that is effective and robust in handling complex documents layout for Key Information Extraction (KIE) by combining graph learning with graph convolution operation, yielding a richer semantic representation containing the textual and visual features and global layout without ambiguity. Overall architecture shown follows.

Requirements

  • python = 3.6
  • torchvision = 0.6.1
  • tabulate = 0.8.7
  • overrides = 3.0.0
  • opencv_python = 4.3.0.36
  • numpy = 1.16.4
  • pandas = 1.0.5
  • allennlp = 1.0.0
  • torchtext = 0.6.0
  • tqdm = 4.47.0
  • torch = 1.5.1
pip install -r requirements.txt

Usage

Distributed training with config files

Modify the configurations in config.json and dist_train.sh files, then run:

bash dist_train.sh

The application will be launched via launch.py on a 4 GPU node with one process per GPU (recommend).

This is equivalent to

python -m torch.distributed.launch --nnodes=1 --node_rank=0 --nproc_per_node=4 \
--master_addr=127.0.0.1 --master_port=5555 \
train.py -c config.json -d 1,2,3,4 --local_world_size 4

and is equivalent to specify indices of available GPUs by CUDA_VISIBLE_DEVICES instead of -d args

CUDA_VISIBLE_DEVICES=1,2,3,4 python -m torch.distributed.launch --nnodes=1 --node_rank=0 --nproc_per_node=4 \
--master_addr=127.0.0.1 --master_port=5555 \
train.py -c config.json --local_world_size 4

Similarly, it can be launched with a single process that spans all 4 GPUs (if node has 4 available GPUs) using (don't recommend):

CUDA_VISIBLE_DEVICES=1,2,3,4 python -m torch.distributed.launch --nnodes=1 --node_rank=0 --nproc_per_node=1 \
--master_addr=127.0.0.1 --master_port=5555 \
train.py -c config.json --local_world_size 1

Using Multiple Node

You can enable multi-node multi-GPU training by setting nnodes and node_rank args of the commandline line on every node. e.g., 2 nodes 4 gpus run as follows

Node 1, ip: 192.168.0.10, then run on node 1 as follows

CUDA_VISIBLE_DEVICES=1,2,3,4 python -m torch.distributed.launch --nnodes=2 --node_rank=0 --nproc_per_node=4 \
--master_addr=192.168.0.10 --master_port=5555 \
train.py -c config.json --local_world_size 4  

Node 2, ip: 192.168.0.15, then run on node 2 as follows

CUDA_VISIBLE_DEVICES=2,4,6,7 python -m torch.distributed.launch --nnodes=2 --node_rank=1 --nproc_per_node=4 \
--master_addr=192.168.0.10 --master_port=5555 \
train.py -c config.json --local_world_size 4  

Resuming from checkpoints

You can resume from a previously saved checkpoint by:

python -m torch.distributed.launch --nnodes=1 --node_rank=0 --nproc_per_node=4 \
--master_addr=127.0.0.1 --master_port=5555 \
train.py -d 1,2,3,4 --local_world_size 4 --resume path/to/checkpoint

Debug mode on one GPU/CPU training with config files

This option of training mode can debug code without distributed way. -dist must set to false to turn off distributed mode. -d specify which one gpu will be used.

python train.py -c config.json -d 1 -dist false

Testing from checkpoints

You can test from a previously saved checkpoint by:

python test.py --checkpoint path/to/checkpoint --boxes_transcripts path/to/boxes_transcripts \
               --images_path path/to/images_path --output_folder path/to/output_folder \
               --gpu 0 --batch_size 2

Customization

Training custom datasets

You can train your own datasets following the steps outlined below.

  1. Prepare the correct format of files as provided in data folder.
    • Please see data/README.md an instruction how to prepare the data in required format for PICK.
  2. Modify train_dataset and validation_dataset args in config.json file, including files_name, images_folder, boxes_and_transcripts_folder, entities_folder, iob_tagging_type and resized_image_size.
  3. Modify Entities_list in utils/entities_list.py file according to the entity type of your dataset.
  4. Modify keys.txt in utils/keys.txt file if needed according to the vocabulary of your dataset.
  5. Modify MAX_BOXES_NUM and MAX_TRANSCRIPT_LEN in data_tuils/documents.py file if needed.

Note: The self-build datasets our paper used cannot be shared for patient privacy and proprietary issues.

Checkpoints

You can specify the name of the training session in config.json files:

"name": "PICK_Default",
"run_id": "test"

The checkpoints will be saved in save_dir/name/run_id_timestamp/checkpoint_epoch_n, with timestamp in mmdd_HHMMSS format.

A copy of config.json file will be saved in the same folder.

Note: checkpoints contain:

{
  'arch': arch,
  'epoch': epoch,
  'state_dict': self.model.state_dict(),
  'optimizer': self.optimizer.state_dict(),
  'monitor_best': self.monitor_best,
  'config': self.config
}

Tensorboard Visualization

This project supports Tensorboard visualization by using either torch.utils.tensorboard or TensorboardX.

  1. Install

    If you are using pytorch 1.1 or higher, install tensorboard by 'pip install tensorboard>=1.14.0'.

    Otherwise, you should install tensorboardx. Follow installation guide in TensorboardX.

  2. Run training

    Make sure that tensorboard option in the config file is turned on.

     "tensorboard" : true
    
  3. Open Tensorboard server

    Type tensorboard --logdir saved/log/ at the project root, then server will open at http://localhost:6006

By default, values of loss will be logged. If you need more visualizations, use add_scalar('tag', data), add_image('tag', image), etc in the trainer._train_epoch method. add_something() methods in this project are basically wrappers for those of tensorboardX.SummaryWriter and torch.utils.tensorboard.SummaryWriter modules.

Note: You don't have to specify current steps, since WriterTensorboard class defined at logger/visualization.py will track current steps.

Results on Train Ticket

TODOs

  • [ ] Dataset cache mechanism to speed up training loop
  • [x] Multi-node multi-gpu setup (DistributedDataParallel)

Citations

If you find this code useful please cite our paper:

@inproceedings{Yu2020PICKPK,
  title={{PICK}: Processing Key Information Extraction from Documents using 
  Improved Graph Learning-Convolutional Networks},
  author={Wenwen Yu and Ning Lu and Xianbiao Qi and Ping Gong and Rong Xiao},
  booktitle={2020 25th International Conference on Pattern Recognition (ICPR)},
  year={2020}
}

License

This project is licensed under the MIT License. See LICENSE for more details.

Acknowledgements

This project structure takes example by PyTorch Template Project.

Nearby in the ranking
Similar items