nex-mpi / nex-code

Code release for NeX: Real-time View Synthesis with Neural Basis Expansion
MIT License
594 stars 73 forks source link

MPI generation at multiple resolutions #10

Open marco-aste-upo opened 3 years ago

marco-aste-upo commented 3 years ago

Hi,

Great work and thanks for making the code available.

I have trained a model at a resolution of 1008px but I can’t find the way to generate multiple MPI at a lower resolution starting from that hi-res model (for example 800px and 640px for mobile viewing).

How did you approach it when you have created your examples for Mobile, Low, High and VR viewing?

Have you generated a model for each specific resolution or is there another way to generate the MPI without training several models?

Thanks in advance!

pureexe commented 3 years ago

There have 2 approaches to down-scale the MPI.

Approch 1: llff_width

You can provide -llff_width to the train.py. You can set the size of the image width as you want.

However, in this method you need to retrain each resolution separately.

You can found the example in the COLAB where you can set the image_width

Approach 2: image resize

You can simply think MPI is an image. Then you resize it.

Let's say you want to resize from 800 to 640

So, you resize an image in the MPI output folder by scaling it with 640/800 = 0.8

Here is a list of images that you need to resize

alpha_0.jpg
alpha_1.jpg
alpha_2.jpg
basis_1.jpg
basis_2.jpg
basis_3.jpg
basis_4.jpg
basis_5.jpg
basis_6.jpg
basis_7.jpg
basis_8.jpg
mpi_c.jpg

Note that you mustn't resize mpi_b_1.png and mpi_b_2.png

Then you need to change 4 lines in config.js

from

const w = 800;
const h = 600;
const scale = 1;
const offset = 300;

to

const w = 640; // (800 * 0.8)
const h = 480; // (480*0.8)
const scale = 0.8;
const offset = 240; // (300 * 0.8)

By the way, I don't recommend this approach. The result will be worse compare to approach 1

marco-aste-upo commented 3 years ago

Thanks for getting back to me so quickly! I will try both approaches and let you know if I have any issues.