You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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
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 ???
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...
The text was updated successfully, but these errors were encountered:
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:
chitecture applications
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
.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)
andval_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)
andval_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...
The text was updated successfully, but these errors were encountered: