Inference.md

February 26, 2024 · View on GitHub

Getting Started

Installation

Requires Python >= 3.8 and PyTorch >= 1.10.

conda create --name largeocrmodel python==3.8
pip install -r requirements.txt

Data and Model

  • For convenient, you can download the six common benchmark dataset from CDistNet, and download Union 14M benchmark dataset from Union14M dataset.

    select organize the data directory as follows after downloading all of them:

  • Test Data Structure Tree
    ```
    .
    ├── test
    │   ├── CUTE80
    │   ├── IC13_1015
    │   ├── IC13_857
    │   ├── IC15_1811
    │   ├── IIIT5k
    │   ├── SVT
    │   ├── SVTP
    │   ├── artistic
    │   ├── contextless
    │   ├── curve
    │   ├── general
    │   ├── multi_oriented
    │   ├── multi_words
    │   └── salient
    
    ```
    
  • weights of CLIP-ViT-B/16 pre-trained models can be found in CLIP-ViT-B/16

Results

CLIP4STR-B's word accuracy on the Common benchmark

MethodTrain dataIIIT5KSVTIC13IC15SVTPCUTE
CLIP4STR-BMJ+ST97.7095.3696.0687.4791.4794.44
CLIP4STR-BReal99.2098.3098.2391.4496.9099.65
CLIP4STR-B*RESU-syn98.9798.7699.3092.2797.8399.65

CLIP4STR-B's word accuracy on the Union14M benchmark.

MethodTrain dataArtisticContextlessCurveGeneralMulti-OrientedMulti-WordsSalient
CLIP4STR-BReal86.592.296.389.996.188.991.2
CLIP4STR-B*REBU-Syn88.690.196.489.196.392.291.9

Inference

  1. Download the CLIP4STR-B* from BaiduYun(wjk8) or GoogleYun
  2. Run the following command to inference on test data:

​ Inference CLIP4STR-B* on six common benchmark

python test.py --checkpoint /path/to/your/clip4str_b_plus.ckpt --data_root /path/to/your/eval_dataset --clip_model_path /path/to/your/ViT-B-16.pt

Inference CLIP4STR-B* on Union14M benchmark

python test.py --checkpoint /path/to/your/clip4str_b_plus.ckpt --data_root /path/to/your/eval_dataset --new --clip_model_path /path/to/your/ViT-B-16.pt

Acknowledgement

We are very grateful to CLIP4STR for providing the inference framework.