huggingface / controlnet_aux

Apache License 2.0
400 stars 86 forks source link

How to get keypoints output .json file like original OpenPose ? #83

Open mayank64ce opened 1 year ago

patrickvonplaten commented 1 year ago

Sorry I don't understand the question

mayank64ce commented 1 year ago

I meant the output of the original OpenPose is a json file with 2d keypoints which look something like this:

{
  "version": 1.3,
  "people": [
    {
      "person_id": [
        -1
      ],
      "pose_keypoints_2d": [
        535.734,
        246.827,
        0.855832,
        ....
      ],
      "face_keypoints_2d": [
        496.62,
        230.471,
        0.699601,
        ...
      ],
      "hand_left_keypoints_2d": [
        751.966,
        512.104,
        0.542437,
        ...
      ],
      "hand_right_keypoints_2d": [
        266.106,
        510.039,
        0.540713,
        ....
      ],
      "pose_keypoints_3d": [],
      "face_keypoints_3d": [],
      "hand_left_keypoints_3d": [],
      "hand_right_keypoints_3d": []
    }
  ]
} 

Can I get these values, not just the output plot from controlnet_aux ?

pdoane commented 1 year ago

This functionality is in the A1111 implementation, e.g. see https://github.com/Mikubill/sd-webui-controlnet/blob/main/annotator/openpose/__init__.py#L122

mayank64ce commented 1 year ago

So if I pass the poses from https://github.com/patrickvonplaten/controlnet_aux/blob/master/src/controlnet_aux/open_pose/__init__.py#L220

to that function, I should be able to get the json right ?

UPDATE: I tried it and it kinda works. However, the original OpenPose gives 75 values under the pose_keypoints_2d key whereas controlnet_aux is giving 54 values. Is it detecting less points ?

UPDATE 2: Seems like I need BODY_25 but I am not sure how to use it with controlnet.

pdoane commented 1 year ago

There's a good chance that the openpose implementations have diverged. I last updated all of them on 5/27 so it's worth a pass to review.

mayank64ce commented 1 year ago

yeah latest openpose has 7 additinal joints. The pelvis + 2 toes and ankle for both feet. Anyways those didn't matter to me. I approximated the position of pelvis with hip joints and mapped the toes and ankle to feet.