mmocr: AssertionError while training KIE Model

Bug Description AssertionError

Reproduction I have a custom dataset with 4 classes and it has the same structure as in wildreceipts/. I ran the script for training that is when the AssertionError occurred.

./tools/dist_train.sh configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt_modified.py work_dirs/sdmgr 1

I made a few modifications in the config file configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt_modified.py. Since, my new dataset has only 4 classes I have modified the following lines accordingly: Line 63 & Line 69

I used the same images as in wildreceipt/ and modified the following files to align with my requirement of only 4 classes:

class_list.txt
test.txt
train.txt

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:

  • GCC 7.3
  • C++ Version: 201402
  • Intel® Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel® 64 architecture applications
  • Intel® MKL-DNN v0.21.1 (Git Hash 7d2fd500bc78936d1d648ca713b901012f470dbc)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 10.1
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
  • CuDNN 7.6.3
  • Magma 2.5.2
  • Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_INTERNAL_THREADPOOL_IMPL -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,

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

Traceback (most recent call last):
  File "./tools/train.py", line 205, in <module>
    main()
  File "./tools/train.py", line 201, in main
    meta=meta)
  File "/home/ubuntu/Desktop/mmocr/mmocr/mmocr/apis/train.py", line 149, in train_detector
    runner.run(data_loaders, cfg.workflow)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 125, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 54, in train
    self.call_hook('after_train_epoch')
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 307, in call_hook
    getattr(hook, fn_name)(self)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmdet/core/evaluation/eval_hooks.py", line 143, in after_train_epoch
    key_score = self.evaluate(runner, results)
  File "/home/ubuntu/anaconda3/envs/mmocr/lib/python3.7/site-packages/mmdet/core/evaluation/eval_hooks.py", line 162, in evaluate
    results, logger=runner.logger, **self.eval_kwargs)
  File "/home/ubuntu/Desktop/mmocr/mmocr/mmocr/datasets/kie_dataset.py", line 142, in evaluate
    assert set(kwargs).issubset(['logger'])
AssertionError

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Hi, please try

  • mmcv == 1.3.4 (full version)
  • mmdet == 2.11.0 (not 2.12!)
  • mmocr latest master

If the bug still occurs, please give feedback, thanks!

The bug appears to be resolved in the latest versions. I trained the model (kie/sdmgr) on a custom dataset and I can confirm that there aren’t any issues now.

I will take a look at the later error later

~~We need higher version of mmdet, see https://github.com/open-mmlab/mmocr/blob/main/docs/install.md#prerequisites~~

Sorry wrong comment. I think 2.9.0 should (might) be ok