Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] RuntimeError: Calculated padded input size per channel: (1 x 70). Kernel size: (2 x 2). Kernel size can't be greater than actual input size #1934

Open
2 tasks done
fat-921 opened this issue Jun 20, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@fat-921
Copy link

fat-921 commented Jun 20, 2023

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

sys.platform: win32
Python: 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0: NVIDIA GeForce RTX 3060 Ti
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3
NVCC: Cuda compilation tools, release 11.3, V11.3.58
MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版
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 ar
    chitecture 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,c
    ode=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,cod
    e=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:experimen
    tal -IC:/actions-runner/_work/pytorch/pytorch/builder/windows/mkl/include -DNDEBUG -DUSE_KI
    NETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDG
    E_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, U
    SE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPE
    NMP=ON, USE_ROCM=OFF,

TorchVision: 0.12.0+cu113
OpenCV: 4.6.0
MMEngine: 0.7.1
MMOCR: 1.0.0+

Reproduces the problem - code sample

when i run python tools/train.py configs/textrecog/crnn/crnn_mini-vgg_5e_toy.py with my self-datasets,
I set train_dataloader = dict(batch_size=4, num_workers=2) and val_dataloader = dict(batch_size=4,num_workers=2)
or I set batch_size <= 16,similar problems occur;but set batch_size >16 or more,it becomes normal.
How is it that I want to train with a small batch size ???

Reproduces the problem - command or script

python tools/train.py configs/textrecog/crnn/crnn_mini-vgg_5e_toy.py
train_dataloader = dict(batch_size=4, num_workers=2) and val_dataloader = dict(batch_size=4,num_workers=2)

Reproduces the problem - error message

Traceback (most recent call last):
File "D:\software\Anaconda3\envs\openmmlab\lib\contextlib.py", line 131, in exit
self.gen.throw(type, value, traceback)
File "D:\mmengine\optim\optimizer\optimizer_wrapper.py", line 351, in optim_context
yield
File "D:\mmengine\model\base_model\base_model.py", line 114, in train_step
losses = self._run_forward(data, mode='loss') # type: ignore
File "D:\mmengine\model\base_model\base_model.py", line 326, in _run_forward
results = self(**data, mode=mode)
File "D:\software\Anaconda3\envs\openmmlab\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "D:\mmocr\models\textrecog\recognizers\base.py", line 88, in forward
return self.loss(inputs, data_samples, **kwargs)
File "D:\software\Anaconda3\envs\openmmlab\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "D:\software\Anaconda3\envs\openmmlab\lib\site-packages\torch\nn\modules\container.py", line 141, in forward
input = module(input)
File "D:\software\Anaconda3\envs\openmmlab\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "D:\software\Anaconda3\envs\openmmlab\lib\site-packages\torch\nn\modules\conv.py", line 447, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\software\Anaconda3\envs\openmmlab\lib\site-packages\torch\nn\modules\conv.py", line 443, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Calculated padded input size per channel: (1 x 70). Kernel size: (2 x 2). Kernel size can't be greater than actual input size

Additional information

How to solve this problem?? I want to use a small batch_size...

@fat-921 fat-921 added the bug Something isn't working label Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants