chenhonghua / MVIP-NeRF

Other
17 stars 0 forks source link

IndexError when running the code. #14

Closed DaLi-Jack closed 1 month ago

DaLi-Jack commented 1 month ago

Hi! Thanks for your great work. However, when I test your code, I encounter the following IndexError: image I haven't changed any of your code. How can I solve this problem? I will be extremely grateful for any help!

yxxshin commented 1 month ago

Hello,

I changed the run.py part like this and got the codes working:

Before:

if not args.prepare:                                               ################# modified #####################
    rays_rgb = rays_rgb[rays_rgb[:, :, 3] == 1].reshape(-1, 3, 4)  ################# modified #####################
    rays_inp = rays_inp[rays_rgb[:, :, 3] == 0].reshape(-1, 3, 4)       ################# modified #####################

After:

if not args.prepare:                                               ################# modified #####################
    orig_rays_rgb = rays_rgb
    rays_rgb = rays_rgb[rays_rgb[:, :, 3] == 1].reshape(-1, 3, 4)  ################# modified #####################
    rays_inp = rays_inp[orig_rays_rgb[:, :, 3] == 0].reshape(-1, 3, 4)       ################# modified #####################

Try this !

chenhonghua commented 1 month ago

Hi,

I am not sure about this reason. If there is still an issue, I will run and check it.

thanks

DaLi-Jack commented 1 month ago

Hello,

I changed the run.py part like this and got the codes working:

Before:

if not args.prepare:                                               ################# modified #####################
    rays_rgb = rays_rgb[rays_rgb[:, :, 3] == 1].reshape(-1, 3, 4)  ################# modified #####################
    rays_inp = rays_inp[rays_rgb[:, :, 3] == 0].reshape(-1, 3, 4)       ################# modified #####################

After:

if not args.prepare:                                               ################# modified #####################
    orig_rays_rgb = rays_rgb
    rays_rgb = rays_rgb[rays_rgb[:, :, 3] == 1].reshape(-1, 3, 4)  ################# modified #####################
    rays_inp = rays_inp[orig_rays_rgb[:, :, 3] == 0].reshape(-1, 3, 4)       ################# modified #####################

Try this !

Yes! This solves the problem.