open-mmlab / mmocr

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

[Bug] lmdb dataset visualization error #1973

Open wangjiale1998 opened 10 months ago

wangjiale1998 commented 10 months ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmocr

Environment

System environment: sys.platform: win32 Python: 3.8.17 (default, Jul 5 2023, 20:44:21) [MSC v.1916 64 bit (AMD64)] CUDA available: True numpy_random_seed: 1207759967 GPU 0: GeForce GTX 1080 Ti CUDA_HOME: None MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30137 版 GCC: n/a PyTorch: 1.10.1 PyTorch compiling details: PyTorch built with:

Runtime environment: cudnn_benchmark: False mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0} dist_cfg: {'backend': 'nccl'} seed: 1207759967 Distributed launcher: none Distributed training: False GPU number: 1

Reproduces the problem - code sample

base = [ '../base/default_runtime.py', '../base/datasets/mjsynth.py', '../base/datasets/synthtext.py', '../base/datasets/cute80.py', '../base/datasets/iiit5k.py', '../base/datasets/svt.py', '../base/datasets/svtp.py', '../base/datasets/icdar2003.py', '../base/datasets/icdar2013_lmdb.py', '../base/datasets/icdar2015_lmdb.py', '../base/schedules/schedule_adam_base.py', ] test_pipeline = [ dict(type='LoadImageFromNDArray'), dict(type='Resize', scale=(256, 64), keep_ratio=False),

dict(

#     type='RescaleToHeight',
#     height=32,
#     min_width=32,
#     max_width=100,
#     width_divisor=4),
# dict(type='PadToWidth', width=100),
dict(type='LoadOCRAnnotations', with_text=True),
dict(
    type='PackTextRecogInputs',
    meta_keys=('img_path', 'ori_shape', 'img_shape', 'valid_ratio'))

] val_dataloader = dict( batch_size=64, num_workers=0, persistent_workers=False, pin_memory=True, drop_last=False, sampler=dict(type='DefaultSampler', shuffle=False), dataset=dict( type='ConcatDataset', datasets=test_list, pipeline=test_pipeline))

vis_backends = [ dict(type='LocalVisBackend'), dict(type='TensorboardVisBackend') ] visualizer = dict( type='TextRecogLocalVisualizer', name='visualizer', vis_backends=vis_backends)

Reproduces the problem - command or script

python tools/test.py [configs] [.pth] --show-dir workdirs

Reproduces the problem - error message

Traceback (most recent call last): File "tools/test.py", line 141, in main() File "tools/test.py", line 137, in main runner.test() File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\mmengine\runner\runner.py", line 1791, in test metrics = self.test_loop.run() # type: ignore File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\mmengine\runner\loops.py", line 435, in run self.run_iter(idx, data_batch) File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context return func(*args, kwargs) File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\mmengine\runner\loops.py", line 456, in run_iter self.runner.call_hook( File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\mmengine\runner\runner.py", line 1807, in call_hook getattr(hook, fn_name)(self, kwargs) File "e:\code\mmocr-main\mmocr\engine\hooks\visualization_hook.py", line 118, in after_test_iter img_bytes = fileio.get(img_path, backend_args=self.backend_args) File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\mmengine\fileio\io.py", line 179, in get backend = get_file_backend( File "C:\Users\82307.conda\envs\mmlab\lib\site-packages\mmengine\fileio\io.py", line 137, in get_file_backend raise ValueError( ValueError: uri should not be None when "backend" does not exist in backend_args

Additional information

是否lmdb文件进行测试不能显示结果图片,删去图片显示后测试正常完成了

thangphung215 commented 5 months ago

I have this bug too