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

A way to use the 3dgs Viewer #51

Open
m1ingshen opened this issue May 29, 2024 · 3 comments
Open

A way to use the 3dgs Viewer #51

m1ingshen opened this issue May 29, 2024 · 3 comments

Comments

@m1ingshen
Copy link

I made some minor modifications to your code so that it can be used with the viewer provided by 3DGS. Here's my approach:

  1. change the codes in function construct_list_of_attributes from scene/gaussian_model.py like this:
l = ['x', 'y', 'z', 'nx', 'ny', 'nz']
        # All channels except the 3 DC
        for i in range(self._features_dc.shape[1]*self._features_dc.shape[2]):
            l.append('f_dc_{}'.format(i))
        for i in range(self._features_rest.shape[1]*self._features_rest.shape[2]):
            l.append('f_rest_{}'.format(i))
        l.append('opacity')
        for i in range(self._scaling.shape[1] + 1):
            l.append('scale_{}'.format(i))
        ......

By this way, the scales can have 3 dim, the same as 3dgs.
2. change the codes in fuction save_ply from scene/gaussian_model.py like this:

mkdir_p(os.path.dirname(path))

        xyz = self._xyz.detach().cpu().numpy()
        normals = np.zeros_like(xyz)
        f_dc = self._features_dc.detach().transpose(1, 2).flatten(start_dim=1).contiguous().cpu().numpy()
        f_rest = self._features_rest.detach().transpose(1, 2).flatten(start_dim=1).contiguous().cpu().numpy()
        opacities = self._opacity.detach().cpu().numpy()
        scale = self._scaling.detach().cpu().numpy()
        rotation = self._rotation.detach().cpu().numpy()
        one_line = np.full((scale.shape[0],1), 0.0000000001)
        one_line = np.log(one_line)
        scale = np.concatenate((scale, one_line), axis=1)
        ......

By this way, the 2D gaussian is changed into 3D gaussian with a zeros_like dimension.

@hbb1
Copy link
Owner

hbb1 commented May 29, 2024

Yes, have you observed severe perspective-distortion artifacts? Can you post some results here? By the way, we have made progress in creating a viewer.

@m1ingshen
Copy link
Author

These are two examples of garden training 7_000 iterations
image
image
I have only tested a few of models, maybe there are some distortions I haven't met.

@hbb1
Copy link
Owner

hbb1 commented May 29, 2024

Thank you for reporting the results! As I mentioned in the README, this is a possible but not perfect solution. Also, the additional scale will cause ambiguities. Therefore, I think it is better to keep the current Gaussian Model. Let's keep the issue open for who would like a quick visualizer. Or let me refer people to your fork if you have.

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