graphdeco-inria / gaussian-splatting

Original reference implementation of "3D Gaussian Splatting for Real-Time Radiance Field Rendering"
https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/
Other
14.77k stars 1.93k forks source link

About visualiazation with SIBR viewers. How does it generate the 3d model. What files are important in the process. #869

Open CPuwell opened 5 months ago

CPuwell commented 5 months ago

I use 3dgs to train a model and got a .pth file. Then, I convert it into .ply file. But I did not have the cfg_args file and the colmap. I want to know how to generate these files and what usage do they have. I know when using SIBR, the viewer need files like: image

But my model is like(the cfg_args is copied from the files in the former picture, but it still work and I got the 3d model in viewer): image image The point_cloud.ply is the output file of my model. The script I write to generate .ply file is:

import argparse
import torch
from scene.gaussian_model import GaussianModel

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--model-path', '-m', required=True, help='Path to the pretrained model')
    parser.add_argument('--ply-path', '-p', required=True, help='Path to save the PLY file')
    args = parser.parse_args()

    # 创建模型实例
    model = GaussianModel(sh_degree=3, use_img_feats=True)

    # 加载预训练模型参数
    pretrained_params = torch.load(args.model_path)
    model.set_params(pretrained_params)

    # 保存为PLY文件
    model.save_ply(args.ply_path)

if __name__ == '__main__':
    main()

I copied the cfg_args file to the model I got. And the model I got do not have a source file written in the cfg_args file(which point to a colmap file). Although it do not have all files in the former model(which in the 0000 folder) but I still got the 3d model by applying SIBR viewer which is different from the 3d model of the former one. I am confused that whether the source file matter? And which files are important in the former folder. cfg_args: image

jaco001 commented 5 months ago

Those files are important only for SIBRviewer. It need them for initialization. In the practice if you provide anything valid (even with wrong cameras), it will start, and you probably only need to find your target.

CPuwell commented 5 months ago

Those files are important only for SIBRviewer. It need them for initialization. In the practice if you provide anything valid (even with wrong cameras), it will start, and you probably only need to find your target.

Much appreciate!! I found that the cfg_args file may decide what camera SIBR use to build a 3d model. For example, I copied the local model from 00000 and use the global model to replace the point cloud folder like this: image Then I use SIBR to build a model and it tells me it uses 137 cameras and 137 images: image Also, it mentioned that it used the Colmap file which corresponds to the colmap of local model 00000. It generates a model: 5dfdea1bc619f25fe7397a23b2a02346 Then I use SIBR to build the real 00000 local model image and got: image 36e144821de9b1fcd1ffb7175bc89892 Both of them use the same number of camera so I guess the cameras might be the same. And the COLMAP file they applied are the same too. But the 3d model in SIBR is a little bit different (probably be affect by the model). So I guess maybe I should generate a COLMAP file for the Global model itself? Otherwise I can not get the full, real 3d model of Global Model?