This repository is based on the CoMER (Contextual Memory and External Representation) model and aims to participate in the ICPR 2024 (International Conference on Pattern Recognition Competition, focusing on the recognition of multi-line mathematical expressions.
Our team name is None Information Given(NIG), winning 4th place in this competition
- BaiduDisk with code icpr
docker load -i nic-image.tar
- CPU >= 4 cores
- RAM >= 64 GB
- SHM β₯ 16GB
- Disk >= 50 GB
- Docker >= 24.0.0
-
download the docker images
-
load docker image
docker load -i nic-image.tar
-
start up the container
docker run -itd \ --gpus all \ --name nic-icpr \ --shm-size=16g \ -m 64g \ nic-image \ /bin/bash
-
docker exec -it [id] /bin/bash
-
cd /root/icpr
-
Download the git repo
git clone https://github.com/BFlameSwift/icpr
-
Download and unzip data
# downlaod Train data wget https://s2.kxsz.net/datad-public-1255000019/ICPR_2024/ICPR%202024%20Competition%20o n%20Multi-line%20Mathematical%20Expressions%20Recognition%20RegistrationForm%20trainning%20set.zip # downlaod miniconda wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py39_24.3.0-0-Linux-x86_64.sh # create dir mkdir -p ./data/source/ # unzip test data unzip ICPR\ 2024\ Competition\ on\ Multi-line\ Mathematical\ Expressions\ Recognition\ RegistrationForm\ Test_A\ set.zip -d ./data/testAdata/ # unzip train data unzip ICPR\ 2024\ Competition\ on\ Multi-line\ Mathematical\ Expressions\ Recognition\ RegistrationForm\ trainning\ set.zip -d ./data/source
-
Preprocess data
cd icpr conda activate icpr cd deploy python 1-preprocess image.py python 2-split_train_test.py ./3-rebag_data.sh
-
Next, navigate to icpr folder and run
train.py
. It may take 48 hours on 8 NVIDIA 2080Ti gpus using ddp.# train CoMER(Fusion) model using 4 gpus and ddp python train.py --config config.yaml
For single gpu user, you may change the
config.yaml
file togpus: 1 # gpus: 4# accelerator: ddp
-
Preprocess testA data
- download and unzip test dat
cd icpr # download test data wget https://s2.kxsz.net/datad-public-1255000019/ICPR_2024/ICPR%202024%20Competition%20on%20Multi-line%20Mathematical%20Expressions%20Recognition%20RegistrationForm%20Test_A%20set.zip # create dir mkdir -p ./data/testAdata/ # unzip test data unzip ICPR\ 2024\ Competition\ on\ Multi-line\ Mathematical\ Expressions\ Recognition\ RegistrationForm\ Test_A\ set.zip -d ./data/testAdata/
conda activate icpr cd deploy python 4-process_testA.py # rebag testAdata to data.zip ./5-rebag_testAdata.sh
-
Model inference in testA dataοΌ
# in Project root dir #evaluate model in lightning_logs/version_1 on test setοΌdata.zip/grayοΌ python ./scripts/test/test.py 1 gray
-
Get answer.json
python 6-process_testA_answer.py
βββ README.md
βββ comer# model definition folder
βββ config.yaml# config for CoMER hyperparameter
βββ data.zip# train data or test data zip file
βββ deploy# data preprocess and test folder
βββ eval_all.sh# script to evaluate model on all CROHME test sets
βββ lightning_logs# training logs
β βββ version_0
β βββ checkpoints
β βββ config.yaml
β βββ hparams.yaml
βββ requirements.txt
βββ notebooks# jupyter notebooks
βββ scripts# evaluation scripts
βββ setup.cfg
βββ setup.py
βββ train.py
cd icpr
# install project
conda create -y -n icpr python=3.7
conda activate CoMER
conda install pytorch=1.8.1 cudatoolkit=11.1 pillow=8.4.0 -c pytorch -c nvidia
pip install torchvision==0.2.2
# training dependency
conda install pytorch-lightning=1.4.9 torchmetrics=0.6.0 -c conda-forge
# evaluating dependency
conda install pandoc=1.19.2.1 -c conda-forge
pip install -e .