Is it for single person pose estimation
DonaldKam opened this issue · 7 comments
def box_to_center_scale(box, model_image_width, model_image_height):
"""convert a box to center,scale information required for pose transformation
Parameters
----------
box : list of tuple
list of length 2 with two tuples of floats representing
bottom left and top right corner of a box
model_image_width : int
model_image_height : int
Returns
-------
(numpy array, numpy array)
Two numpy arrays, coordinates for the center of the box and the scale of the box
"""
center = np.zeros((2), dtype=np.float32)
bottom_left_corner = box[0]
top_right_corner = box[1]
box_width = top_right_corner[0]-bottom_left_corner[0]
box_height = top_right_corner[1]-bottom_left_corner[1]
bottom_left_x = bottom_left_corner[0]
bottom_left_y = bottom_left_corner[1]
center[0] = bottom_left_x + box_width * 0.5
center[1] = bottom_left_y + box_height * 0.5
aspect_ratio = model_image_width * 1.0 / model_image_height
pixel_std = 200
scale = np.array(
[box_width * 1.0 / pixel_std, box_height * 1.0 / pixel_std],
dtype=np.float32)
Why is center[1] not like this : center[1] = bottom_left_y - box_height * 0.5?
Why is pixel_std 200?
Why is scale 2-tuple since it is a single value in annot\train.json?
@HuangJunJie2017
Looking forward to your answer
@DonaldKam I was busy with coco challenge last week,, emmm, pixel_std is use for human bounding box scale normalization, this is not necessary, but the original hrnet use this without any explanation
@HuangJunJie2017 Thank you. Why is scale 2-tuple since it is a single value in annot\train.json?How is it computed? Iam using mpii dataset.
@DonaldKam please refer to https://github.com/HuangJunJie2017/UDP-Pose/blob/master/deep-high-resolution-net.pytorch/lib/dataset/coco.py ,here define how this repo load and pre-process the train/test data
@HuangJunJie2017 Thank you twice but you don't really answer my questions. I am using mpii dataset. MPII instead of COCO! Why is it a single value in annot\train.json (mpii)?How is it computed? It is 2-tuple in COCO.
@DonaldKam mpii is different from coco, and you can refer to https://github.com/HuangJunJie2017/UDP-Pose/blob/master/deep-high-resolution-net.pytorch/lib/dataset/mpii.py for data loading and pre-processing, in line 56 :s = np.array([a['scale'], a['scale']], dtype=np.float) , here single value scale in annotation is conver to 2-tuple