首先使用以下程式來連接到實驗室主機

  • PuTTY (操作用)
    • Username: divc
    • Password: divc5047
  • WinSCP (檔案傳輸用)

# 檔案結構

/home/divc/411021229/
├── 3DGS_output/
│   └── {name}/
│       ├── point_cloud/iteration_7000/
│       │   └── point_cloud.ply
│       ├── cameras.json
│       ├── cfg_args
│       └── input.ply
├── 3DGS_source/
│   └── {name}/
│       ├── images/
│       │   ├── img0.jpg
│       │   ├── ...
│       │   └── img{n}.jpg
│       └── sparse/0/
│           ├── cameras.bin
│           ├── images.bin
│           ├── points3D.bin
│           └── points3D.ply
├── data/
│   └── {name}/input/
│       ├── img0.jpg
│       ├── ...
│       └── img{n}.jpg
├── SuGaR/
│   ├── ...
│   ├── gaussian_splatting/
│   │   └── train.py
│   ├── ...
│   ├── output/
│   │   ├── ...
│   │   ├── refined_mesh/test_data/
│   │   │   ├── *.mtl
│   │   │   ├── *.obj
│   │   │   └── *.png
│   │   └── refined_ply/test_data/
│   │       └── *.ply
│   ├── ...
│   └── train.py
├── test_data
└── test_output

# Convert

因為 SuGaR 要吃經過 3DGS convert 後的結果,所以如果未 convert,則需要先 convert。

Convert 完成後的檔案結構:

├── sparse
│   └── 0
│       ├── cameras.bin
│       ├── images.bin
│       ├── points3D.bin
│       └── points3D.ply (沒有此檔案沒差,因為之後train下去也會產生)
└── images

# 複製照片進去容器

要先啟動容器,創好 {資料夾名稱}資料夾 (IMPORTANT!)
創好後要退出容器才可以複製照片進去。

cd /workspace/gaussian-splatting/data/
mkdir {資料夾名稱}
cd {資料夾名稱}
mkdir input
cd ../

規則

sudo docker cp /home/divc/411021229/data/{資料夾名稱}/input {容器名稱}:/workspace/gaussian-splatting/data/{資料夾名稱}

例子

exit
sudo docker cp /home/divc/411021229/data/turing/input wizardly_mclean:/workspace/gaussian-splatting/data/turing

# 啟動容器

規則

sudo docker ps REM 查看已經啟動的容器
sudo docker start {容器名稱}
sudo docker attach {容器名稱}

例子

sudo docker ps
sudo docker start wizardly_mclean
sudo docker attach wizardly_mclean

# 開始 convert

規則

cd gaussian-splatting
python convert.py -s /workspace/gaussian-splatting/data/{資料夾名稱}

# 把 convert 後的結果拿出容器

規則

exit
sudo docker cp {容器名稱}:/workspace/gaussian-splatting/data/{資料夾名稱}/images /home/divc/411021229/3DGS_source/{資料夾名稱}/images
sudo docker cp {容器名稱}:/workspace/gaussian-splatting/data/{資料夾名稱}/sparse /home/divc/411021229/3DGS_source/{資料夾名稱}/sparse

例子

exit
sudo docker cp wizardly_mclean:/workspace/gaussian-splatting/data/turing/images /home/divc/411021229/3DGS_source/turing/images
sudo docker cp wizardly_mclean:/workspace/gaussian-splatting/data/turing/sparse /home/divc/411021229/3DGS_source/turing/sparse

# Train into mesh

# Copy 到 test_data

把 convert 的結果 copy 到輸入資料夾,以下是 test_data 要有的檔案結構。

test_data
├── sparse
│   └── 0
│       ├── cameras.bin
│       ├── images.bin
│       ├── points3D.bin
│       └── points3D.ply (沒有此檔案沒差,因為之後train下去也會產生)
└── images

規則

cd 411021229/test_data
cp -r ../3DGS_source/{資料夾名稱}/* ./

# SuGaR 最佳化:優化高斯與場景表面的對齊 [1/2]

在此步驟會開啟一個事先建立好的 python 虛擬環境 su

cd ../SuGaR
conda activate su
python gaussian_splatting/train.py -s ../test_data --iterations 7000 -m ../test_output

# 其餘步驟 [2/2]

請根據需求選擇下面兩個的其中一個執行,經過漫長的執行後,即可使用 conda deactivate 來退出虛擬環境。

# density

重建以 360° 覆蓋場景為中心的詳細對象, density 提供了更好的前景網格。

python train.py -s ../test_data/ -c ../test_output/ -r "density"

# sdf

實現更強的正規化以及前景和背景之間更好的平衡。

python train.py -s ../test_data/ -c ../test_output/ -r "sdf"

# 資料歸檔

結束後請把 convert 和 train 的資料移動到 3DGS_source3DGS_output 內歸檔。

先把原本的檔案刪掉

cd ../3DGS_source/{資料夾名稱}
sudo rm -r ./*

再移動檔案

要先創好在 3DGS_output 中,名為 {資料夾名稱}資料夾 (IMPORTANT!)

cd ../../test_data
mv ./* ../3DGS_source/{資料夾名稱}
cd ../test_output
mv ./* ../3DGS_output/{資料夾名稱}

# 結果展示

訓練結束後,我們只需要以下兩種檔案。

# 經過 SuGaR 最佳化後的優化 ply

../SuGaR/output/refined_ply/test_data/*.ply

# 場景的 mesh 表示

../SuGaR/output/refined_mesh/test_data/
├── *.mtl
├── *.obj
└── *.png

這些檔案通常是用於描述和定義 3D 模型的外觀和材質:

  1. MTL 檔案 (.mtl):這是一個材質檔案,用於描述 3D 模型中的材質屬性,如顏色、反射率、透明度等。MTL 檔案通常與 OBJ 檔案一起使用,並且包含 OBJ 檔案中引用的材質信息。

  2. OBJ 檔案 (.obj):這是一個包含 3D 模型幾何結構和材質參考的檔案格式。它可以包含模型的頂點位置、法向量、材質 UV 映射坐標等信息。OBJ 檔案是一個通用的三維模型檔案格式,可以被許多 3D 建模軟件和引擎支援。

  3. PNG 檔案 (.png):這是一個圖像檔案格式,通常用於儲存 3D 模型的貼圖或材質映射。PNG 檔案可以包含透明度和 RGB 顏色信息,常用於為 3D 模型添加表面紋理和圖案。

— from ChatGPT


# References