Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset npz interpretation #11

Open
isarandi opened this issue Feb 11, 2022 · 5 comments
Open

Dataset npz interpretation #11

isarandi opened this issue Feb 11, 2022 · 5 comments

Comments

@isarandi
Copy link

isarandi commented Feb 11, 2022

Dear Muhammed,

Thank you for this work and the datasets! I'm trying to interpret the data in the SPEC-SYN npz data files, but I'm not sure what each key means. Is there documentation? They are the following: ['imgname', 'center', 'scale', 'pose', 'shape', 'part', 'mmpose_keypoints', 'openpose', 'openpose_gt', 'S', 'focal_length', 'cam_rotmat', 'cam_trans', 'cam_center', 'cam_pitch', 'cam_roll', 'cam_hfov', 'cam_int', 'camcalib_pitch', 'camcalib_roll', 'camcalib_vfov', 'camcalib_f_pix']

At this point, I'd just like to plot the 24 SMPL joints on the image. Based on the array shape, I assume 'S' contains the joints. Is cam_rotmat the rotation from world space to camera space? Is the cam_trans the position of the camera or the top right part of the extrinsic matrix? I assume for this plotting exercise I can ignore everything except S, cam_rotmat, cam_trans and cam_int. Still for some reason the points end up at at very wrong places. Maybe 'S' is something else? Or am I using the camera params wrong?

Thanks!
Istvan

@isarandi
Copy link
Author

isarandi commented Feb 11, 2022

Ignoring 'S', using 'pose', 'shape' (with the gender-neutral SMPL model, is that correct?) and 'cam_rotmat' and manually fiddling with the translation vector I managed to get an approximate overlap, but I can't seem to find how to determine the person-specific translation vector. 'cam_trans' is the same for each person in the same image.

@isarandi
Copy link
Author

Sorry for bothering again. I've tried out the SPEC-MTP dataset's npz file as well, but this has fewer keys, for example 'cam_int' is not there. How can I build it from the 'focal_length'? It seems that the 'focal_length' field contains smaller numbers than I would expect, but the 'camcalib_f_pix' value is larger than expected to be the value to be used in the intrinsic matrix. In this file, I could also not find 'cam_trans'.

Would it be possible to extend the annotation file with these values?

@rootpine
Copy link

@isarandi
Hello, I am facing the same issue, so how did you solve this ? Thanks.

@isarandi
Copy link
Author

For SPEC-SYN, I ended up computing the extrinsic camera matrix from 2D-3D joint correspondences.

This is the Perspective-n-Point (PnP) problem, and can be solved using cv2.solvePnP() or cv2.calibrateCamera() in OpenCV.

You can get 2D-3D correspondences by pairing up the common subset of joints from 'openpose_gt' (to get the 2D points) and the SMPL joints in 3D. To get SMPL joints, you have to run forward kinematics on the SMPL body model using 'pose' and 'shape', to get 3D joints. For solving PnP you also need the camera intrinsic matrix, that's given in 'cam_int'.

The shared joints between the openpose skeleton and the SMPL skeleton are the neck, shoulders, elbows, wrists, pelvis, hips, knees and ankles. On these joints the two skeletons line up perfectly (I assume 'openpose_gt' was created by projecting these SMPL joints to 2D, but the extrinsic matrix got lost in the process).

For SPEC-MTP, I haven't yet managed to get the 3D poses aligned with the image.

@rootpine
Copy link

rootpine commented Dec 1, 2022

@isarandi
I could solve the problem, thank you for your kind reply ... !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants