hand_tracking icon indicating copy to clipboard operation
hand_tracking copied to clipboard

maximum recursion depth exceeded

Open antiapt opened this issue 5 years ago • 6 comments

I was following the instructions and trying to reproduce the examples. But it raises a recursion error when calling the sigmoid function here.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\Desktop\temp\hand_tracking\hand_tracker.py", line 170, in __call__
    source, keypoints = self.detect_hand(img_norm)
  File "C:\Users\user\Desktop\temp\hand_tracking\hand_tracker.py", line 125, in detect_hand
    detecion_mask = self._sigm(out_clf) > 0.7
  File "C:\Users\user\Desktop\temp\hand_tracking\hand_tracker.py", line 95, in _sigm
    return 1 / (1 + np.exp(-x) )
RecursionError: maximum recursion depth exceeded while calling a Python object

Any idea of how to deal with this? I am using TensorFlow 2.0, python 35 in virtualenv of anaconda. Much appreciated!

antiapt avatar Feb 20 '20 21:02 antiapt

you're on master branch, right? The code doesn't seem to have any recursive calls. Can you run a debugger and set a breakpoint in sigm, step outside of it and see where it locks into recursion?

wolterlw avatar Feb 20 '20 22:02 wolterlw

Yes, I am on the master branch and am stepping into this. It seems like to raise this problem when calculating the out_clf. This value caused the recursion issue when calculating the sigmoid.

But could you share with me your system requirement, thank you!

antiapt avatar Feb 21 '20 03:02 antiapt

It seems like there was an overflow error when calculating the exp() function. I converted the out_reg and out_clf into np.longdouble can it works out then.

antiapt avatar Feb 21 '20 04:02 antiapt

better clip the value under exp

wolterlw avatar Feb 21 '20 07:02 wolterlw

Thanks for your suggestion, will try this.

antiapt avatar Feb 21 '20 20:02 antiapt

so?

wolterlw avatar Mar 08 '20 01:03 wolterlw