Priceless
360 Gaussian Splatting with PAIR360 dataset 본문
360 Gaussian Splatting
github
https://github.com/inuex35/360-gaussian-splatting
GitHub - inuex35/360-gaussian-splatting: This repository contains programs for reconstructing 3D space using OpenSfM and Gaussia
This repository contains programs for reconstructing 3D space using OpenSfM and Gaussian Splatting techniques. It allows users to generate point clouds from images captured by a 360-degree camera u...
github.com
360도 카메라로 촬영한 image sequence를 통해
Gaussian Splatting으로 렌더링하는 모델이다
기존의 Gaussian Splatting의 경우
본인보다 다른 분들이 정리를 잘 해놓으셔서
다른 분들의 자료를 참고하면 좋을 듯하다
[논문 리뷰] 3D Gaussian Splatting (SIGGRAPH 2023) : 랜더링 속도/퀄리티 개선
3D Gaussian Splatting for Real-Time Radiance Field Rendering, Bernhard Kerbl, SIGGRAPH 2023 NeRF분야에서 뜨거운 이슈가 된 논문입니다. NeRF에서 해결하고자 하는 Task와 동일하게, 여러 이미지와 촬영 pose 값이 주어지
xoft.tistory.com
구현
360 GS repo를 가져온다
git clone --recursive https://github.com/inuex35/360-gaussian-splatting
가상환경을 설정한다
가상환경 이름이 기존 vanilla GS의 가상환경과 이름이 겹쳐
가상환경 이름을 360gs로 변경한 후 진행했다
environment.yml을 아래와 같이 수정했다
다른 라이브러리 버전은 개인 컴퓨터 환경마다 맞춰야 한다
name: 360gs # original: gaussian-splatting
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- cudatoolkit=11.6
- plyfile=0.8.1
- python=3.9.9
- pip=22.3.1
- pytorch=1.12.1
- torchaudio=0.12.1
- torchvision=0.13.1
- tqdm
- pip:
- submodules/diff-gaussian-rasterization
- submodules/simple-knn
cd 360-gaussian-splatting
conda env create --file environment.yml
conda activate 360gs
최종적으로 아래와 같은 명령어를 거쳤는데
본인 환경에 맞게 트러블슈팅 하는 것이 좋다
본인의 환경은 RTX4060ti, Ubuntu22.04, CUDA 12.3을 사용했다
conda env create --file environment.yml
conda install python==3.10
conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=12.1 -c pytorch -c nvidia
pip install submodules/diff-gaussian-rasterization
pip install submodules/simple-knn/
pip install pyproj plyfile tqdm flask
conda install conda-forge::sphinx
이후 순서
360 GS을 수행하기 위한 opensfm 설치 -> pointcloud 생성 -> GS로 이미지 렌더링
360GS에 맞는 Opensfm 설치
https://github.com/inuex35/ind-bermuda-opensfm?tab=readme-ov-file
위 링크는 repo 관리자가 직접 트러블 슈팅한 코드이고
아래는 original opensfm을 설치하는 방법이다
위 repo를 아래의 방법대로 설치하면 된다
https://opensfm.org/docs/building.html
방법은 아래와 같다
cd
git clone https://github.com/inuex35/ind-bermuda-opensfm.git
cd ind-bermuda-opensfm
git submodule update --init --recursive
pip install -r requirements.txt
이후 빌드한다
python3 setup.py build
Test 삼아 PCD 만들기
환경이 구성되었으면 pcd를 만든다
우선은 테스트 데이터셋으로 돌려본다
3장인 데이터셋이므로 한 번 해본다
bin/opensfm_run_all data/berlin
뷰어 노드를 실행한다
./viewer/node_modules.sh
다른 터미널에서는 볼 수 있도록 뷰어에 접속한다
python3 viewer/server.py -d data/berlin


이후 아래 명령어를 실행하면 파일이 생성된다
data/berlin/unidtorted/depthmaps/merged.ply
bin/opensfm undistort data/berlin
bin/opensfm compute_depthmaps data/berlin
ply 파일을 확인하면 잘 생성된 것을 확인할 수 있다

PAIR360 datasets으로 생성

데이터셋 경로는 본인 환경에 맞게 설정한다
본인의 경우 ~/pair360lite/images 에 360도 카메라 이미지 파일들을 저장했다
data/berlin에 있는 config.yaml 파일을 가져온다
데이터셋(PAIR360)
https://airlabkhu.github.io/PAIR-360-Dataset/
SOCIAL MEDIA TITLE TAG
SOCIAL MEDIA DESCRIPTION TAG TAG
airlabkhu.github.io
해당 데이터셋의 Traversal 2/Central Library/T2-Central_Library-0-stitching.zip 을 사용한다
데이터가 많아 일부만 사용하도록 한다
900~1800 / 3000 ~ 3200.png 만 사용하여 총 1,102장의 이미지 중
해당 이미지의 품질이 높아 처리할 양이 많아
이미지의 이름이 0과 5로 끝나는 이미지만 사용하여 221장의 이미지를 사용하고
그 마저도 해상도를 절반씩 줄여서 사용했다
아래 코드를 수행한다
import os
import shutil
# 원본 디렉토리와 복사 대상 디렉토리 지정
source_dir = "pair360/images" # 원본 디렉토리 경로
target_dir = "pair360lite/ori_res_images" # 복사할 디렉토리 경로
# 복사 대상 디렉토리가 없으면 생성
os.makedirs(target_dir, exist_ok=True)
# 디렉토리 내 파일 순회
for filename in os.listdir(source_dir):
if filename.endswith(".png") and filename[:-4].isdigit(): # 확장자가 .png이고 이름이 숫자인 경우
if filename[-5] in {"0", "5"}: # 파일 이름이 0 또는 5로 끝나는 경우
source_path = os.path.join(source_dir, filename)
target_path = os.path.join(target_dir, filename)
shutil.copy(source_path, target_path) # 파일 복사
print(f"Copied: {filename}")
import cv2
import os
source_dir = "pair360lite/ori_res_images"
target_dir = "pair360lite/images"
os.makedirs(target_dir, exist_ok=True)
for filename in os.listdir(source_dir):
if filename.endswith(".png"):
img_path = os.path.join(source_dir, filename)
img = cv2.imread(img_path)
resized_img = cv2.resize(img, (3840, 1920)) # 새로운 해상도
cv2.imwrite(os.path.join(target_dir, filename), resized_img)
print(f"Resized: {filename}")
이후 masked 데이터를 추가한다
Traversal 2/Central Library/segmentation 파일을 가져온다
이후 non-class만 사용하도록 파일들을 변환한다
masked image 또한 해상도를 절반으로 줄여야한다
경로는 직접 수정하길 바란다
import os
import cv2
import numpy as np
# 원본 폴더와 결과 저장 폴더 경로
source_dir = "pair360lite/seg_sample_pick" # segmentation 이미지 폴더
target_dir = "pair360lite/mask_picked" # 결과 저장 폴더
os.makedirs(target_dir, exist_ok=True) # 결과 폴더 없으면 생성
# 폴더 내 파일 처리
for filename in os.listdir(source_dir):
if filename.endswith(".png"):
# 원본 이미지 경로와 저장 경로
img_path = os.path.join(source_dir, filename)
output_path = os.path.join(target_dir, filename)
# 이미지 읽기 (그레이스케일 모드)
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
# 검정색(0)인 부분만 유지하고 나머지는 흰색(255)으로 변경
mask = np.where(img == 0, 0, 255).astype(np.uint8)
# 결과 저장
cv2.imwrite(output_path, mask)
print(f"Processed: {filename}")
이후 pcd를 생성한다
bin/opensfm_run_all ~/pair360lite
뷰어 노드를 실행한다
./viewer/node_modules.sh
python3 viewer/server.py -d ~/pair360lite


원본 데이터 수집 과정에서는
D자 모양의 trajectory로 수행되었다
하지만 visual odometry로 정확한 trajectory가 나타나진 않았다
그래도 앞 뒤로 trajectory가 형성되었다
이미지만으로 정확한 trajectory가 나타나지 않을 것으로 생각한다
그래도 일단 해보자
bin/opensfm undistort data/berlin
bin/opensfm compute_depthmaps data/berlin
pcd를 생성했으면 이를 토대로 렌더링 모델을 train한다
python3 train.py -s ~/pair360lite --panorama

구조만 봤을 때는 이해하기 어렵지만 우선은 진행해본다
train의 결과물을 pair360lite에 복사하여 옮긴다
images를 imges_split이라는 폴더에 복사하여 옮긴다
python render.py -m ~/pair360lite -s ~/pair360lite
python metrics.py -m ~/pair360lite
Scene: /home/user/pair360lite
Method: ours_30000
Metric evaluation progress: 0it [00:00, ?it/s]
SSIM : nan
PSNR : nan
LPIPS: nan
SIBR viewer 설치
아래 두 링크를 참고하여 설치한다
https://github.com/graphdeco-inria/gaussian-splatting
https://github.com/graphdeco-inria/gaussian-splatting/issues/152
결과물
$ ./install/bin/SIBR_remoteGaussian_app -s ~/pair360lite/
보다는
$ ./install/bin/SIBR_gaussianViewer_app -m ~/pair360lite/
가 보기 편했다

원래 주변 지형을 잘 알고 있고
데이터셋 원본과 비교했을 때
꽤나 성능이 높다
다양한 파라미터들을 사용하지 못해 최선의 결과는 아닌 듯 하나
논문과 함께 읽어보면서 성능을 높여보면 좋을 듯 하다
'Review > Project' 카테고리의 다른 글
LOD 3DGS 렌더링 (0) | 2025.01.15 |
---|