Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normal map extraction error #36

Open
attashe opened this issue May 27, 2024 · 1 comment
Open

Normal map extraction error #36

attashe opened this issue May 27, 2024 · 1 comment

Comments

@attashe
Copy link

attashe commented May 27, 2024

I caught mismatch dimension error during normal map extraction

            normal = (normal - normal.min()) / ((normal.max() - normal.min()))  # normal = 1, 1, H, W, C
            normal_list.append(normal)
            ...
            divided = torch.max(divided, dim=3, keepdim=True)[0].repeat(1, 1, 1, 3)  # divided= 4, H, W, C
            divided_list.append(divided)

        normal_out = torch.cat(normal_list, dim=0)   # normal_out = 1, 1, H, W, C
        divided_out = torch.cat(divided_list, dim=0)

For able to save and preview results I suggest:

            normal = (normal - normal.min()) / ((normal.max() - normal.min()))
            normal_list.append(normal.squeeze())  # squeeze all extra dimensions
            ...
            divided = torch.max(divided, dim=3, keepdim=True)[0].repeat(1, 1, 1, 3)
            divided_list.append(divided)

        normal_out = torch.stack(normal_list, dim=0)  # replace cat to stack
        divided_out = torch.cat(divided_list, dim=0)

Workflow attached

iclight_normals_example_01

@kijai
Copy link
Owner

kijai commented May 27, 2024

You may have an old version of the ComfyUI-Video-Matting -nodes, there was a bug in the BRIAAI node giving wrong mask shape, which would also add extra dimension to the normal map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants