open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.27k stars 743 forks source link

Error while running SDMGR #72

Closed AnoZee closed 3 years ago

AnoZee commented 3 years ago

Reproduction

python demo/image_demo.py demo/0.jpeg configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt.py model_weights/tr_weights/sdmgr_unet16_60e_wildreceipt_20210405-16a47642.pth demo/image_recog_results/SDMGR/0_sdmgr_vt.jpg

No modifications were made to the config.

Environment

sys.platform: linux Python: 3.7.10 (default, Feb 26 2021, 18:47:35) [GCC 7.3.0] CUDA available: True GPU 0: Tesla K80 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 10.0, V10.0.130 GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 PyTorch: 1.5.0 PyTorch compiling details: PyTorch built with:

TorchVision: 0.6.0a0+82fd1c8 OpenCV: 4.5.1 MMCV: 1.2.6 MMCV Compiler: GCC 7.3 MMCV CUDA Compiler: 10.1 MMOCR: 0.1.0+5244984

All installation steps were followed as per the documentation.

Error traceback

/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmdet/apis/inference.py:47: UserWarning: Class names are not saved in the checkpoint's meta data, use COCO classes by default.
  warnings.warn('Class names are not saved in the checkpoint\'s '
Traceback (most recent call last):
  File "demo/image_demo.py", line 44, in <module>
    main()
  File "demo/image_demo.py", line 32, in main
    result = model_inference(model, args.img)
  File "/home/ubuntu/Desktop/mmocr/mmocr/mmocr/apis/inference.py", line 25, in model_inference
    data = test_pipeline(data)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmdet/datasets/pipelines/compose.py", line 40, in __call__
    data = t(data)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmdet/datasets/pipelines/loading.py", line 365, in __call__
    results = self._load_bboxes(results)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmdet/datasets/pipelines/loading.py", line 240, in _load_bboxes
    ann_info = results['ann_info']
KeyError: 'ann_info'
innerlee commented 3 years ago

Currently image_demo.pydoes not support sdmgr. We will add an end2end demo shortly https://github.com/open-mmlab/mmocr/issues/60

cuhk-hbsun commented 3 years ago
  1. sdmg-r requires both image and the related metas (bboxes and text), while image_demo.py only use image as input.
  2. we will give end2end demo (text detect + text recognize + key information extraction) soon.
  3. Currently, you can use tools/kie_test_imgs.py to do visualize (download wildreceipt datasets first https://mmocr.readthedocs.io/en/latest/datasets.html)