tjm35 / asymmetric-tiling-sd-webui

Asymmetric Tiling for stable-diffusion-webui
Creative Commons Zero v1.0 Universal
196 stars 35 forks source link

other paddings ? #2

Closed Ehplodor closed 1 year ago

Ehplodor commented 1 year ago

Hi, thank you for the asymmetric tiling script, very good results !

I was wondering about what do other type of padding do ? those defined in https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/conv.py i.e. reflect and replicate ? Are they useless ?

Ehplodor commented 1 year ago

Also, would it be possible to define tiling for cartographic projection ? with "north/south pole"-like tiling

tjm35 commented 1 year ago

Essentially each padding type describes how the generation treats the areas "outside" the image.

The default behaviour is "constant" (which I believe matches 'replicate' in that file, where each pixel outside the image is treated as having the same contents as the nearest edge pixel). 'reflect' behaviour is similar, but instead of each outside pixel being equal to the edge pixel, pixels further outside the image match pixels further inside the image, so the outside reflects the contents of the inside. 'zeroes' behaviour treats everything outside the image as black. 'circular' behaviour is what we use for tiling; each pixel outside the image is treated as having the same contents as the corresponding pixel from the opposite side of the image, so the outside wraps around the image contents.

I haven't really seen any uses for the other padding types; in general they will only change the behaviour of the image at edges, not the overall shape. In principle to some extent controlling the padding can let you match the edges of a generated image to existing content, but inpainting already does that in a much more general way.

For non-euclidean projections, unfortunately I don't see a natural way to implement them in SD's current system. It's easy to achieve the east-west tiling, but there's no way to enforce the mapping coming to a point at the top or bottom.

One thing that might be possible in SD's current system is to generate the six faces of a cube map simultaneously, padding each side with the contents of the four adjacent sides? But that would be a very complex task, definitely outside the scope of a simple tiling script like this one,

Thanks.