YuliangXiu / MobilePose

Light-weight Single Person Pose Estimator
http://xiuyuliang.cn
635 stars 148 forks source link

resulted keypoints are not on right positions. #34

Closed musab1234 closed 5 years ago

musab1234 commented 5 years ago

i am running run_webcam.py and its giving me correct and accurate output on different images but resulted skeleton is rotated at angle. i think its related to pose_fun lambda function in estimator.py which is running after image inference. I have tried different models but same result. Currently i am using resnet18. Thank you

image

Fangyh09 commented 5 years ago

Hi, I think x and y are swapped. You can try keypoint = keypoint[:,::-1] after this line https://github.com/YuliangXiu/MobilePose-pytorch/blob/3a64e58990cfca24b99bb1113d0f6accc2441325/estimator.py#L70

musab1234 commented 5 years ago

Thanks @Fangyh09 , yeah orientations has been fixed now ( by your code snippet) but skeleton is little bit translated to right.

image

Fangyh09 commented 5 years ago

I think it needs a vertical flip. This image is not good to judge, could you try another image which is not so symmetrical?

musab1234 commented 5 years ago

i have swapped points from bottom to top and swapped columns too

keypoints = keypoints[:,::-1]
keypoints = keypoints[::-1,:]

by swaping columns result got more better but same issue with other images too.

test3

Fangyh09 commented 5 years ago

https://github.com/YuliangXiu/MobilePose-pytorch/blob/c5abac58ab24d275618d996aff4edbfe32e8c75a/estimator.py#L75

Yeah, I think the above line is not right. You can try to replace it by:

pose_fun = lambda x: ((((x + 1) * self.output_size - 1) / 2.0-[left_pad, top_pad]) * 1.0 /np.array([new_w, new_h])*np.array([w,h]))