Closed SirNate0 closed 6 months ago
While not seamless, if I turn off "BOOST (multi-resolution merging)" and turn on "Match net size to input size", the result does not have the broad sloping depth to the corner.
To actually make it seamless, it's possible to use the same approach as sd_hijack.py and simply force all the Conv2d layers to have the circular padding mode. E.g. adding this to load_models()
in depthmap_generation.py, though I've only tested it on the res101 model (and it failed with BOOST enabled - probably have to make the same adjustment to the BOOST model, though it might be more complicated since I think it is breaking the image into different patches...)
def apply_circular(enable):
def flatten(el):
flattened = [flatten(children) for children in el.children()]
res = [el]
for c in flattened:
res += c
return res
layers = flatten(model)
for layer in [layer for layer in layers if type(layer) == torch.nn.Conv2d]:
layer.padding_mode = 'circular' if enable else 'zeros'
apply_circular(True)
Wow, this is impressive! I didn't even think of that, it indeed works without finetuning! A niche but very cool and creative usecase. I am adding this now.
I wrote code that adds a new checkbox for the tiling mode, but my results are somewhat lacking...
Ok, this feature has just hit the main branch. It still has some seams... It would be awesome if you could take a look (investigate 😄) and identify the reason...
@SirNate0
Is it possible to have the script honor the Tiling setting for the image? The image itself seems to tile very nicely. However, the depth image has a distinct curve to it that does not tile. Using a high-pass filter after the fact mostly fixes it, but it is not perfect, leaving a slight seam.
With high-pass filter (and offset by 1/2 to show the seam)