lambdaloop / aniposelib

📷 🐊 An easy-to-use library for calibrating cameras in python
https://anipose.readthedocs.io
BSD 2-Clause "Simplified" License
70 stars 33 forks source link

"Residuals are not finite" error with anipose triangulate #20

Open vzimmern opened 1 year ago

vzimmern commented 1 year ago

Good afternoon,

I'm working with a 4 camera setup to record mouse movements in relation to a neurological disorder.

I'm at the triangulation step of the anipose workflow, after getting through the others steps without errors.

The error is as follows:

/home/minassian/Documents/glove-anipose/2023-07-16/pose-3d/2023-07-16-vid1.csv 100%|███████████████████████████| 6888/6888 [00:01<00:00, 5993.77it/s] /home/minassian/miniconda3/envs/glove-anipose/lib/python3.7/site-packages/aniposelib/cameras.py:1023: RuntimeWarning: divide by zero encountered in double_scalars default_smooth = 1.0/np.mean(np.abs(np.diff(p3ds_med, axis=0))) /home/minassian/miniconda3/envs/glove-anipose/lib/python3.7/site-packages/scipy/optimize/_lsq/least_squares.py:815: RuntimeWarning: invalid value encountered in multiply return np.atleast_1d(fun(x, *args, **kwargs)) Traceback (most recent call last): File "/home/minassian/miniconda3/envs/glove-anipose/lib/python3.7/site-packages/anipose/triangulate.py", line 346, in process_session fname_dict, output_fname) File "/home/minassian/miniconda3/envs/glove-anipose/lib/python3.7/site-packages/anipose/triangulate.py", line 222, in triangulate verbose=True) File "/home/minassian/miniconda3/envs/glove-anipose/lib/python3.7/site-packages/aniposelib/cameras.py", line 1050, in optim_points n_deriv_smooth)) File "/home/minassian/miniconda3/envs/glove-anipose/lib/python3.7/site-packages/scipy/optimize/_lsq/least_squares.py", line 827, in least_squares raise ValueError("Residuals are not finite in the initial point.") ValueError: Residuals are not finite in the initial point.

From what I can find, the "residuals are not finite" error has to do with taking square roots of negative numbers.

I can't tell where this is coming from and how best to fix it.

I'm working on Ubuntu 22.04 LTS, Python 3.7.16, numba 0.54.1

Thanks for any help!

xlvvr commented 2 months ago

I'm having the same issue, have you found a solution?