2021-05-11 21:13:19 +08:00
## OCR End2End Demo
2021-05-12 09:57:53 +08:00
< div align = "center" >
2021-05-12 20:35:39 +08:00
< img src = "https://github.com/open-mmlab/mmocr/raw/main/demo/resources/demo_ocr_pred.jpg" / > < br >
2021-05-12 09:57:53 +08:00
< / div >
2021-05-11 21:13:19 +08:00
### End-to-End Test Image Demo
To end-to-end test a single image with text detection and recognition simutaneously:
```shell
python demo/ocr_image_demo.py demo/demo_text_det.jpg demo/output.jpg
```
2021-05-12 09:57:53 +08:00
- The default config for text detection and recognition are [PSENet_ICDAR2015 ](/configs/textdet/psenet/psenet_r50_fpnf_600e_icdar2015.py ) and [SAR ](/configs/textrecog/sar/sar_r31_parallel_decoder_academic.py ), respectively.
2021-05-11 21:13:19 +08:00
- The predicted result will be saved as `demo/output.jpg` .
- To use other algorithms of text detection and recognition, please set arguments: `--det-config` , `--det-ckpt` , `--recog-config` , `--recog-ckpt` .
2021-05-13 17:58:38 +08:00
- To use batch mode for text recognition, please set arguments: `--batch-mode` , `--batch-size` .
2021-05-11 21:13:19 +08:00
### Remarks
1. If `--imshow` is specified, the demo will also show the image with OpenCV.
2. The `ocr_image_demo.py` script only supports GPU and so the `--device` parameter cannot take cpu as an argument.
2021-06-19 19:28:14 +08:00
3. (Experimental) By specifying `--ocr-in-lines` , the ocr results will be grouped and presented in lines.