wolterlw / hand_tracking

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

Recommended way to process videos #23

Open AmitMY opened 4 years ago

AmitMY commented 4 years ago

Not an actual issue, more of a clarification request.

I'm trying to do hand pose estimation to a video.

Given this video: ezgif-6-8ce658e05744

This is what OpenPose returns: openpose It doesn't return the hands because it can't detect them.

Next, I tried to run this hand-tracking code, the simplest way I can:

for frame in frames:
  hands = detector(frame)

googlepose

As you can see, there are hands flying out, so I added a detector.reset() before invoking it every time: ezgif-6-c80b24c39b10 Which does work better regarding flying hands, but has its own artifacts.

I then tried to perhaps feed the previously detected hands back:

    if len(last_hands) > 0:
        hands = detector(img, last_hands)
    else:
        hands = detector(img)
    last_hands = hands

googlepose_feedback_no_reset

or to add a detector.reset() every time no hand is detected: googlepose_feedback_with_reset

and for completeness sake, here is a synchronized video of everything I tried: ezgif-6-db38a7989fbf

all3naby commented 4 years ago

@AmitMY can you share the above code?

AmitMY commented 4 years ago

https://github.com/AmitMY/pose-docker/tree/master/Google

You don't have to use docker, the code to run once you have this repository installed is: https://github.com/AmitMY/pose-docker/blob/master/Google/api/pose_video.py

And there is a utility file for joint positions: https://github.com/AmitMY/pose-docker/blob/master/Google/api/pose_util.py

wolterlw commented 4 years ago

Hi @AmitMY, sorry for the long wait, this project got kinda low on the priority list. Are you still interested in improving the pipeline? If so - please send me an email (address in profile) and we could collaborate on it. There's plenty of work to be done starting all the way from hand detection, but I'm kind of reluctant to do it on my own.