Image-Adaptive-3DLUT icon indicating copy to clipboard operation
Image-Adaptive-3DLUT copied to clipboard

Error when batch size > 1

Open hkzhang95 opened this issue 3 years ago • 3 comments

Hi, thanks for your great work.

I try your code on fiveK dataset and find that it can run successfully using the default setting (batch size=1). However, when I switch to a larger batch size (e.g. 2 or 16), an error occurs as follows:

RuntimeError: stack expects each tensor to be equal size, but got [3, 507, 472] at entry 0 and [3, 408, 482] at entry 1

From my previous experience, maybe you need to align the sizes of different images then put them into a tensor.

hkzhang95 avatar Nov 06 '20 08:11 hkzhang95

Hi, you are right. The code by default does not support training with bs>1. For training with bs>1, the input image should be organized to have same resolution. Check lines 69-72 in dataset.py for details. In addition, if you are using the latest version of pytorch, the trilinear interpolation should also be modified in model_x,py which can check the implementation in model.py,

HuiZeng avatar Nov 06 '20 08:11 HuiZeng

Can batch_size > 1 during training get comparable performance with batch_size=1 in your experiment? thanks If batch_size>1 can get similar performance, it can save lot of time

YinengXiong avatar Jan 24 '21 07:01 YinengXiong

Hi, you are right. The code by default does not support training with bs>1. For training with bs>1, the input image should be organized to have same resolution. Check lines 69-72 in dataset.py for details. In addition, if you are using the latest version of pytorch, the trilinear interpolation should also be modified in model_x,py which can check the implementation in model.py,

嗨,你说得对。代码默认不支持 bs>1 的训练。 对于 bs>1 的训练,输入图像应组织为具有相同的分辨率。有关详细信息,请查看 dataset.py 中的第 69-72 行。 另外,如果你使用的是最新版本的pytorch,三线性插值也要在model_x,py中修改,可以在model.py中查看实现,

你好,看到你这里说如果改成bs>1的话,除了需要改dataset.py里的69-72行,model_x.py里还需要改什么地方呀,我没有改model_x.py发现也可以正常跑

meihao5631 avatar Oct 27 '21 11:10 meihao5631