720.10 a

Description: ProlificDreamer, presented at NeurIPS 2023, introduces a method for text-to-3D generation using Variational Score Distillation (VSD), which addresses issues found in existing Score Distillation Sampling (SDS) methods like over-saturation and low diversity. The paper proposes treating 3D parameters as random variables to enhance diversity and quality. The approach incorporates various improvements, including better distillation scheduling and density initialization, leading to high-fidelity, photo-realistic NeRFs and meshes with detailed structure and complex effects. I saw an article saying that it usually takes several hours.

#700#Research_Paper#720#Computer_Vision#720.10#Text_to_3D#720.10 a#ProlificDreamer:_High-Fidelity_and_Diverse_Text-to-3D_Generation_with_Variational_Score_Distillation

step 1문제 gridencoder error

issue say
pip install ./gridencoder

issue say error
ERROR: Could not build wheels for gridencoder, which is required to install pyproject.toml-based projects

./gridencoder/setup.py

...
nvcc_flags = [
    '-O3', '-std=c++14',
    '-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__',
]

if os.name == "posix":
    c_flags = ['-O3', '-std=c++14']
elif os.name == "nt":
    c_flags = ['/O2', '/std:c++17']
...

Solution

...
nvcc_flags = [
    '-O3', '-std=c++17',
    '-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__',
]

if os.name == "posix":
    c_flags = ['-O3', '-std=c++17']
elif os.name == "nt":
    c_flags = ['/O2', '/std:c++17']

...

setp2 문제 ModuleNotFoundError: No module named '_freqencoder'

이슈
https://github.com/ashawkey/stable-dreamfusion/pull/173
모르겠음. 해당 이슈는 여러 파일의 특정부분을 바꿔다는데, prolificdreamer에서는 해당파일들이 안 보임

test 애도 C++14에서 C++17로만 바꿔봄.
오 혹시나 했는데 setup.py 바꾸고 이전처럼 pip install ./freqencoder 하고 run 하니 됨

step3 문제 TypeError: make_grid() got an unexpected keyword argument 'range'

run bash에서 first stage는 ok
run second에서 다음 에러발생

다른 프로젝트의 이슈에서 range대신 value_range로 바꿔보라함
https://github.com/ProjectNUWA/DragNUWA/issues/15

prolificdreamer / nerf/ utils.py 의 1225줄 수정

torchvision.utils.save_image(pre_imgs.permute(0,3,1,2), os.path.join(self.workspace, 'validation', f'{self.name}_ep{self.epoch:06d}' + "-rgb-"+shading+".png"), nrow=self.opt.val_size, normalize=True, range=(0,1))

torchvision.utils.save_image(pre_imgs.permute(0,3,1,2), os.path.join(self.workspace, 'validation', f'{self.name}_ep{self.epoch:06d}' + "-rgb-"+shading+".png"), nrow=self.opt.val_size, normalize=True, value_range=(0,1))

다음에 다시 돌리니 927줄부터 970줄까지 5번 더나옴-> 전부 range에서 value_range로 수정함

step4 너무 긴시간. 각 스테이지가 250번,150번,300번 epoch인데 한 iter당 100번이 약 2분걸림.

#!/bin/bash

gpu=$1
prompt=$2

echo "CUDA:$gpu, Prompt: $prompt"

filename=$(echo "$prompt" | sed 's/ /-/g')
n_particles=1


CUDA_VISIBLE_DEVICES=$gpu python main.py --text "$prompt" --iters 25000 --lambda_entropy 10 --scale 7.5 --n_particles $n_particles --h 512  --w 512 --t5_iters 5000 --workspace exp-nerf-stage1/

recent_ckpt=$(find exp-nerf-stage1 -type d -name "*$filename*" -exec ls -d {}/checkpoints \; | head -n 1)

CUDA_VISIBLE_DEVICES=$gpu python main.py --text "$prompt" --iters 15000 --scale 100 --dmtet --mesh_idx 0  --init_ckpt $recent_ckpt/best_df_ep0250.pth --normal True --sds True --density_thresh 0.1 --lambda_normal 5000 --workspace exp-dmtet-stage2/

recent_ckpt=$(find exp-dmtet-stage2 -type d -name "*$filename*" -exec ls -d {}/checkpoints \; | head -n 1)

iter수정, 파일명 수정

파일 에러. 최종 iter기준으로 파일명이 생성될줄알았는데, 1000번 iter마다 생성되는거같은. stage1 1500 iter기준파일 목록

root@36cf9a3e6819:/workspace/prolificdreamer/exp-nerf-stage1/2024-05-02-A-uzumaki-naruto-scale-7.5-lr-0.001-albedo-le-10.0-render-512-cube-sd-2.1-500-tet-256/checkpoints# ls -l
total 95639
-rw-rw-rw- 1 root root 48966930 May  2 13:09 df_ep0001.pth
-rw-rw-rw- 1 root root 48967122 May  2 13:27 df_ep0010.pth
root@36cf9a3e6819:/workspace/prolificdreamer/exp-nerf-stage1/2024-05-02-A-uzumaki-naruto-scale-7.5-lr-0.001-albedo-le-10.0-render-512-cube-sd-2.1-500-tet-256/checkpoints# 

stage1 100이터다 2분
stage2 100이터당 30초정도
stage3 100이터당 1분?

근데 기본세팅이 stage1 250번, stage2 150번, stage3 300번임. 수정 필수

200 ,pth이름수정 best_ 빼야함
200
400 생성이 안됨. iter가 부족한듯?