"...git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "6c6f88b9d0ed5c4e16787e687feee946c36f5fcd"
Unverified Commit 1c8ae9db authored by Jukka Seppänen's avatar Jukka Seppänen Committed by GitHub
Browse files

Allow GrowMask node to work with batches (for AnimateDiff) (#1623)

* Allow mask batches

This allows LatentCompositeMasked -node to work with AnimateDiff. I tried to keep old functionality too, unsure if it's correct, but both single mask and batch of masks seems to work with this change.

* Update nodes_mask.py
parent 66756de1
......@@ -331,15 +331,14 @@ class GrowMask:
out = []
for m in mask:
output = m.numpy()
while expand < 0:
output = scipy.ndimage.grey_erosion(output, footprint=kernel)
expand += 1
while expand > 0:
output = scipy.ndimage.grey_dilation(output, footprint=kernel)
expand -= 1
for _ in range(abs(expand)):
if expand < 0:
output = scipy.ndimage.grey_erosion(output, footprint=kernel)
else:
output = scipy.ndimage.grey_dilation(output, footprint=kernel)
output = torch.from_numpy(output)
out.append(output)
return (torch.cat(out, dim=0),)
return (torch.stack(out, dim=0),)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment