cd mmocr-dev-1.x
conda create -n mmocr1.0 python=3.8 -y
# PyTorch 1.6 or higher is required
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip install -U openmim
mim install mmengine
mim install mmcv
mim install mmdet
pip install timm
pip install -r requirements/albu.txt
pip install -r requirements.txt
pip install -v -e .
We use inferencer in MMOCR for inference. It can be used to inference on raw images, or a list of images. And it also supports visualization.
-
- Download the pre-trained MAERec
-
- Run the following command to inference on raw images:
cd mmocr-dev-1.x python tools/infer.py \ ${Input image file or folder path.} \ --out-dir ${Output folder path.} \ --rec configs/textrecog/maerec/maerec_b_union14m.py \ --rec-weights ${Path to MAERec checkpoint.} \ --device cuda \ --show \ --save_pred \ --save_vis
Let's combine MAERec with DBNet++ for end-to-end text recognition.
-
- Download pretrained DBNet++ model
wget https://download.openmmlab.com/mmocr/textdet/dbnetpp/dbnetpp_resnet50-oclip_fpnc_1200e_icdar2015/dbnetpp_resnet50-oclip_fpnc_1200e_icdar2015_20221101_124139-4ecb39ac.pth -O dbnetpp.pth
-
- Run the following command to inference on raw images:
cd mmocr-dev-1.x python tools/infer.py \ ${Input image file or folder path.} \ --out-dir ${Output folder path.} \ --rec configs/textrecog/maerec/maerec_b_union14m.py \ --rec-weights ${Path to MAERec checkpoint.} \ --det configs/textdet/dbnetpp/dbnetpp_resnet50-oclip_fpnc_1200e_icdar2015.py \ --det-weights dbnetpp.pth \ --device cuda \ --show \ --save_pred \ --save_vis