wolterlw / hand_tracking

Minimal Python interface for Google's Mediapipe HandTracking pipeline
Apache License 2.0
148 stars 37 forks source link

maximum recursion depth exceeded #28

Open antiapt opened 4 years ago

antiapt commented 4 years ago

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!

wolterlw commented 4 years ago

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?

antiapt commented 4 years ago

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 commented 4 years ago

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.

wolterlw commented 4 years ago

better clip the value under exp

antiapt commented 4 years ago

Thanks for your suggestion, will try this.

wolterlw commented 4 years ago

so?