You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
In siren_pytorch.py, the coordinate mesh grid is generated by the following codes: tensors = [torch.linspace(-1, 1, steps = image_width), torch.linspace(-1, 1, steps = image_height)] mgrid = torch.stack(torch.meshgrid(*tensors), dim=-1) mgrid = rearrange(mgrid, 'h w c -> (h w) c') self.register_buffer('grid', mgrid)
However, the shape of the mesh grid generated by the first two lines of code is (w, h, c). Thus, the output shape of the following codes should be ((w, h), c) (not ((h, w), c) ): out = self.net(coords, mods)
It would be better to modify the original codes into: tensors = tensors = [torch.linspace(-1, 1, steps = image_height), torch.linspace(-1, 1, steps = image_width)] mgrid = torch.stack(torch.meshgrid(*tensors), dim=-1) mgrid = rearrange(mgrid, 'h w c -> (h w) c') self.register_buffer('grid', mgrid)
Several experiments have been conducted to verify the effectiveness of the modification.
The text was updated successfully, but these errors were encountered:
oh my! i really hope this was the source of a maddening inability to get something to work in my project that uses this!! definitely looks like the culprit! everything worked with square output, but broke and gave poor strange distorted results for anything where w != h ... i spent countless nights trying to find the cause or mistake, but eventually gave it a rest for a while. can't wait to get home and test the update.
Hi,
In siren_pytorch.py, the coordinate mesh grid is generated by the following codes:
tensors = [torch.linspace(-1, 1, steps = image_width), torch.linspace(-1, 1, steps = image_height)]
mgrid = torch.stack(torch.meshgrid(*tensors), dim=-1)
mgrid = rearrange(mgrid, 'h w c -> (h w) c')
self.register_buffer('grid', mgrid)
However, the shape of the mesh grid generated by the first two lines of code is (w, h, c). Thus, the output shape of the following codes should be ((w, h), c) (not ((h, w), c) ):
out = self.net(coords, mods)
It would be better to modify the original codes into:
tensors = tensors = [torch.linspace(-1, 1, steps = image_height), torch.linspace(-1, 1, steps = image_width)]
mgrid = torch.stack(torch.meshgrid(*tensors), dim=-1)
mgrid = rearrange(mgrid, 'h w c -> (h w) c')
self.register_buffer('grid', mgrid)
Several experiments have been conducted to verify the effectiveness of the modification.
The text was updated successfully, but these errors were encountered: