Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'select_working_views_by_overlap' from 'utils.view_select' #11

Open
YuhsiHu opened this issue Jul 11, 2022 · 3 comments

Comments

@YuhsiHu
Copy link

YuhsiHu commented Jul 11, 2022

Thank you for your sharing!
I download the nerf_synthetic dataset and your pre-trained model. When I run

python render.py --cfg configs/gen/neuray_gen_depth.yaml --database nerf_synthetic/lego/black_800 --pose_type eval

There is an error:

Traceback (most recent call last):
File "render.py", line 12, in
from network.renderer import name2network
File "/home/hyx/NeuRay/network/renderer.py", line 21, in
from utils.view_select import compute_nearest_camera_indices, select_working_views, select_working_views_by_overlap
ImportError: cannot import name 'select_working_views_by_overlap' from 'utils.view_select'

I found that the function 'select_working_views_by_overlap' is commented. So I uncomment that and run again. But there is another error:

Traceback (most recent call last):
File "render.py", line 210, in
render_video_gen(flags.database_name, cfg_fn=flags.cfg, pose_type=flags.pose_type, pose_fn=flags.pose_fn,
File "render.py", line 113, in render_video_gen
ref_ids_list = select_working_views_db(database, ref_ids_all, que_poses, render_cfg['min_wn'])
File "/home/hyx/NeuRay/utils/view_select.py", line 86, in select_working_views_db
indices = select_working_views(ref_poses, que_poses, work_num, exclude_self)
File "/home/hyx/NeuRay/utils/view_select.py", line 21, in select_working_views
dists = np.linalg.norm(ref_cam_pts[None, :, :] - render_cam_pts[:, None, :], 2, 2) # qn,rfn
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

Could you please help me solve this problem? Thank you for your time!

@liuyuan-pal
Copy link
Owner

Thanks for pointing this out! I've updated the code and it will work now.
I mistakenly included the deprecated select_working_views_by_overlap in the code.

@YuhsiHu
Copy link
Author

YuhsiHu commented Jul 12, 2022

Thanks. I clone the repo again and see your update. However, there is still an error when I run:

python render.py --cfg configs/gen/neuray_gen_depth.yaml --database nerf_synthetic/lego/black_800 --pose_type eval

The IndexError is:

Traceback (most recent call last):
File "render.py", line 210, in
render_video_gen(flags.database_name, cfg_fn=flags.cfg, pose_type=flags.pose_type, pose_fn=flags.pose_fn,
File "render.py", line 113, in render_video_gen
ref_ids_list = select_working_views_db(database, ref_ids_all, que_poses, render_cfg['min_wn'])
File "/home/hyx/NeuRay/utils/view_select.py", line 86, in select_working_views_db
indices = select_working_views(ref_poses, que_poses, work_num, exclude_self)
File "/home/hyx/NeuRay/utils/view_select.py", line 21, in select_working_views
dists = np.linalg.norm(ref_cam_pts[None, :, :] - render_cam_pts[:, None, :], 2, 2) # qn,rfn
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

@liuyuan-pal
Copy link
Owner

It's a little bit weird. Maybe you can insert a breakpoint here

ref_ids_list = select_working_views_db(database, ref_ids_all, que_poses, render_cfg['min_wn'])

and you may check the len(ref_ids_all). The size should be 100. Otherwise, you may check your dataset path is consistent with the README.md or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants