mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

_batch_inputs = data['inputs'] KeyError: 'inputs' error while training

Open Harshitha-narayan opened this issue 1 year ago • 10 comments

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version. Screenshot 2023-06-12 112727

Describe the bug I have written custom model on training mmdetection model. When I try training the model on custom data, I'm getting this error. _batch_inputs = data['inputs'] KeyError: 'inputs'

Reproduction

  1. What command or script did you run? python tools/train.py configs/custom_table.py
A placeholder for the command.
  1. Did you make any modifications on the code or config? Did you understand what you have modified?
  2. What dataset did you use? Custom dataset

Environment

  1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here. sys.platform: win32 Python: 3.8.16 (default, Mar 2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] CUDA available: True numpy_random_seed: 2147483648 GPU 0: GeForce RTX 2070 CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2 NVCC: Cuda compilation tools, release 11.2, V11.2.67 MSVC: Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32532 for x64 GCC: n/a PyTorch: 1.11.0+cu113 PyTorch compiling details: PyTorch built with:
  • C++ Version: 199711
  • MSVC 192829337
  • Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
  • OpenMP 2019
  • LAPACK is enabled (usually provided by MKL)
  • CPU capability usage: AVX2
  • CUDA Runtime 11.3
  • 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_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
  • CuDNN 8.2
  • Magma 2.5.4
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/actions-runner/_work/pytorch/pytorch/builder/windows/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.11.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,

TorchVision: 0.12.0+cu113 OpenCV: 4.7.0 MMEngine: 0.7.4 MMDetection: 3.0.0+ecac3a7 3. You may add addition that may be helpful for locating the problem, such as

  • How you installed PyTorch [e.g., pip, conda, source]
  • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback If applicable, paste the error trackback here.

A placeholder for trackback.

Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

Harshitha-narayan avatar Jun 12 '23 06:06 Harshitha-narayan

the same problem,how to solve it?

codemaster17611 avatar Jul 06 '23 01:07 codemaster17611

I have the same problem too. Waiting for some help in this thread.

EDIT: I tried reading the python files, and it has something to do with the 'inputs' key. I think this has something to do with loading the input data.

My dataset structure is:

> dataset
>  |
>  | coco
> 
>     |
>     | train
>         | 1.jpg
>            ........
>            train.json
>       test
>         | 1***.jpg
>            ........
>            test.json
>       val
>         | 1****.jpg
>            ........
>            val.json

Any insight would be very much appreciated

edehino avatar Jul 18 '23 05:07 edehino

Maybe your data_loader error, you can check weather it in clude pipeline=train_pipeline, in dataset

SunZzzzzzzz avatar Aug 30 '23 07:08 SunZzzzzzzz

Maybe your data_loader error, you can check weather it in clude pipeline=train_pipeline, in dataset thanks so much, that key for me to solve stuck

leduy-it avatar Oct 06 '23 12:10 leduy-it

same problem

shiyongde avatar Dec 16 '23 15:12 shiyongde

same error. and I add test_mode=True, pipeline=test_pipeline, backend_args=backend_args in dataset of test_dataloader, then solved it.

zhanghay avatar Jan 25 '24 03:01 zhanghay

add 'LoadFromFile' to your conifg

BARBERUM avatar Jan 25 '24 07:01 BARBERUM

相应的配置模型配置文件出错了,可以重新生成模型配置文件 我在运行test.py出现这个错误, 修改test对应得pipeline解决 pipeline修改前 pipeline=[ dict(backend_args=None, type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), ],

 pipeline修改后
    修改后
            pipeline=[
        dict(backend_args=None, type='LoadImageFromFile'),
        dict(keep_ratio=True, scale=(
            800,
            500,
        ), type='Resize'),
        dict(type='LoadAnnotations', with_bbox=True),
        dict(
            meta_keys=(
                'img_id',
                'img_path',
                'ori_shape',
                'img_shape',
                'scale_factor',
            ),
            type='PackDetInputs'),
    ],

wlpun avatar Mar 16 '24 06:03 wlpun

pipeline add dict(type="PackInputs") and save this error

ZhaiShaoww avatar Apr 24 '24 01:04 ZhaiShaoww