Zhendong-Wang / Patch-Diffusion

Apache License 2.0
70 stars 13 forks source link

Do inputs have to be square? #2

Closed jbmaxwell closed 11 months ago

jbmaxwell commented 11 months ago

I wanted to try this with a custom tensor input, but I've hit the asserts in here, which seem to be requiring inputs to be square:

@property
    def resolution(self):
        assert len(self.image_shape) == 3 # CHW
        assert self.image_shape[1] == self.image_shape[2]
        return self.image_shape[1]

Is this actually a hard requirement?

Zhendong-Wang commented 11 months ago

The dataset.py is inherited from EDM Github, which is designed for preprocessed data in squre format. You can use your own dataset file with custom image size, but make sure the height and width are mutliples of 8, since the Unet will downsample and upsample three times.

jbmaxwell commented 11 months ago

Ah, okay, excellent. I'm subclassing your dataset, so I'll just override resolution and remove the square requirement.

Thanks for the speedy reply!