facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.34k stars 7.46k forks source link

Densepose documents need to be update for decode the results? #2185

Open wangsen1312 opened 4 years ago

wangsen1312 commented 4 years ago

I want to decode the results.pkl From the Densepose APPLY_NET documents: it shows:

from densepose.data.structures import DensePoseResult img_id, instance_id = 0, 0 # Look at the first image and the first detected instance bbox_xyxy = data[img_id]['pred_boxes_XYXY'][instance_id] result_encoded = data[img_id]['pred_densepose'].results[instance_id] iuv_arr = DensePoseResult.decode_png_data(*result_encoded)

But for the latest scripts, DensePoseResult part has been removed, so how to get the iuv_arr from the pkl?

Thank you for your help!

vkhalidov commented 3 years ago

@wangsen1312 thanks for pointing this out! Indeed, recently DensePose types were refactored to bring more clarify in terms of what is stored inside the outputs and results. The documentation of apply_net tool has not been updated. Now the results.pkl file is structured as follows: data[img_id]['pred_densepose'] is a list of instances of DensePoseChartResultWithConfidences. Those instances contain the following fields:

So what was previously called IUV is now labels and uv. If you would like to obtain quantized values, i.e. IUV expressed as an uint8 array with labels and U and V coordinates quantized , you can call quantize_densepose_chart_result on an instance of DensePoseChartResultWithConfidences . This will give you an instance of DensePoseChartResultQuantized and IUV values will be stored in its attribute labels_uv_uint8.

Documentation needs to be updated.

wangsen1312 commented 3 years ago

@vkhalidov Thank you for your reply.

xiangyu-getklothed commented 2 years ago

Hi, do you know why there're multiple DensePoseChartResultWithConfidences predicted for a single image even if there's only one person in the image?