이제 NVP 논문의 코드를 하나씩 뜯어보자.
/config/config_nvp_l.json 모델 전반에 대한 hyperparameter 명시.
dataio.py training/testing data 로드.
loss_functions.py loss function 정의.
modulation.py modules.py NVP model structure 정의.
sparsegrid.py Latent grid 생성.
utils.py Parameter 수 계산, training summary 등의 기타 기능 수행.
training.py train_video.py 모델 학습(video encoding).
1. w/o compression
eval.py 학습된 latent code quantization & de-quantization, evaluation 수행.
2. w/ compression using codecs
compression.py 학습된 latent code quantization 수행.
compression.ipynb Quantized latent code에 대한 HEVC/JPEG compression.
eval_compression.py Latent code de-quantization, video reconstruction 수행.
학습 데이터의 화질과 모델 크기를 축소하여 Colab GPU 리소스로 실행시켜 보았으며, 그 과정은 아래와 같다.
(https://colab.research.google.com/drive/1Iw2b71uJJxOBnfY9Mpw55_uIsHEdrsGh#scrollTo=OoTtJ4LHtmHn)
!pip install git+https://github.com/subin-kim-cv/tiny-cuda-nn/#subdirectory=bindings/torch
!pip install sk-video
!pip install pytorch-msssim
!git clone https://github.com/subin-kim-cv/NVP.git
%cd NVP
ffmpeg -f rawvideo -vcodec rawvideo -s 1920X1080 -r 60 -pix_fmt yuv420p -t 10 -i Jockey_1920x1080_120fps_420_8bit_YUV.yuv rgb_converted/f%05d.png
(layers of 2D latent grid): 16 8
(size of 3D latent grid): 300, 300, 600 100, 100, 300
_ (modulator network): 128 64
!CUDA_VISIBLE_DEVICES=0 python experiment_scripts/train_video.py --logging_root ./logs_nvp --experiment_name mini_nvp --num_epochs 10000 --epochs_til_ckpt 2500 --steps_til_summary 100 --dataset ./rgb_reduced --num_frames 300 --config ./config/config_mini_nvp.json
!CUDA_VISIBLE_DEVICES=0 python experiment_scripts/eval.py --logging_root ./logs_nvp --experiment_name mini_nvp --dataset ./rgb_reduced --num_frames 300 --config ./logs_nvp/mini_nvp/config.json
!CUDA_VISIBLE_DEVICES=0 python experiment_scripts/compression.py --logging_root ./logs_nvp --experiment_name mini_nvp --config ./logs_nvp/mini_nvp/config.json
!CUDA_VISIBLE_DEVICES=0 python experiment_scripts/eval_compression.py --logging_root ./logs_nvp --experiment_name mini_nvp --dataset rgb_reduced --num_frames 300 --config ./logs_nvp/mini_nvp/config.json --qscale 2 3 3 --crf 21 --framerate 25