mmocr
mmocr copied to clipboard
the same code but different results
MMOCR_Tutorial --toy datasets
The following code can be executed after the training code, but cannot be executed in a separate file (demo.py).
import mmcv import matplotlib.pyplot as plt
def show_img_from_path(img_path): img = mmcv.imread(img_path) img_RGB = mmcv.bgr2rgb(img) plt.imshow(img_RGB) plt.show()
def show_img_from_array(img): img_RGB = mmcv.bgr2rgb(img) plt.imshow(img_RGB) plt.show()
from mmocr.apis import init_detector, model_inference
checkpoint = "runs/tutorial_exps/latest.pth" from mmcv import Config cfg = Config.fromfile('myconfigs/sar_r31_parallel_decoder_toy_dataset.py') input_path = 'data/ocr_toy_dataset/imgs/1036169.jpg' model = init_detector(cfg, checkpoint, device="cuda:0") result = model_inference(model, input_path) out_img = model.show_result(input_path, result, out_file='outputs/demo-out.jpg', show=False) show_img_from_array(out_img)
the error: KeyError: 'MultiRotateAugOCR is not in the pipeline registry'
total error hints:
File "/home/chen/OD/MMOCR_tutorials/mmocr_demo05.py", line 22, in
pytorch's envs has installed several reposities including mmdet,mmcls,mmocr
Hi @dsp6414 Try the following code in the MMOCR home directory.
pip install -v -e .
export PYTHONPATH=$(pwd):$PYTHONPATH
I tried it. It is still the same.
i debug The file. it only executed mmdet pipline Register not mmocr. it calls Compose In mmdet.
i found The problem. import mmocr.datasets.pipelines
it is ok. I think this is a little bug.
Thanks for the update! We will fix it in #887 .