# 🚀 Hướng Dẫn Thiết Lập & Chạy Gaussian Splatting (Full Pipeline Tự Động Qua SSH)
—
## 🧩 1. Yêu cầu hệ thống
### 💻 Desktop GPU (dùng để chạy COLMAP + train)
– **Ubuntu 22.04+**
– **GPU NVIDIA có CUDA ≥ 11.8**
– Driver NVIDIA đã cài (`nvidia-smi` hoạt động)
– Python ≥ 3.10
– Đã cài các package build:
“`bash
sudo apt install build-essential cmake git ffmpeg libglew-dev libboost-all-dev libopencv-dev
Đã cài COLMAP (bản mới, hỗ trợ CUDA):
sudo apt install colmap
Đã cài CUDA Toolkit 11.8:
nvcc –version
🧱 2. Clone & Thiết lập môi trường
git clone –recursive https://github.com/graphdeco-inria/gaussian-splatting.git
cd gaussian-splatting
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip wheel setuptools
🧠 Cài các thư viện Python chính:
pip install torch torchvision torchaudio –index-url https://download.pytorch.org/whl/cu118
pip install plyfile tqdm matplotlib tensorboard scikit-image
⚙️ 3. Build các submodules CUDA
cd submodules/diff-gaussian-rasterization
pip install .
cd ../simple-knn
pip install .
✅ Nếu lỗi No module named ‘torch’ → chạy:
source ~/DISK_3D/gaussian-splatting/.venv/bin/activate
python -c “import torch; print(torch.__version__, torch.cuda.is_available())”
Nếu báo True là OK rồi build lại.
🎬 4. Chuẩn bị pipeline tự động
-
Copy file Python auto_pipeline.py (đã có sẵn trong repo bạn).
-
File này sẽ:
-
Tải video demo.
-
Tách ảnh.
-
Sinh script COLMAP tự động (colmap_auto.sh).
-
Gửi lệnh chờ desktop xử lý.
-
Khi desktop xử lý xong → tự train Gaussian Splatting.
-
🧠 5. Chạy pipeline
Trên máy chính (SSH hoặc server):
python auto_pipeline.py
Khi log in ra dòng:
📂 ĐÃ TẠO FILE CHỜ: ~/DISK_3D/gaussian-splatting/data/bicycle/colmap_auto.sh
💡 Trên desktop GPU, chạy:
bash ~/DISK_3D/gaussian-splatting/colmap_watcher.sh
→ sang máy desktop GPU chạy:
bash ~/DISK_3D/gaussian-splatting/colmap_watcher.sh
Sau khi COLMAP hoàn tất undistort, pipeline sẽ tự động train.
🔍 6. Cấu trúc thư mục đầu ra
gaussian-splatting/
├── data/
│ └── bicycle/
│ ├── images/ ← ảnh trích từ video
│ ├── sparse/0/ ← kết quả COLMAP thô
│ ├── undistorted/
│ │ ├── images/ ← ảnh sau khi hiệu chỉnh méo
│ │ └── sparse/0/ ← camera.bin, images.bin, points3D.bin
│ ├── colmap_auto.sh ← script auto sinh
│ └── colmap_run.log ← log chi tiết
└── output/
└── bicycle/ ← mô hình Gaussian Splatting huấn luyện xong
🧰 7. Xem kết quả
Sau khi train hoàn tất:
python render.py -m output/<model_folder>
Hoặc dùng real-time viewer (nếu đã build SIBR):
./SIBR_viewers/build/bin/SIBR_gaussianViewer_app -m ./output/<model_folder>
⚡ 8. Ghi chú & tối ưu
Tùy chọn
Tác dụng
–densify_until_iter
Giới hạn số bước densify (giảm VRAM)
–densify_grad_threshold
Giảm ngưỡng -> densify mạnh hơn (tăng tốc train)
–exposure_lr_init / –antialiasing
Bật bù sáng, khử răng cưa
–optimizer_type sparse_adam
Tăng tốc train gấp 2–3 lần
–train_test_exp
Huấn luyện có kiểm tra phơi sáng
💡 Lưu ý quan trọng
-
Gaussian Splatting chỉ đọc định dạng .bin trong undistorted/sparse/0/
→ không cần .txt (chỉ dùng cho debug COLMAP). -
Nếu thấy AssertionError: only PINHOLE/SIMPLE_PINHOLE supported
→ phải chắc chắn chạy qua bước colmap image_undistorter. -
Lúc mới train, VRAM chỉ ~800MB là bình thường, sẽ tăng dần khi densify.
-
Tốc độ trung bình: 25–40 iteration/giây, toàn bộ train khoảng 15–25 phút.
✅ Kết luận
Một khi pipeline chạy mượt và có folder undistorted/sparse/0/*.bin, bạn đã có thể train và render cảnh 3D Gaussian hoàn chỉnh.
Chúc bạn có một pipeline Gaussian Splatting tự động – ổn định – tốc độ cao 🧠⚡