chengtan9907 / OpenSTL

OpenSTL: A Comprehensive Benchmark of Spatio-Temporal Predictive Learning
https://openstl.readthedocs.io/en/latest/
Apache License 2.0
730 stars 113 forks source link

RuntimeError: The size of tensor a (60) must match the size of tensor b (59) at non-singleton dimension 3 #140

Closed daemonkillerr closed 2 months ago

daemonkillerr commented 4 months ago

I have a custom dataset of 59x59 images and I face this error. Kindly help.

File openstl\openstl\models\simvp_model.py:95, in Decoder.forward(self, hid, enc1) 93 for i in range(0, len(self.dec)-1): 94 hid = self.deci ---> 95 Y = self.dec[-1](hid + enc1) 96 Y = self.readout(Y) 97 return Y

RuntimeError: The size of tensor a (60) must match the size of tensor b (59) at non-singleton dimension 3

Thanks

chengtan9907 commented 2 months ago

In SimVP, the image is downsampled and then upsampled back to its original size. However, 59x59 images cannot be upsampled back to the same dimensions. To address this, I suggest padding your image to 60x60 at the beginning of the forward function and removing the padding at the end of the forward function.

chengtan9907 commented 2 months ago

I will close this issue if there are no more questions. Please feel free to open a new issue when you have new questions.