[go: nahoru, domu]

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

Fix for triplane projection #67

Closed
MrTornado24 opened this issue Sep 17, 2022 · 7 comments
Closed

Fix for triplane projection #67

MrTornado24 opened this issue Sep 17, 2022 · 7 comments

Comments

@MrTornado24
Copy link

Hi, thanks for releasing the code! I found that according to projection matrixes, the order of triplanes is (x, y), (x, z) and (z, x) rather than three orthogonal planes. Am I thinking something wrong or this is exactly your design?

@matthew-a-chan
Copy link
Collaborator

Thanks for bringing this to our attention! This is an interesting one. We certainly intended for it to be the three orthogonal projections as you suggest, but a quick review over our code history shows that it's been this way forever... and also that all of our results were achieved using the buggy XY, XZ, ZX planes. For the sake of exact reproducibility I will leave as is for now, though this decision may change later. In your own implementations you should certainly change the projections to be accurate, which will likely improve results.

Here's the required fix:

Modify:

def generate_planes():
"""
Defines planes by the three vectors that form the "axes" of the
plane. Should work with arbitrary number of planes and planes of
arbitrary orientation.
"""
return torch.tensor([[[1, 0, 0],
[0, 1, 0],
[0, 0, 1]],
[[1, 0, 0],
[0, 0, 1],
[0, 1, 0]],
[[0, 0, 1],
[1, 0, 0],
[0, 1, 0]]], dtype=torch.float32)

to match:

def generate_planes():
    """
    Defines planes by the three vectors that form the "axes" of the
    plane. Should work with arbitrary number of planes and planes of
    arbitrary orientation.
    """
    return torch.tensor([[[1, 0, 0],
                            [0, 1, 0],
                            [0, 0, 1]],
                            [[1, 0, 0],
                            [0, 0, 1],
                            [0, 1, 0]],
                            [[0, 0, 1],
                            [0, 1, 0],
                            [1, 0, 0]]], dtype=torch.float32)

Which should accurately accomplish the XY, XZ, ZY projections that we want.
Note that only the last 2 lines change!

@matthew-a-chan matthew-a-chan pinned this issue Sep 19, 2022
@matthew-a-chan matthew-a-chan changed the title The order of triplanes Fix for triplane projection bug Sep 19, 2022
This was referenced Sep 19, 2022
@matthew-a-chan matthew-a-chan changed the title Fix for triplane projection bug Fix for triplane projection Sep 20, 2022
@thuanz123
Copy link

hi @matthew-a-chan @MrTornado24 , if I want to use XY, YZ, ZX projections then is the below code correct ?

def generate_planes():
    """
    Defines planes by the three vectors that form the "axes" of the
    plane. Should work with arbitrary number of planes and planes of
    arbitrary orientation.
    """
    return torch.tensor([[[1, 0, 0],
                            [0, 1, 0],
                            [0, 0, 1]],
                            [[0, 1, 0],
                            [0, 0, 1],
                            [1, 0, 0]],
                            [[0, 0, 1],
                            [1, 0, 0],
                            [0, 1, 0]]], dtype=torch.float32)

@matthew-a-chan
Copy link
Collaborator

Hi, Yes. That is the original code, so it will be the original XY YZ ZX projections. Also, no need to @. We read the issues :)

@ty625911724
Copy link

Dear authors:

It seems that the projection code is with bug, so the pretrained models are also not accurate inplemention for 3 planes.

Do you plan to release new pretrained model trained with correct projection matrixes?

Thanks!

@ericryanchan
Copy link
Contributor

We haven't yet had time to retrain and thoroughly test with the triplane fix, but I pushed the fix to a branch called fixed_triplanes and uploaded a preliminary model here, which we finetuned from one of the original checkpoints: https://drive.google.com/drive/folders/1F77Sh2JS-udVsOkARk2h5t6ShN213p6c?usp=sharing

We'll try to revisit this and train additional models in a few weeks!

@ty625911724
Copy link

Thanks a lot for your kind comments and sharing weights. Looking forward to the new models! ///(^v^)\\

@oneThousand1000
Copy link

Hi there! I re-trained the correct-triplane model for research purposes :), you can find it here and download the ffhq-fixed-triplane512-128.pkl.

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

6 participants