HighRes-net icon indicating copy to clipboard operation
HighRes-net copied to clipboard

Lanczos code crashes

Open nonick2k23 opened this issue 2 years ago • 3 comments

Hi,

Using PROBA-V dataset, the code crashes in lanczos file with this error:

RuntimeError: Expected 2D (unbatched) or 3D (batched) input to conv1d, but got input of size: [1, 16, 202, 202]

Why insight on what might cause this?

nonick2k23 avatar Feb 12 '23 06:02 nonick2k23

I encountered the same problem. And sadly, there seems to be no pre-trained model provided here.

milder-z avatar Apr 13 '23 15:04 milder-z

Did someone solve the problem?

yunseok624 avatar Jan 19 '24 22:01 yunseok624

I thought that here it was enough to remove the transpose, because it looked like it disturbed the dimensionality, but nevertheless it did nothing :/.

def transform(self, theta, I, device="cpu"):
        '''
        Shifts images I by theta with Lanczos interpolation.
        Args:
            theta : tensor (B, 2), translation params
            I : tensor (B, C_in, H, W), input images
        Returns:
            out: tensor (B, C_in, W, H), shifted images
        '''

        self.theta = theta
        new_I = lanczos.lanczos_shift(img=I.transpose(0, 1), #delate transpose
                                      shift=self.theta.flip(-1),  # (dx, dy) from register_batch -> flip
                                      a=3, p=5)[:, None]
        return new_I

jakubsadel avatar Jan 24 '24 00:01 jakubsadel