weify627 / 4D-Rotor-Gaussians

Apache License 2.0
79 stars 5 forks source link

about permute #7

Closed twblaotang closed 1 week ago

twblaotang commented 2 months ago

Hi, thanks for your excellent work.

in file https://github.com/weify627/4D-Rotor-Gaussians/blob/main/nerfstudio/models/splatfacto.py line:1231

out = {"rgb": self.render['render'].permute(0,3,2,1), 'depth':self.render["depth"].permute(0,3,2,1), "accumulation": self.render['alpha'].permute(0,3,2,1), "background": background}

when i use my own data that ascpect ratio is not 1:1, for example 480*270. after permute, shape(3,3,270,480) converts to shape(3,480,270,3), which is different to grount truth and make coredump in get_loss().

Klylee commented 1 month ago

hello, I find that this problem stems from the code in " nerfstudio/data/datasets/base_dataset.py: def get_numpy_image() line: 85 " numpy will read image and store the image in the sort [H*W*C], but the renderer will render the image and store it in sort [W*H*C]. So, when width does not equal to height, errors would occur.

You can solve this problem by doing this change in line: 85: image = np.array(pil_image, dtype="uint.8").transpose([1, 0, 2])