mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.38k stars 858 forks source link

[Crash] RuntimeWarning: invalid value encountered in divide #181

Closed jleistner closed 7 years ago

jleistner commented 7 years ago

Hi there,

I keep experiencing the following error where certain images cause OpenSfM to freeze:

2017-06-04 12:36:57,431 Found 2844 points in 0.14826798439s
2017-06-04 12:36:57,431 reducing threshold
2017-06-04 12:36:57,431 Computing sift with threshold 0.000228365826052
2017-06-04 12:36:57,579 Found 2844 points in 0.147316932678s
2017-06-04 12:36:57,579 reducing threshold
2017-06-04 12:36:57,579 Computing sift with threshold 0.000152243884035
/path/to/OpenSfM-master/opensfm/features.py:34: RuntimeWarning: invalid value encountered in divide
  desc = np.sqrt(desc.T/s).T
2017-06-04 12:36:57,720 Found 2844 points in 0.141183137894s
2017-06-04 12:36:57,720 reducing threshold
2017-06-04 12:36:57,720 Computing sift with threshold 0.00010149592269
2017-06-04 12:36:57,870 Found 2844 points in 0.149418115616s
2017-06-04 12:36:57,870 reducing threshold
2017-06-04 12:36:57,870 Computing sift with threshold 6.76639484599e-05
2017-06-04 12:36:58,061 Found 2844 points in 0.19105887413s
2017-06-04 12:36:58,061 done
/path/to/OpenSfM-master/opensfm/features.py:34: RuntimeWarning: invalid value encountered in divide
  desc = np.sqrt(desc.T/s).T

The only way to kill the program is to close the terminal. After some investigating I think some sort of ZeroDivisionError is causing the problem. With the following image I can reproduce the crash every single time.

paulinus commented 7 years ago

Thanks for providing the test image. It works fine here.

The error seems to be that a SIFT descriptor as computed by OpenCV is all zeros, which should not happen. It does not happen to me, so it might be related to your OpenCV installation.

If you can't find the problem, the simplest solution is to use the default HAHOG descriptor which does not use OpenCV.

jleistner commented 7 years ago

In this case I will try to reinstall OpenCV which will hopefully fix this problem. Thanks a lot for your help.