Issue: Importing Tensorflow Prevents Proper Running of other Library

I’ve recently been trying to use the MediaPipe hand landmark detection library, and it works just fine until I try to import Tensorflow. No matter what code/program I try to run, if I import Tensorflow in any capacity, either the whole module, or a function within it, it causes the MediaPipe function .process() to freeze. The setup is as follows:

    mp_drawing = mp.solutions.drawing_utils
    mp_drawing_styles = mp.solutions.drawing_styles
    mp_hands = mp.solutions.hands

    hands = mp_hands.Hands(
        static_image_mode=True,
        max_num_hands=2,
        min_detection_confidence=.5)

    image = cv2.imread('some_image')

    results = hands.process(image)

Any variation of that freezes without fail at the results = hands.process(image) line, but works perfectly fine if I don’t import Tensorflow in any capacity. My tensorflow version is 1.14.0, keras version is 2.3.1, and python version is 3.7.6, if that helps at all.

You smart folks have any idea why this might be happening, and how it might be remedied?

Thanks,

Sam

If you imported tensorflow before importing mediapipe, it would cause the mediapipe library to hang indefinitely but importing tensorflow second will fix it as a workaround.

Yes it is a known issue in MediaPipe and we don’t have any permanent fix at present. We will keep you inform here once we found any update. Thank you.