딥러닝/Virtual Production

[NeX] 3. NeX코드 데이터셋을 만들어서 돌려보자. - LLFF로 필요한 것들 추출

brotoo 2021. 9. 15. 14:10

다음은 LLFF로 필요한 구성요소들을 추출할 것입니다.

 

NeX의 디렉토리 보시면,

data/images 안에

dense/sparse/ ---- .bin 하면서 bin 파일 있어야하고요.

bound_poses.npy, plane.txt 파일이 있어야합니다. 그래서 이걸 만들겁니다.

 

https://github.com/Fyusion/LLFF

 

GitHub - Fyusion/LLFF: Code release for Local Light Field Fusion at SIGGRAPH 2019

Code release for Local Light Field Fusion at SIGGRAPH 2019 - GitHub - Fyusion/LLFF: Code release for Local Light Field Fusion at SIGGRAPH 2019

github.com

1) llff를 클론합니다.

2) docker로 해도 되긴하는데 저는 그냥 Full Installation Details의 shellscript로 깔았습니다.

3) 콘다 환경 하나 만들어줍니다. (python3.7) 

4) 디렉토리로 들어와서 

pip install -r requirements.txt
sudo apt-get install libglfw3-dev

해서 설치하면 됩니다.

 

2. 실행

1) 그 다음 본인의 데이터수집은 이 아저씨를 따라하세요. 

 

Our method takes in a set of images of a static scene, promotes each image to a local layered representation (MPI), and blends local light fields rendered from these MPIs to render novel views. Please see our paper for more details.

As a rule of thumb, you should use images where the maximum disparity between views is no more than about 64 pixels (watch the closest thing to the camera and don't let it move more than ~1/8 the horizontal field of view between images). Our datasets usually consist of 20-30 images captured handheld in a rough grid pattern.

 

위의 글을 참고해서 20-30 장의 사진을 1/8 정도씩 움직이면서 찍어줍니다.

 

2) 1에서 찍은 사진을 images 폴더 안에 넣어주고

python imgs2poses.py <your_scenedir>

 

로 이미지 디렉토리를 넣어 돌려준다.

 

3) mpis 

python imgs2mpis.py scenedir scenedir/mpis --height 360

 이 코드 넣어서 돌려주고, 나온 값인 mpi 폴더 내 txt파일과 sparse 폴더,  images 360x360, poses_bound.npy파일을 

 nexcode 디렉토리의 데이터 폴더 안에 옮겨준다.

 

4) 디렉토리 구조 만들기

sparse/0/ 안에 있는 파일은 이미지 데이터 폴더와 같은 디렉토리에 dense 폴더를 만들고, sparse 폴더를 그 안에 만들어 넣는다.

mpi.txt 파일은 plane.txt로

images 360x360 -> images로

poses_bound.npy는 그냥 넣는다.

 

5) 그리고 nexcode 디렉토리로 돌아와 돌려주면 된다.

 

- 일반 컴퓨터로는 이렇게 하고

python train.py -scene data/test -model_dir test -http  -layers 12 -sublayers 6 -hidden 256

- gpu가 아주 넉넉하다면 이 코드로 돌린다.

python train.py -scene data/test -model_dir test -http