Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

Trikang

Gaussian Shader 모델 코드 빌드 본문

공부/ML

Gaussian Shader 모델 코드 빌드

Trikang 2024. 3. 3. 15:19

모델 소스코드는 여기에

https://github.com/Asparagus15/GaussianShader

 

GitHub - Asparagus15/GaussianShader: code for GaussianShader: 3D Gaussian Splatting with Shading Functions for Reflective Surfac

code for GaussianShader: 3D Gaussian Splatting with Shading Functions for Reflective Surfaces - Asparagus15/GaussianShader

github.com


공식적인 Installation 가이드는 아래와 같다.

# Clone the repository
git clone https://github.com/Asparagus15/GaussianShader.git
cd GaussianShader

# Install dependencies
conda env create --file environment.yml
conda activate gaussian_shader

그러나 으레 그러하듯, 이대로 conda env create를 하면 환경설정 도중 펑펑 터진다. 

 

그래서 environment.yml을 아래와 같이 수정하였다.

  • 3D-GS에선 submodules 아래에서 제공하던 simple-knn, diff-gaussian-rasterization이 pip 목록에 버젓이 올라와있는데, 이게 제대로 설치되지 않고 터진다. 그래서 주석처리 하고 아래와 같이 패키지를 설치했다.
  • cutlass 0.0.1이 없다고 떠, 'pip install nvidia-cutlass'로 직접 설치
  • nidiffrast 0.3.1도 문제가 있어 아래와 같이 해결. 주로 https://nvlabs.github.io/nvdiffrast/#pytorch-api-reference 참고
    • git clone https://github.com/NVlabs/nvdiffrast하여 도커 빌드도 가능하나, 기다리기 귀찮아서
      • 혹시 몰라서 작성해두자면, docker 빌드는 아래와 같이 진행하였음
      • git clone https://github.com/NVlabs/nvdiffrast
        cd nvdiffrast/
        chmod +x ./run_sample.sh
        sudo ./run_sample.sh --build-container
    • '/home/user'에 모두 가져온 다음, export PYTHONPATH="/home/user/nvdiffrast"하여 PYTHONPATH에 등록하여 해결 
      • GaussianShader의 root 디렉토리에 clone하여 pip install . 해도 되는 것 같음(매뉴얼에 그렇게 나와있음. 해보지는 않았다)

아래는 문제를 해결한 environment.yml 파일. 사실 주먹구구식으로 해결한거라, 깔끔한 솔루션은 아닐거다. 깔끔하게 정리하는 게 시간 아까워서 우선 해결한 방법이라도 급히 적어놓음.

name: gaussian_shader
channels:
  - pytorch
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - ca-certificates=2023.5.7=hbcca054_0
  - colorama=0.4.6=pyhd8ed1ab_0
  - ld_impl_linux-64=2.40=h41732ed_0
  - libblas=3.9.0=17_linux64_openblas
  - libcblas=3.9.0=17_linux64_openblas
  - libffi=3.3=h58526e2_2
  - libgcc-ng=13.1.0=he5830b7_0
  - libgfortran-ng=13.1.0=h69a702a_0
  - libgfortran5=13.1.0=h15d22d2_0
  - libgomp=13.1.0=he5830b7_0
  - liblapack=3.9.0=17_linux64_openblas
  - libopenblas=0.3.23=pthreads_h80387f5_0
  - libsqlite=3.42.0=h2797004_0
  - libstdcxx-ng=13.1.0=hfd8a6a1_0
  - libzlib=1.2.13=hd590300_5
  - ncurses=6.4=hcb278e6_0
  - numpy=1.21.6=py37h976b520_0
  - openssl=1.1.1u=hd590300_0
  - pip=22.3.1=pyhd8ed1ab_0
  - plyfile=0.8.1=pyhd8ed1ab_0
  - python=3.7.13=haa1d7c7_1
  - python_abi=3.7=2_cp37m
  - readline=8.2=h8228510_1
  - sqlite=3.42.0=h2c6b66d_0
  - tk=8.6.12=h27826a3_0
  - tqdm=4.65.0=pyhd8ed1ab_1
  - wheel=0.40.0=pyhd8ed1ab_0
  - xz=5.2.6=h166bdaf_0
  - zlib=1.2.13=hd590300_5
  - pytorch=1.12.1
  - torchaudio=0.12.1
  - torchvision=0.13.1
  - pip:
      - absl-py==1.4.0
      - addict==2.4.0
      - ansi2html==1.8.0
      - attrs==23.1.0
      - backcall==0.2.0
      - cachetools==5.3.1
      - certifi==2023.7.22
      - charset-normalizer==3.2.0
      - click==8.1.6
      - configargparse==1.7
      # - cutlass==0.0.1
      - cycler==0.11.0
      - dash==2.11.1
      - dash-core-components==2.0.0
      - dash-html-components==2.0.0
      - dash-table==5.0.0
      - debugpy==1.6.7
      - decorator==5.1.1
      # - diff-gaussian-rasterization==0.0.0
      # - diff-gaussian-rasterization
      - entrypoints==0.4
      - fastjsonschema==2.18.0
      - flask==2.2.5
      - fmt==0.3.1
      - fonttools==4.38.0
      - google-auth==2.22.0
      - google-auth-oauthlib==0.4.6
      - grpcio==1.56.2
      - idna==3.4
      - imageio==2.31.2
      - importlib-metadata==6.7.0
      - importlib-resources==5.12.0
      - ipykernel==6.16.2
      - ipython==7.34.0
      - ipywidgets==8.0.7
      - itsdangerous==2.1.2
      - jedi==0.18.2
      - jinja2==3.1.2
      - joblib==1.3.1
      - jsonschema==4.17.3
      - jupyter-client==7.4.9
      - jupyter-core==4.12.0
      - jupyterlab-widgets==3.0.8
      - kiwisolver==1.4.4
      - markdown==3.4.4
      - markupsafe==2.1.3
      - matplotlib==3.5.3
      - matplotlib-inline==0.1.6
      - nbformat==5.7.0
      - nest-asyncio==1.5.6
      - ninja==1.11.1.1
      # - nvdiffrast==0.3.1
      - oauthlib==3.2.2
      - open3d==0.17.0
      - opencv-python-headless==4.8.0.74
      - packaging==23.1
      - pandas==1.3.5
      - parso==0.8.3
      - pexpect==4.8.0
      - pickleshare==0.7.5
      - pillow==9.5.0
      - pkgutil-resolve-name==1.3.10
      - plotly==5.15.0
      - prompt-toolkit==3.0.39
      - protobuf==3.20.3
      - psutil==5.9.5
      - ptyprocess==0.7.0
      - pyasn1==0.5.0
      - pyasn1-modules==0.3.0
      - pygments==2.15.1
      - pyparsing==3.1.0
      - pyquaternion==0.9.9
      - pyrsistent==0.19.3
      - python-dateutil==2.8.2
      - pytz==2023.3
      - pyyaml==6.0.1
      - pyzmq==25.1.0
      - requests==2.31.0
      - requests-oauthlib==1.3.1
      - retrying==1.3.4
      - rsa==4.9
      - scikit-learn==1.0.2
      - scipy==1.7.3
      - setuptools==59.5.0
      # - simple-knn==0.0.0
      - six==1.16.0
      - tenacity==8.2.2
      - tensorboard==2.11.2
      - tensorboard-data-server==0.6.1
      - tensorboard-plugin-wit==1.8.1
      - threadpoolctl==3.1.0
      # - torch==1.10.1+cu111
      # - torchaudio==0.10.1+cu111
      # - torchvision==0.11.2+cu111
      - tornado==6.2
      - traitlets==5.9.0
      - typing-extensions==4.7.1
      - urllib3==1.26.16
      - wcwidth==0.2.6
      - werkzeug==2.2.3
      - widgetsnbextension==4.0.8
      - zipp==3.15.0
      - submodules/diff-gaussian-rasterization
      - submodules/simple-knn

 

이후 gaussian_shader 가상환경에서 아래와 같이 코드를 실행하면 됨.

python train.py -s data/nerf_llff_fern --eval -m output/nerf_llff_fern -w --brdf_dim 0 --sh_degree -1 --lambda_predicted_normal 2e-1 --brdf_env 512

 

Comments