instant-ngp
instant-ngp copied to clipboard
colmap2nerf.py NaN problem
colmap2nerf.py:280: RuntimeWarning: invalid value encountered in true_divide totp /= totw [nan nan nan] avg camera distance from origin nan 111 frames writing transforms.json
[...] "frames": [ { "file_path": "./images/DJI_0353.JPG", "sharpness": 3097.7094803594714, "transform_matrix": [ [ -0.048770823394761034, -0.004720344356321631, 0.9987988411756861, NaN ],
I encountered the same problem while trying to make models from UAV imagery with the Zenmuse X7 camera.
Were you able to solve this issue?
Not yet
That means your camera poses are not correct
@killnice I think this occurs when the principal rays are parallel to each others, it does not mean that the poses are incorrect.
Have the same exact issue when try to test a drone shot, tried a number of ways to solve but nothing does.
I have changed two things that made the solver work:
- changed colmap matcher from exhaustive to sequential,
- Switched from input of pre-processed images to video input.
This worked in my case.
Same issue here,when the principal rays are parallel to each others,we will get Nan,want to know how to slove this.Any suggestions?
It seems that the problem arises from the closest_point_2_lines(mf[:,3], mf[:,2], mg[:,3], mg[:,2])
in line further if I look closely in the code the w>0.01
is being hardcoded, for the images I was testing the value of w
returned from closest_point_2_lines
was much lower, perhaps manually setting it to lower value should do the trick to get it up and running, not really sure if that's the correct workaround but does prevent nans from coming. Further, f
and g
take values from the same set of frames, thus, for the same images in inner loop w
will always be zero since the transformation matrices (here and here) will be same so resulting in 0 vector and 0 denom
, so perhaps skip those frame indices.
Thanks to @aradhyamathur , I changed the line w > 0.01
in colmap2nerf.py
into w > 0.0001
.
Before lowering the threshold, the output:
RuntimeWarning: invalid value encountered in true_divide
totp /= totw
[nan nan nan]
avg camera distance from origin nan
After lowering the threshold value into 0.0001, the output:
up vector was [-0.99801947 -0.06274485 -0.00449611]
computing center of attention...
[-317.74067482 -24.81560531 -0.35117663]
avg camera distance from origin 318.726712749806
It became non-nan values, and executes without warning.
Thanks for pointing this out -- I've pushed a corresponding fix to master