https://github.com/ai-forever/stackmix-ocr
Science Score: 33.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
2 of 7 committers (28.6%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: ai-forever
- License: mit
- Language: Jupyter Notebook
- Default Branch: master
- Size: 3.41 MB
Statistics
- Stars: 46
- Watchers: 2
- Forks: 6
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
StackMix and Blot Augmentations for Handwritten Recognition using CTCLoss
This paper presents a new text generation method StackMix. StackMix can be applied to the standalone task of generating handwritten text based on printed text.
Config file
Create a new config file need in configs/__init__.py.
An individual config file is required for each dataset.
Datasets
There are two ways to get a dataset:
The first way:
Download a dataset and annotations (for example Bentham: http://www.transcriptorium.eu/~tsdata/BenthamR0/). Prepare dataset and create marking.csv file
The second way:
Downlad prepared dataset using the script download_dataset.py (for example Bentham: python scripts/download_dataset.py --dataset_name=bentham)
And now you can use train script.
You can change out folder by key --datadir='your path', by default --datadir=../StackMix-OCR-DATA. All dataset names: bentham, peter, hkr, iam.
Dataset format
The dataset should contain a directory with images and a csv file marking.csv with annotations. The csv file must contain the "stage" field with information about which sample the image belongs to (train / valid / test). An example of the structure and content of a csv file is given below
sample_id,path,stage,text
270-01,washington/images/270-01.png,train,"270. Letters, Orders and Instructions. October 1755."
270-03,washington/images/270-03.png,train,"only for the publick use, unless by particu-"
270-04,washington/images/270-04.png,train,lar Orders from me. You are to send
270-05,washington/images/270-05.png,train,"down a Barrel of Flints with the Arms, to"
Setup
install requirements:
pip install -r requirements.txt -f https://download.pytorch.org/whl/torch_stable.html
Example run train
python scripts/run_train.py \
--checkpoint_path "" \
--experiment_name "HKR_exp" \
--dataset_name "hkr" \
--data_dir "data/HKR/" \
--output_dir "exp/" \
--experiment_description \
"[Base] Training Base OCR on HKR dataset" \
--image_w 512 \
--image_h 64 \
--num_epochs 200 \
--bs 256 \
--num_workers 8 \
--use_blot 0 \
--use_augs 1 \
--use_progress_bar 0 \
--seed 6955
Example run evaluation
python scripts/run_evaluation.py \
--experiment_folder "exp/" \
--dataset_name "hkr" \
--data_dir "data/HKR/" \
--image_w 512 \
--image_h 64 \
--bs 128
Generating allcharmasks.json for stackmix
python scripts/prepare_char_masks.py \
--checkpoint_path "exp/HKR_exp/best_cer.pt" \
--data_dir "data/HKR/" \
--dataset_name "hkr" \
--image_w 512 \
--image_h 64 \
--bs 128 \
--num_workers 8
dataset_name must be taken from the config
Image generation
The code for generation can be found here
Example of generating images with stackmix

Supported by:
- Sber
- OCRV
- Sirius University
- RZHD
Citation
Please cite the related works in your publications if it helps your research:
@inproceedings{10.1145/3476887.3476892,
author = {Mark, Potanin and Denis, Dimitrov and Alex, Shonenkov and Vladimir, Bataev and Denis, Karachev and Maxim, Novopoltsev and Andrey, Chertok},
title = {Digital Peter: New Dataset, Competition and Handwriting Recognition Methods},
year = {2021},
isbn = {9781450386906},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3476887.3476892},
doi = {10.1145/3476887.3476892},
abstract = { This paper presents a new dataset of Peter the Great’s manuscripts and describes
a segmentation procedure that converts initial images of documents into lines. This
new dataset may be useful for researchers to train handwriting text recognition models
as a benchmark when comparing different models. It consists of 9694 images and text
files corresponding to different lines in historical documents. The open machine learning
competition ”Digital Peter” was held based on the considered dataset. The baseline
solution for this competition and advanced methods on handwritten text recognition
are described in the article. The full dataset and all codes are publicly available.},
booktitle = {The 6th International Workshop on Historical Document Imaging and Processing},
pages = {43–48},
numpages = {6},
keywords = {handwritten text recognition, Digital Peter, historical dataset, Russian},
location = {Lausanne, Switzerland},
series = {HIP '21}
}
Contacts
- A. Shonenkov shonenkov@phystech.edu
- D. Karachev
- M. Novopoltsev
- D. Dimitrov
- M. Potanin
Owner
- Name: AI Forever
- Login: ai-forever
- Kind: organization
- Location: Armenia
- Repositories: 60
- Profile: https://github.com/ai-forever
Creating ML for the future. AI projects you already know. We are non-profit organization with members from all over the world.
GitHub Events
Total
- Watch event: 6
- Fork event: 2
Last Year
- Watch event: 6
- Fork event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| shonenkov | s****v@p****u | 39 |
| Denis | k****n@b****u | 8 |
| Stanislav Kalinin | k****n@s****m | 4 |
| Denis | k****n@b****u | 4 |
| shonenkov | s****v@A****l | 4 |
| Denis | d****v@g****m | 2 |
| MarkPotanin | m****n@p****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 2
- Total pull requests: 24
- Average time to close issues: 23 days
- Average time to close pull requests: about 8 hours
- Total issue authors: 2
- Total pull request authors: 3
- Average comments per issue: 1.5
- Average comments per pull request: 0.0
- Merged pull requests: 23
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- miranghimire-fm (1)
- Michael95-m (1)
Pull Request Authors
- shonenkov (17)
- TheDenk (6)
- TrellixVulnTeam (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- albumentations ==0.1.12
- augmixations ==0.1.2
- bezier ==2020.5.19
- gdown ==3.12.2
- neptune-client ==0.5.1
- nltk ==3.5
- opencv-python ==4.4.0.46
- pandas ==1.2.2
- pre-commit ==2.10.1
- psutil ==5.8.0
- torch ==1.6.0
- torchvision ==0.7.0
- tpu-star ==0.0.1
- tqdm ==4.56.2
- pytorch/pytorch 1.6.0-cuda10.1-cudnn7-runtime build